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
+5
View File
@@ -34,6 +34,8 @@
</template>
<script>
import account from '@/common/account.js'
export default {
data() {
return {
@@ -70,6 +72,9 @@
handleTokenLogin(token) {
this.$u.api.tokenDecode({ token }).then(res => {
if (res.errcode === 0 && res.data && res.data.mobile) {
// xuchao: 云闪付入口是“免密换人”,先丢弃本机上一个账号的会话与权益缓存,
// 否则请求仍带旧 accessToken,后端“会话优先”会把上一个账号的数据返回给这位用户
account.clearAccountCache()
uni.setStorageSync('phone', res.data.mobile)
this.$u.api.getEligibility({ phone: res.data.mobile, identityNo: res.data.idNo || '', name: res.data.name || '' }).then(eRes => {
if (eRes.errcode === 0) {