|
@@ -1,5 +1,5 @@
|
|
|
import {getUserInfo, loginByUsername, logout, verifyCode} from '@/api/login'
|
|
|
-import {getToken, removeToken, setLoginStatus, setToken} from '@/utils/auth'
|
|
|
+import {getToken, removeToken,setToken} from '@/utils/auth'
|
|
|
|
|
|
const user = {
|
|
|
state: {
|
|
@@ -53,7 +53,7 @@ const user = {
|
|
|
verifyCode().then(response => {
|
|
|
const token = response.headers['session_id']
|
|
|
commit('SET_TOKEN', token)
|
|
|
- setToken(token)
|
|
|
+ setToken(token,0)
|
|
|
resolve(response)
|
|
|
}).catch(error => {
|
|
|
reject(error)
|
|
@@ -68,8 +68,7 @@ const user = {
|
|
|
loginByUsername(username, userInfo.password, userInfo.verifyCode).then(response => {
|
|
|
const token = response.data.data.token
|
|
|
commit('SET_TOKEN', token)
|
|
|
- setToken(token)
|
|
|
- setLoginStatus(true)
|
|
|
+ setToken(token, 1)
|
|
|
resolve()
|
|
|
}).catch(error => {
|
|
|
reject(error)
|
|
@@ -136,24 +135,6 @@ const user = {
|
|
|
removeToken()
|
|
|
resolve()
|
|
|
})
|
|
|
- },
|
|
|
-
|
|
|
- // 动态修改权限
|
|
|
- ChangeRoles({commit, dispatch}, role) {
|
|
|
- return new Promise(resolve => {
|
|
|
- commit('SET_TOKEN', role)
|
|
|
- setToken(role)
|
|
|
- getUserInfo(role).then(response => {
|
|
|
- const data = response.data
|
|
|
- commit('SET_ROLES', data.roles)
|
|
|
- commit('SET_PERMS', data.perms)
|
|
|
- commit('SET_NAME', data.name)
|
|
|
- commit('SET_AVATAR', data.avatar)
|
|
|
- commit('SET_INTRODUCTION', data.introduction)
|
|
|
- dispatch('GenerateRoutes', data) // 动态修改权限后 重绘侧边菜单
|
|
|
- resolve()
|
|
|
- })
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
}
|