Commit 527c81f9 authored by 徐俊's avatar 徐俊
parents 26d95036 bac0cea6
...@@ -322,12 +322,7 @@ export function changeSystemType (type) { ...@@ -322,12 +322,7 @@ export function changeSystemType (type) {
this.$router.push('/') this.$router.push('/')
resolve(true) resolve(true)
} catch (e) { } catch (e) {
this.$api.base.logout().then(({ data }) => { }).catch(() => { }) store.dispatch('user/logout')
removeToken()
window.sessionStorage.clear();
this.$store.commit('app/clearStore')
this.$router.push(`/login`)
reject(false)
} }
}) })
} }
......
...@@ -17,6 +17,11 @@ const mutations = { ...@@ -17,6 +17,11 @@ const mutations = {
}, },
setTabsArray: (state, payload) => { setTabsArray: (state, payload) => {
state.tabsArray = payload state.tabsArray = payload
if (!!state.tabsArray && state.tabsArray.length > 0) {
if (state.tabsArray[0].key != '0') {
state.tabsArray.unshift({ title: '首页', key: '0', code: 'home', keepAlive: 1, router: '/home', closable: false })
}
}
}, },
setSystemType: (state, payload) => { setSystemType: (state, payload) => {
state.systemType = payload state.systemType = payload
......
// @ts-nocheck // @ts-nocheck
import router from '@/router' import router from '@/router'
import api from '@/api' import api from '@/api'
import { getType } from '@/views/utils/auth' import { getToken, removeToken, getType, setType } from '@/views/utils/auth'
const state = { const state = {
...@@ -50,6 +50,17 @@ const actions = { ...@@ -50,6 +50,17 @@ const actions = {
}) })
}) })
}, },
logout ({ dispatch }) {
_this = this
return new Promise(async (resolve, reject) => {
_this.$message.error('登录信息失效,请重新登录!')
_this.$api.base.logout().then(({ data }) => { }).catch(() => { })
removeToken()
window.sessionStorage.clear()
_this.$store.commit('app/clearStore')
_this.$router.push(`/login`)
})
},
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment