From a53b228f0b1ef3dfe0334f15de81e806ddee24f2 Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Tue, 15 Sep 2026 10:17:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=B8=8E=E4=BA=91=E9=97=AA=E4=BB=98=E5=85=A5=E5=8F=A3=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=B8=85=E7=90=86=E8=B4=A6=E5=8F=B7=E7=BC=93=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E4=B8=B2=E5=8F=B7=E4=B8=8E=E8=84=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增 common/account.js,集中维护账号级本地缓存 key(token/phone/isAuth/hasWin/cardNumber/expiresTime/rightsCount/totalValueFen/authFlowStarted/authName/authIdNo),定位 lng/lat 属设备信息不清 2. 我的页退出登录原来只清 token/phone,权益缓存残留会被下一个账号当成自己的数据展示(权益页首屏读这些 key 兜底,且无手机号时 refreshStatus 不会刷新) 3. 首页云闪付入口是免密换人,进入前先清上一个账号的会话与权益缓存,否则请求仍带旧 accessToken,后端会话优先会把上一个账号的数据返回给新用户 --- common/account.js | 15 +++++++++++++++ pages/index/index.vue | 5 +++++ pages/mine/mine.vue | 6 ++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 common/account.js diff --git a/common/account.js b/common/account.js new file mode 100644 index 0000000..b394963 --- /dev/null +++ b/common/account.js @@ -0,0 +1,15 @@ +// xuchao: 账号级本地缓存集中管理。权益页首屏会读这些缓存做兜底展示, +// 换账号/退出时漏清就会把上一个账号的中奖状态、卡号、到期时间当成当前账号的数据展示。 +const ACCOUNT_KEYS = ['token', 'phone', 'isAuth', 'hasWin', 'cardNumber', 'expiresTime', + 'rightsCount', 'totalValueFen', 'authFlowStarted', 'authName', 'authIdNo'] + +export default { + // 清空当前账号的本地会话与权益缓存(定位 lng/lat 属于设备信息,不在此列) + clearAccountCache() { + ACCOUNT_KEYS.forEach(key => uni.removeStorageSync(key)) + }, + // 账号标识(手机号) + setAccountPhone(phone) { + uni.setStorageSync('phone', phone) + } +} diff --git a/pages/index/index.vue b/pages/index/index.vue index b646d2e..7ad14a7 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -34,6 +34,8 @@