parent
6193ddd2d9
commit
6f4d5c8432
57 changed files with 97 additions and 96 deletions
@ -1,40 +1,39 @@ |
|||||||
import Setting from '@/setting' |
import Setting from '@/setting' |
||||||
import util from '@/libs/util' |
import util from '@/libs/util' |
||||||
import addRoutes from '@/libs/route/addRoutes' |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 用户信息 |
* 用户信息 |
||||||
* */ |
* */ |
||||||
export default { |
export default { |
||||||
namespaced: true, |
namespaced: true, |
||||||
state: { |
state: { |
||||||
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", |
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", |
||||||
userId: '', |
userId: '', |
||||||
userName: '', |
userName: '', |
||||||
crumbs: '' |
crumbs: '' |
||||||
|
}, |
||||||
|
mutations: { |
||||||
|
setAvatar: (state, avatar) => { |
||||||
|
state.avatar = avatar |
||||||
}, |
}, |
||||||
mutations: { |
setUserId: (state, userId) => { |
||||||
setAvatar: (state, avatar) => { |
state.userId = userId |
||||||
state.avatar = avatar |
|
||||||
}, |
|
||||||
setUserId: (state, userId) => { |
|
||||||
state.userId = userId |
|
||||||
}, |
|
||||||
setUserName: (state, userName) => { |
|
||||||
state.userName = userName |
|
||||||
}, |
|
||||||
setCrumbs: (state, crumbs) => { |
|
||||||
state.crumbs = crumbs |
|
||||||
} |
|
||||||
}, |
}, |
||||||
actions: { |
setUserName: (state, userName) => { |
||||||
logout({ commit, state, dispatch }) { |
state.userName = userName |
||||||
return new Promise((resolve, reject) => { |
}, |
||||||
util.local.remove(Setting.storeKey) |
setCrumbs: (state, crumbs) => { |
||||||
util.local.remove(Setting.tokenKey) |
state.crumbs = crumbs |
||||||
location.reload() |
} |
||||||
resolve() |
}, |
||||||
}) |
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