fix: 登录页面和退出的问题

This commit is contained in:
cgd_mac 2022-02-23 19:20:24 +08:00
parent 0ca808cf94
commit fa29c41314
2 changed files with 16 additions and 9 deletions

View File

@ -3,7 +3,7 @@
<div class="container"> <div class="container">
<div class="top"> <div class="top">
<div class="header"> <div class="header">
<a href="/"> <a href="javascript:void(0);">
<img src="~@/assets/logo.svg" class="logo" alt="logo"> <img src="~@/assets/logo.svg" class="logo" alt="logo">
<span class="title">安全培训平台</span> <span class="title">安全培训平台</span>
</a> </a>

View File

@ -78,16 +78,23 @@ const user = {
// 登出 // 登出
Logout ({ commit, state }) { Logout ({ commit, state }) {
return new Promise((resolve) => { return new Promise((resolve) => {
logout().then(() => { const clear = function () {
resolve()
}).catch(() => {
resolve()
}).finally(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
commit('SET_ROLES', []) commit('SET_ROLES', [])
commit('SET_BUTTONS', []) commit('SET_BUTTONS', [])
commit('SET_ROUTERS', []) commit('SET_ROUTERS', [])
storage.remove(ACCESS_TOKEN) storage.remove(ACCESS_TOKEN)
}
logout().then(() => {
clear()
setTimeout(() => {
resolve()
}, 300)
resolve()
}).catch(() => {
resolve()
}).finally(() => {
clear()
}) })
}) })
} }