fix: 退出登录与云闪付入口统一清理账号缓存,避免串号与脏数据

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,后端会话优先会把上一个账号的数据返回给新用户
This commit is contained in:
jacobxu666
2026-09-15 10:17:27 +08:00
parent f69bd630a4
commit a53b228f0b
3 changed files with 24 additions and 2 deletions
+15
View File
@@ -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)
}
}