登录
This commit is contained in:
@@ -5,14 +5,16 @@ const state = {
|
||||
accountId: getStore('accountId') || '',
|
||||
accountName: getStore('accountName') || '',
|
||||
userName: getStore('userName') || '',
|
||||
deptUuid: getStore('deptUuid') || ''
|
||||
deptUuid: getStore('deptUuid') || '',
|
||||
userInfo: localStorage.getItem('userInfo') || '' // 用户信息
|
||||
}
|
||||
|
||||
const getters = {
|
||||
accountId: state => state.accountId,
|
||||
accountName: state => state.accountName,
|
||||
userName: state => state.userName,
|
||||
deptUuid: state => state.deptUuid
|
||||
deptUuid: state => state.deptUuid,
|
||||
userInfo: state => state.userInfo
|
||||
}
|
||||
|
||||
const actions = {
|
||||
@@ -23,11 +25,12 @@ const actions = {
|
||||
setStore('deptUuid', res.dept_uuid)
|
||||
commit(types.SET_USER_INFO, res)
|
||||
},
|
||||
userInfo ({ commit }, res) {
|
||||
localStorage.setItem('userInfo', res)
|
||||
commit(types.SET_USER_INFO, res)
|
||||
},
|
||||
setSignOut ({ commit }) {
|
||||
localStorage.removeItem('accountId')
|
||||
localStorage.removeItem('userName')
|
||||
localStorage.removeItem('accountName')
|
||||
localStorage.removeItem('deptUuid')
|
||||
localStorage.removeItem('userInfo')
|
||||
commit(types.SET_SIGN_OUT)
|
||||
}
|
||||
}
|
||||
@@ -39,6 +42,9 @@ const mutations = {
|
||||
state.userName = res.user_name
|
||||
state.memberName = res.member_name
|
||||
},
|
||||
[types.SET_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.SET_SIGN_OUT] (state) {
|
||||
state.accountId = ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user