Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
e73a8b47
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6006
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e73a8b47
编写于
2月 29, 2024
作者:
shutao-dc
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'remotes/origin/dev' into alpha
上级
ca52dd66
f7983bbb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
106 addition
and
96 deletion
+106
-96
pages/API/request-payment/reqeust-payment.test.js
pages/API/request-payment/reqeust-payment.test.js
+5
-15
pages/API/request-payment/request-payment.uvue
pages/API/request-payment/request-payment.uvue
+18
-2
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
...PI/set-navigation-bar-color/set-navigation-bar-color.uvue
+83
-79
未找到文件。
pages/API/request-payment/reqeust-payment.test.js
浏览文件 @
e73a8b47
...
...
@@ -9,24 +9,14 @@ describe("payment", () => {
//支付失败700711
it
(
"
errorcode700711
"
,
async
()
=>
{
let
orderInfo
=
"
service=
\"
111
"
;
"
service=
\"
mobile.securitypay.pay
\"
&partner=
\"
2088801273866834
\"
&_input_charset=
\"
UTF-8
\"
&out_trade_no=
\"
20240229115452
\"
&subject=
\"
DCloud项目捐赠
\"
&payment_type=
\"
1
\"
&seller_id=
\"
payservice@dcloud.io
\"
&total_fee=
\"
0.01
\"
&body=
\"
DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。
\"
&it_b_pay=
\"
1d
\"
¬ify_url=
\"
http%3A%2F%2Fdemo.dcloud.net.cn%2Fpayment%2Falipay%2Fnotify.php
\"
&show_url=
\"
http%3A%2F%2Fwww.dcloud.io%2Fhelloh5%2F
\"
&sign=
\"
diZdkTX2iIP1oZh25UCGqx%2BpkViqAN8xdvMNSJF79aq0JiunX2mtr%2BbNlDsP0YL5x85KjULsqx%2Fq%2B5wij6eMoBVeJ%2BHhyjkwt0PYuwntroJ2Ho8bdUVEybBgOjy240NbCUtKmZzNRQAGsmLztKWzsg1srsQ8Se3Qi8KGDaOhqBs%3D
\"
&sign_type=
\"
RSA
\"
"
;
await
page
.
setData
({
orderinfo
:
orderInfo
,
})
await
page
.
callMethod
(
'
pay
'
)
await
page
.
waitFor
(
10000
);
await
page
.
callMethod
(
'
jest_pay
'
)
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
complete
'
)
===
true
;
});
expect
((
await
page
.
data
())[
'
errorCode
'
]).
toEqual
(
700711
)
});
//重复支付
it
(
"
errorcode700712
"
,
async
()
=>
{
let
orderInfo
=
"
service=
\"
mobile.securitypay.pay
\"
&partner=
\"
2088801273866834
\"
&_input_charset=
\"
UTF-8
\"
&out_trade_no=
\"
20240226180607
\"
&subject=
\"
DCloud项目捐赠
\"
&payment_type=
\"
1
\"
&seller_id=
\"
payservice@dcloud.io
\"
&total_fee=
\"
0.01
\"
&body=
\"
DCloud致力于打造HTML5最好的移动开发工具,包括终端的Runtime、云端的服务和IDE,同时提供各项配套的开发者服务。
\"
&it_b_pay=
\"
1d
\"
¬ify_url=
\"
http%3A%2F%2Fdemo.dcloud.net.cn%2Fpayment%2Falipay%2Fnotify.php
\"
&show_url=
\"
http%3A%2F%2Fwww.dcloud.io%2Fhelloh5%2F
\"
&sign=
\"
iYxQ8EmMdezAWPMGIFXifBoEkotH0Fg%2BLbNNgAP%2F%2BJquO0rLgoxgF8b%2Fo5lhUIQT7MkDf2JacmHvrUAZqQAuL%2BaPG%2BCOUu7hMu7zlZt3k7%2F1sUv9HFxP%2FhCFssfpZXhpTGEkttF6CmF7YQueCtxsAYBqBpQsVwGb2Pxi01ylko0%3D
\"
&sign_type=
\"
RSA
\"
"
;
await
page
.
setData
({
orderinfo
:
orderInfo
,
})
await
page
.
callMethod
(
'
pay
'
)
await
page
.
waitFor
(
6000
);
expect
((
await
page
.
data
())[
'
errorCode
'
]).
toEqual
(
700712
)
});
});
pages/API/request-payment/request-payment.uvue
浏览文件 @
e73a8b47
...
...
@@ -11,7 +11,8 @@
btnType: "primary",
orderInfo: "",
errorCode: 0,
errorMsg: ""
errorMsg: "",
complete: false
}
},
methods: {
...
...
@@ -29,7 +30,7 @@
provider: "alipay",
orderInfo: res.data as string,
fail: (res : RequestPaymentFail) => {
console.log(JSON.stringify(res))
console.log(JSON.stringify(res))
this.errorCode = res.errCode
uni.showToast({
icon: 'error',
...
...
@@ -49,6 +50,21 @@
uni.hideLoading()
},
});
},
//自动化测试使用
jest_pay() {
uni.requestPayment({
provider: "alipay",
orderInfo: this.orderInfo,
fail: (res : RequestPaymentFail) => {
this.errorCode = res.errCode
this.complete = true
},
success: (res : RequestPaymentSuccess) => {
console.log(JSON.stringify(res))
this.complete = true
}
} as RequestPaymentOptions)
}
}
}
...
...
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
浏览文件 @
e73a8b47
<template>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置导航条背景绿色,标题白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
<button @tap="goNavbarLite" class="uni-btn">
跳转自定义导航栏页面
</button>
<button @tap="goCustomNavigation" class="uni-btn">
跳转设置状态栏页面
</button>
</view>
</template>
<script>
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
methods: {
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#00ff00',
success: () => {
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ff0000',
success: () => {
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
// 自动化测试
getLifeCycleNum() : number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
},
goNavbarLite() {
uni.navigateTo({
url: '/pages/template/navbar-lite/navbar-lite'
})
},
goCustomNavigation(){
uni.navigateTo({
url: '/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation'
})
}
},
}
<template>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置导航条背景绿色,标题白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
<!-- #ifdef WEB -->
<button @tap="goNavbarLite" class="uni-btn">
跳转自定义导航栏页面
</button>
<!-- #endif -->
<!-- #ifdef APP -->
<button @tap="goCustomNavigation" class="uni-btn">
跳转设置状态栏页面
</button>
<!-- #endif -->
</view>
</template>
<script>
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
methods: {
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#00ff00',
success: () => {
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ff0000',
success: () => {
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
// 自动化测试
getLifeCycleNum() : number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
},
goNavbarLite() {
uni.navigateTo({
url: '/pages/template/navbar-lite/navbar-lite'
})
},
goCustomNavigation() {
uni.navigateTo({
url: '/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation'
})
}
},
}
</script>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录