This commit is contained in:
cao123
2026-09-07 13:50:02 +08:00
parent 1033136997
commit 89cd9d0404
6 changed files with 282 additions and 173 deletions
+1 -6
View File
@@ -76,21 +76,16 @@ App<IAppOption>({
},
checkLoginState() {
const openId = wx.getStorageSync('openId');
const unionId = wx.getStorageSync('unionId');
const userId = wx.getStorageSync('userId');
const isLoggedIn = !!(openId && unionId && userId);
const isLoggedIn = !!(openId && userId);
if (!isLoggedIn) {
// 清理登录相关缓存
LOGIN_STORAGE_KEYS.forEach(key => wx.removeStorageSync(key));
}
// 记录上一次登录状态,用于判断是否从已登录变为未登录
const prev = this.globalData.isLogin;
this.globalData.isLogin = isLoggedIn;
this.globalData.wasLogin = prev;
return isLoggedIn;
},
login(value: string) {