fix(view): 🐛 修复异常关闭再重新登录会不显示会话的bug

This commit is contained in:
ZOL4789
2024-12-14 15:19:58 +08:00
committed by Dawn
parent cabb8c6cc8
commit 096df49dcd
3 changed files with 8 additions and 8 deletions

View File

@@ -236,12 +236,12 @@ const handleCloseWin = async () => {
}
const offline = async () => {
if (!login.value.autoLogin) {
localStorage.removeItem('TOKEN')
}
apis.offline().catch(() => {
// 通知下线失败也没关系
})
if (!login.value.autoLogin) {
localStorage.removeItem('TOKEN')
}
}
let unOffline: Promise<UnlistenFn>
useMitt.on('handleCloseWin', handleCloseWin)

View File

@@ -107,11 +107,9 @@ const moreList = ref<OPT.L.MoreList[]>([
await apis.logout().catch(() => {})
await logout()
// 如果没有设置自动登录,则清除用户信息
if (!userStore.userInfo) {
userStore.userInfo = {}
localStorage.removeItem('USER_INFO')
localStorage.removeItem('TOKEN')
}
userStore.userInfo = {}
localStorage.removeItem('USER_INFO')
localStorage.removeItem('TOKEN')
userStore.isSign = false
loginStore.loginStatus = LoginStatus.Init
}

View File

@@ -240,6 +240,8 @@ const giveAccount = (item: UserInfoType) => {
/**登录后创建主页窗口*/
const normalLogin = async () => {
// 普通登录前需清空token
localStorage.removeItem('TOKEN')
loading.value = true
const { account, password } = info.value
apis