增加多角色功能和角色切换功能

调整前端获取用户信息方式
This commit is contained in:
pixel
2021-07-22 16:46:09 +08:00
parent 152cb4ec01
commit 8f9ecebf41
20 changed files with 323 additions and 68 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
import { login } from '@/api/user'
import { login, getUserInfo } from '@/api/user'
import { jsonInBlacklist } from '@/api/jwt'
import router from '@/router/index'
import { setUserInfo } from '@/api/user'
@@ -56,6 +56,13 @@ export const user = {
}
},
actions: {
async GetUserInfo({ commit }) {
const res = await getUserInfo()
if (res.code === 0) {
commit('setUserInfo', res.data.userInfo)
}
return res
},
async LoginIn({ commit, dispatch, rootGetters, getters }, loginInfo) {
const res = await login(loginInfo)
if (res.code === 0) {