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 = { ...@@ -13,6 +13,7 @@ module.exports = {
return; return;
} }
if (!uni.$signHttp) uni.$signHttp = new Request(uni.signHttpConfig) if (!uni.$signHttp) uni.$signHttp = new Request(uni.signHttpConfig)
data.source = 1
resolve(uni.$signHttp.post(url, data, _config)) resolve(uni.$signHttp.post(url, data, _config))
} }
}) })
......
...@@ -39,9 +39,6 @@ uni.signHttpConfig = { ...@@ -39,9 +39,6 @@ uni.signHttpConfig = {
timeout: 300000, timeout: 300000,
appId: signSecretKey.appKey, appId: signSecretKey.appKey,
appSecret: signSecretKey.secret, appSecret: signSecretKey.secret,
headers: {
'source': 'app'
},
session: { session: {
requiresSession: true, requiresSession: true,
sessionParamName: 'sessionId', sessionParamName: 'sessionId',
...@@ -71,11 +68,11 @@ uni.signHttpConfig = { ...@@ -71,11 +68,11 @@ uni.signHttpConfig = {
}, },
error: (error, config) => { error: (error, config) => {
console.log('error事件触发', error, config) console.log('error事件触发', error, config)
if(error && error.errMsg == 'request:fail') { if (error && error.errMsg == 'request:fail') {
return uni.showToast({ return uni.showToast({
title: '网络异常', title: '网络异常',
icon: 'none', icon: 'none',
}) })
} }
uni.showToast({ uni.showToast({
title: error.msg || '业务异常', title: error.msg || '业务异常',
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<!-- 支付弹框 --> <!-- 支付弹框 -->
<OrderPay <OrderPay
ref="OrderPay" ref="OrderPay"
@closePopup="closePopup"
@jumpSuccess="jumpSuccess" @jumpSuccess="jumpSuccess"
/> />
</view> </view>
...@@ -949,6 +950,9 @@ export default { ...@@ -949,6 +950,9 @@ export default {
} }
return parseFloat(strVal) return parseFloat(strVal)
}, },
closePopup(){
this.$emit('jump', 'OrderManagement')
}
} }
} }
</script> </script>
......
...@@ -143,6 +143,7 @@ export default { ...@@ -143,6 +143,7 @@ export default {
closePopup () { closePopup () {
this.show = false this.show = false
this.$refs.payPopup.closePopup() 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!