parent
6193ddd2d9
commit
6f4d5c8432
57 changed files with 97 additions and 96 deletions
@ -1,40 +1,39 @@ |
||||
import Setting from '@/setting' |
||||
import util from '@/libs/util' |
||||
import addRoutes from '@/libs/route/addRoutes' |
||||
|
||||
/** |
||||
* 用户信息 |
||||
* */ |
||||
export default { |
||||
namespaced: true, |
||||
state: { |
||||
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", |
||||
userId: '', |
||||
userName: '', |
||||
crumbs: '' |
||||
namespaced: true, |
||||
state: { |
||||
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", |
||||
userId: '', |
||||
userName: '', |
||||
crumbs: '' |
||||
}, |
||||
mutations: { |
||||
setAvatar: (state, avatar) => { |
||||
state.avatar = avatar |
||||
}, |
||||
mutations: { |
||||
setAvatar: (state, 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() |
||||
}) |
||||
} |
||||
} |
||||
}; |
Loading…
Reference in new issue