登录、home、工单管理
This commit is contained in:
@@ -5,14 +5,18 @@ const state = {
|
||||
accountId: getStore('accountId') || '',
|
||||
accountName: getStore('accountName') || '',
|
||||
userName: getStore('userName') || '',
|
||||
deptName: getStore('deptName') || ''
|
||||
deptName: getStore('deptName') || '',
|
||||
userInfo: getStore('userInfo') ? getStore('userInfo') : '',
|
||||
saveToken: getStore('saveToken') || ''
|
||||
}
|
||||
|
||||
const getters = {
|
||||
accountId: state => state.accountId,
|
||||
accountName: state => state.accountName,
|
||||
userName: state => state.userName,
|
||||
deptName: state => state.deptName
|
||||
deptName: state => state.deptName,
|
||||
userInfo: state => state.userInfo,
|
||||
saveToken: state => state.saveToken
|
||||
}
|
||||
|
||||
const actions = {
|
||||
@@ -29,6 +33,18 @@ const actions = {
|
||||
localStorage.removeItem('userName')
|
||||
localStorage.removeItem('deptName')
|
||||
commit(types.SET_SIGN_OUT)
|
||||
},
|
||||
saveUserInfo ({commit}, res) {
|
||||
setStore('userInfo', res)
|
||||
commit(types.SAVE_USER_INFO, res)
|
||||
},
|
||||
delUserInfo ({commit}, res) {
|
||||
localStorage.removeItem('userInfo')
|
||||
commit(types.DEL_USER_INFO, res)
|
||||
},
|
||||
saveToken ({commit}, res) {
|
||||
setStore('saveToken', res)
|
||||
commit(types.SAVE_TOKEN, res)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +60,15 @@ const mutations = {
|
||||
state.accountName = ''
|
||||
state.userName = ''
|
||||
state.deptName = ''
|
||||
},
|
||||
[types.SAVE_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.DEL_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.SAVE_TOKEN] (state, res) {
|
||||
state.saveToken = res
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ export const COM_ALERT_MSG = 'COM_ALERT_MSG'
|
||||
// 用户
|
||||
export const SET_USER_INFO = 'SET_USER_INFO'
|
||||
export const SET_SIGN_OUT = 'SET_SIGN_OUT'
|
||||
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
||||
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
||||
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
||||
|
||||
// 数据
|
||||
export const DATA_DEVICE = 'DATA_DEVICE'
|
||||
|
||||
Reference in New Issue
Block a user