fix(wechat): 结算挂起的协议 4510 请求,避免页面 loading 卡死
自动发布开发环境 Nacos 配置 / publish (push) Successful in 21s

This commit is contained in:
2026-11-05 10:39:34 +08:00
parent 702c186f65
commit 3f825682fb
4 changed files with 279 additions and 59 deletions
+20
View File
@@ -41,6 +41,25 @@ Page({
}
},
onHide() {
this.discardPendingIfNotAccepted()
},
onUnload() {
this.discardPendingIfNotAccepted()
},
/**
* 用户未完成同意就离开协议页(返回/隐藏/卸载)时,立即结算被 4510 挂起的请求,
* 避免调用方 loading 永久卡住;同意成功后不再触发。
*/
discardPendingIfNotAccepted() {
if (this.data.mode !== 'accept' || this.agreementAccepted) {
return
}
request.discardPendingAgreement()
},
toggleAgreement() {
if (this.data.accepting) {
return
@@ -55,6 +74,7 @@ Page({
this.setData({ accepting: true })
try {
await authApi.acceptAgreements('WECHAT_MINI')
this.agreementAccepted = true
wx.showToast({ title: '已同意', icon: 'success' })
// 同意成功后重放首个被 4510 拦下的请求一次;失败不再循环。
request.retryPendingAfterAgreement()