diff --git a/pages/annex/auth/index.vue b/pages/annex/auth/index.vue index fde9a6e..2aa5dbe 100644 --- a/pages/annex/auth/index.vue +++ b/pages/annex/auth/index.vue @@ -141,9 +141,15 @@ url: api, method: 'POST', timeout: 10000, success: (r) => { const d = r.data || {}; - if (d.code === 200) { - const res = d.result || {}; - // 把授权结果写入 storage,web_view onShow 读取后刷新 H5 URL + const res = d.result || {}; + // ⚠️ 成功判据必须核对「手机号真的拿到了」:提交了 code 时, + // 后端解密失败(如 access_token 被商城后端挤掉)会如实返回 + // code!=200;旧版后端也可能 200 但 result.phone 为空。 + // 两种情况都不能写 __AUTH_RESULT__、不能提示成功 —— 否则 H5 + // 收到空 phone 的回传,闸门拦截,用户会陷入「授权成功却又 + // 要求授权」的死循环(2026-09-18 孕检日历实测)。 + const phoneMissing = !!this._authCode && !res.phone; + if (d.code === 200 && !phoneMissing) { uni.setStorageSync('__AUTH_RESULT__', { openid: openid, phone: res.phone || '', @@ -155,7 +161,7 @@ uni.navigateBack(); }, 600); } else { - uni.showToast({ title: d.message || '授权保存失败', icon: 'none' }); + uni.showToast({ title: (d.message || '授权保存失败,请稍后重试'), icon: 'none', duration: 3000 }); } }, fail: () => uni.showToast({ title: '授权请求失败,请检查网络', icon: 'none' })