From 34a3887b2d7dc0cda816554ee173caad62843436 Mon Sep 17 00:00:00 2001 From: ozh Date: Wed, 16 Sep 2026 15:12:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(login):=20noMobile=20=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E7=BC=BA=20openId=20=E6=97=B6=E4=BB=8E=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=85=9C=E5=BA=95=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E9=93=BE=E8=B7=AF=E6=96=AD=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index b34baa7..572c11b 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -13,6 +13,8 @@ import { import { useToast } from '@/hooks/useToast' import { ROUTES } from '@/constants/routes' import { reLaunch } from '@/utils/navigation' +import { storage } from '@/utils/storage' +import { WX_OPENID_STORAGE_KEY } from '@/constants/auth' import styles from './index.module.scss' export default function Login() { @@ -34,7 +36,10 @@ export default function Login() { const state = getLoginSubState(result) if (state !== 'complete') { console.log('[login-page] 注册未完成,推进到', state) - if (result.openId) setOpenId(result.openId) + // noMobile 响应可能不回传 openId(首次 needUserInfo 已缓存本地),从 storage 兜底 + const openIdNext = result.openId ?? storage.get(WX_OPENID_STORAGE_KEY) ?? openId + if (!openIdNext) throw new Error('响应缺少 openId,无法继续授权') + setOpenId(openIdNext) setSubState(state) setLoading(false) return