Commit 34e4a7d4 by 李伟康

feat(api): 统一请求添加 source 参数标识来源

在 signHttp 请求中默认添加 `data.source = 1`,用于标识请求来源。
同时移除了 init.js 中冗余的 headers 配置,并调整了错误处理逻辑缩进。

fix(init): 修复网络异常提示未触发的问题

调整 error 回调中的判断条件与 toast 提示代码结构,确保网络异常时能正确显示提示。

feat(pages): 新增支付弹窗关闭回调并跳转订单管理页

为 OrderPay 弹窗组件新增 closePopup 事件回调,
并在 CreateOrder 组件中实现跳转至订单管理页面的逻辑。
1 parent d7c5ec42
......@@ -13,6 +13,7 @@ module.exports = {
return;
}
if (!uni.$signHttp) uni.$signHttp = new Request(uni.signHttpConfig)
data.source = 1
resolve(uni.$signHttp.post(url, data, _config))
}
})
......
......@@ -39,9 +39,6 @@ uni.signHttpConfig = {
timeout: 300000,
appId: signSecretKey.appKey,
appSecret: signSecretKey.secret,
headers: {
'source': 'app'
},
session: {
requiresSession: true,
sessionParamName: 'sessionId',
......@@ -71,11 +68,11 @@ uni.signHttpConfig = {
},
error: (error, config) => {
console.log('error事件触发', error, config)
if(error && error.errMsg == 'request:fail') {
if (error && error.errMsg == 'request:fail') {
return uni.showToast({
title: '网络异常',
icon: 'none',
})
title: '网络异常',
icon: 'none',
})
}
uni.showToast({
title: error.msg || '业务异常',
......
......@@ -91,6 +91,7 @@
<!-- 支付弹框 -->
<OrderPay
ref="OrderPay"
@closePopup="closePopup"
@jumpSuccess="jumpSuccess"
/>
</view>
......@@ -949,6 +950,9 @@ export default {
}
return parseFloat(strVal)
},
closePopup(){
this.$emit('jump', 'OrderManagement')
}
}
}
</script>
......
......@@ -143,6 +143,7 @@ export default {
closePopup () {
this.show = false
this.$refs.payPopup.closePopup()
this.$emit('closePopup')
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!