fix: 只接受非空字符串凭证,防脏 accessToken 打挂鉴权;修正认证页提示文案

This commit is contained in:
jacobxu666
2026-09-15 12:42:36 +08:00
parent 1fe8c133ad
commit 6b1037893e
3 changed files with 10 additions and 6 deletions
+5 -2
View File
@@ -93,8 +93,11 @@
this.finishTokenLogin()
if (res.errcode === 0 && res.data && res.data.mobile) {
uni.setStorageSync('phone', res.data.mobile)
// xuchao: 后端已为云闪付入口签发会员会话,存下 accessToken,后续接口才认得这个用户
if (res.data.accessToken) uni.setStorageSync('token', res.data.accessToken)
// xuchao: 后端已为云闪付入口签发会员会话,存下 accessToken,后续接口才认得这个用户。
// 只认"非空字符串":后端字段缺失/为 null 时会被序列化成 {},直接存进缓存
// 就会变成 Bearer [object Object],把所有鉴权接口全打挂
const issued = typeof res.data.accessToken === 'string' ? res.data.accessToken : ''
if (issued) uni.setStorageSync('token', issued)
this.$u.api.getEligibility({ phone: res.data.mobile, identityNo: res.data.idNo || '', name: res.data.name || '' }).then(eRes => {
if (eRes.errcode === 0) {
uni.setStorageSync('isAuth', eRes.data.isAuth)