From 10905df14304e9779e3b57d2146c1471495dc8b4 Mon Sep 17 00:00:00 2001 From: ozh Date: Wed, 16 Sep 2026 15:15:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(login):=20noMobile=20=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E5=B0=86=20openId=20=E6=94=BE=20bindKey=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=BF=94=E5=9B=9E=EF=BC=8C=E7=BA=B3=E5=85=A5?= =?UTF-8?q?=E5=85=9C=E5=BA=95=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 572c11b..0237384 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -36,8 +36,11 @@ export default function Login() { const state = getLoginSubState(result) if (state !== 'complete') { console.log('[login-page] 注册未完成,推进到', state) - // noMobile 响应可能不回传 openId(首次 needUserInfo 已缓存本地),从 storage 兜底 - const openIdNext = result.openId ?? storage.get(WX_OPENID_STORAGE_KEY) ?? openId + // openId 兜底链:noMobile 阶段后端把 openId 放在 bindKey 字段返回(联调实测); + // 其余阶段从本地缓存(needUserInfo 时已写入)兜底 + const openIdNext = + result.openId ?? (state === 'noMobile' ? result.bindKey : undefined) ?? + storage.get(WX_OPENID_STORAGE_KEY) ?? openId if (!openIdNext) throw new Error('响应缺少 openId,无法继续授权') setOpenId(openIdNext) setSubState(state)