|
|
|
@ -6,35 +6,35 @@ import addRoutes from '@/libs/route/addRoutes' |
|
|
|
|
* 用户信息 |
|
|
|
|
* */ |
|
|
|
|
export default { |
|
|
|
|
namespaced: true, |
|
|
|
|
state: { |
|
|
|
|
avatar: 'https://new.iasf.ac.cn/images/avatar.png', |
|
|
|
|
userId: '', |
|
|
|
|
userName: '', |
|
|
|
|
crumbs: '' |
|
|
|
|
namespaced: true, |
|
|
|
|
state: { |
|
|
|
|
avatar: 'https://www.iasf.ac.cn/images/avatar.png', |
|
|
|
|
userId: '', |
|
|
|
|
userName: '', |
|
|
|
|
crumbs: '' |
|
|
|
|
}, |
|
|
|
|
mutations: { |
|
|
|
|
setAvatar: (state, avatar) => { |
|
|
|
|
if (avatar) state.avatar = avatar |
|
|
|
|
}, |
|
|
|
|
mutations: { |
|
|
|
|
setAvatar: (state, avatar) => { |
|
|
|
|
if (avatar) state.avatar = avatar |
|
|
|
|
}, |
|
|
|
|
setUserId: (state, userId) => { |
|
|
|
|
state.userId = userId |
|
|
|
|
}, |
|
|
|
|
setUserName: (state, userName) => { |
|
|
|
|
state.userName = userName |
|
|
|
|
}, |
|
|
|
|
setCrumbs: (state, crumbs) => { |
|
|
|
|
state.crumbs = crumbs |
|
|
|
|
} |
|
|
|
|
setUserId: (state, userId) => { |
|
|
|
|
state.userId = userId |
|
|
|
|
}, |
|
|
|
|
actions: { |
|
|
|
|
logout({ commit, state, dispatch }) { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
util.local.remove(Setting.storeKey) |
|
|
|
|
util.local.remove(Setting.tokenKey) |
|
|
|
|
location.reload() |
|
|
|
|
resolve() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
setUserName: (state, userName) => { |
|
|
|
|
state.userName = userName |
|
|
|
|
}, |
|
|
|
|
setCrumbs: (state, crumbs) => { |
|
|
|
|
state.crumbs = crumbs |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
actions: { |
|
|
|
|
logout ({ commit, state, dispatch }) { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
util.local.remove(Setting.storeKey) |
|
|
|
|
util.local.remove(Setting.tokenKey) |
|
|
|
|
location.reload() |
|
|
|
|
resolve() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |