This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user