From 3216e2399bc3e04fd179958e1a77a520cb082d16 Mon Sep 17 00:00:00 2001 From: Pine Date: Thu, 27 Aug 2026 20:27:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(auth):=20web=20=E6=AD=A3=E7=A1=AE=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E6=89=8B=E6=9C=BA=E5=8F=B7=E4=B8=8E=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F/=E5=BE=AE=E4=BF=A1=E7=BB=91=E5=AE=9A=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - auth.pickUser 持久化 wxBound/wxMiniBound - Profile.refreshBind 用 fresh /auth/me 回写用户缓存与卡片,取消 stale localStorage --- website/src/services/auth.js | 2 ++ website/src/user/Profile.jsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/website/src/services/auth.js b/website/src/services/auth.js index 75194d4..3036fbb 100644 --- a/website/src/services/auth.js +++ b/website/src/services/auth.js @@ -23,6 +23,8 @@ function pickUser(d) { avatar: d.avatar || '', phone: d.phone || '', phoneBound: !!d.phoneBound, + wxBound: !!d.wxBound, + wxMiniBound: !!d.wxMiniBound, role: d.role || '', account_type: d.account_type || '', account_type_label: d.account_type_label || '', diff --git a/website/src/user/Profile.jsx b/website/src/user/Profile.jsx index c08891c..a5d203f 100644 --- a/website/src/user/Profile.jsx +++ b/website/src/user/Profile.jsx @@ -71,6 +71,8 @@ export default function Profile() { try { const p = await me(); setBind({ phone: p.phone || '', phoneBound: !!p.phoneBound, wxBound: !!p.wxBound, wxMiniBound: !!p.wxMiniBound }); + // 用 fresh /me 回写本地用户缓存与用户卡,避免读 stale localStorage 导致手机号/绑定不同步 + saveUser({ ...getUser(), phone: p.phone || '', phoneBound: !!p.phoneBound, wxBound: !!p.wxBound, wxMiniBound: !!p.wxMiniBound }); setUser(getUser() || {}); } catch (e) { /* 未登录 */ } };