fix: 登录页面和退出的问题
This commit is contained in:
parent
0ca808cf94
commit
fa29c41314
|
@ -3,7 +3,7 @@
|
|||
<div class="container">
|
||||
<div class="top">
|
||||
<div class="header">
|
||||
<a href="/">
|
||||
<a href="javascript:void(0);">
|
||||
<img src="~@/assets/logo.svg" class="logo" alt="logo">
|
||||
<span class="title">安全培训平台</span>
|
||||
</a>
|
||||
|
|
|
@ -78,16 +78,23 @@ const user = {
|
|||
// 登出
|
||||
Logout ({ commit, state }) {
|
||||
return new Promise((resolve) => {
|
||||
logout().then(() => {
|
||||
resolve()
|
||||
}).catch(() => {
|
||||
resolve()
|
||||
}).finally(() => {
|
||||
const clear = function () {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_BUTTONS', [])
|
||||
commit('SET_ROUTERS', [])
|
||||
storage.remove(ACCESS_TOKEN)
|
||||
}
|
||||
logout().then(() => {
|
||||
clear()
|
||||
setTimeout(() => {
|
||||
resolve()
|
||||
}, 300)
|
||||
resolve()
|
||||
}).catch(() => {
|
||||
resolve()
|
||||
}).finally(() => {
|
||||
clear()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue