增加userId获取方法

This commit is contained in:
huangdeliang 2021-01-19 12:15:24 +08:00
parent b7b94de40e
commit 53bc0d22fd
2 changed files with 6 additions and 1 deletions
stdiet-ui/src/store

@ -10,6 +10,7 @@ const getters = {
introduction: state => state.user.introduction,
roles: state => state.user.roles,
permissions: state => state.user.permissions,
userId: state => state.user.userId,
permission_routes: state => state.permission.routes
}
export default getters

@ -25,6 +25,9 @@ const user = {
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
SET_USERID: (state, userId) => {
state.userId = userId
}
},
@ -60,13 +63,14 @@ const user = {
}
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
commit('SET_USERID', user.userId)
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {