|
|
|
@ -10,10 +10,13 @@ import addRoutes from "@/libs/route/addRoutes"; |
|
|
|
|
export default { |
|
|
|
|
namespaced: true, |
|
|
|
|
state: { |
|
|
|
|
customer: false, // true:为客户,没有个人中心
|
|
|
|
|
customerName: "", // 客户名称
|
|
|
|
|
title: "", |
|
|
|
|
logoUrl: "", |
|
|
|
|
avatar: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", |
|
|
|
|
userId: 3, |
|
|
|
|
userName: "", |
|
|
|
|
schoolId: "", |
|
|
|
|
roleId: "", |
|
|
|
|
dataTime: "" |
|
|
|
|
}, |
|
|
|
@ -21,11 +24,22 @@ export default { |
|
|
|
|
SET_INFO: (state, info) => { |
|
|
|
|
if (info.avatar) state.avatar = info.userAvatars; |
|
|
|
|
state.userId = info.userId; |
|
|
|
|
state.schoolId = info.schoolId; |
|
|
|
|
state.userName = info.userName; |
|
|
|
|
state.roleId = info.roleId; |
|
|
|
|
state.dataTime = info.dataTime; |
|
|
|
|
}, |
|
|
|
|
SET_CUSTOMER: (state, customer) => { |
|
|
|
|
state.customer = customer; |
|
|
|
|
}, |
|
|
|
|
SET_CUSTOMER_NAME: (state, customerName) => { |
|
|
|
|
state.customerName = customerName; |
|
|
|
|
}, |
|
|
|
|
SET_TITLE: (state, title) => { |
|
|
|
|
state.title = title; |
|
|
|
|
}, |
|
|
|
|
SET_LOGO_URL: (state, logoUrl) => { |
|
|
|
|
state.logoUrl = logoUrl; |
|
|
|
|
}, |
|
|
|
|
SET_AVATAR: (state, avatar) => { |
|
|
|
|
state.avatar = avatar; |
|
|
|
|
}, |
|
|
|
@ -46,6 +60,8 @@ export default { |
|
|
|
|
// res.message.listValue && Setting.dynamicRoute && addRoutes(res.message.listValue)
|
|
|
|
|
// 2021-10-13重做权限,因权限系统封装
|
|
|
|
|
util.local.set(Setting.tokenKey, data.token, Setting.tokenExpires); |
|
|
|
|
commit("SET_CUSTOMER", data.customer); |
|
|
|
|
commit("SET_CUSTOMER_NAME", data.customerName); |
|
|
|
|
util.successMsg("登录成功"); |
|
|
|
|
console.log(data, "登录保存的数据"); |
|
|
|
|
commit("SET_INFO", data); |
|
|
|
@ -67,12 +83,18 @@ export default { |
|
|
|
|
resolve(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
setAvatar({ state, commit }, avatar) { |
|
|
|
|
commit("SET_AVATAR", avatar); |
|
|
|
|
}, |
|
|
|
|
setInfo({ state, commit }, info) { |
|
|
|
|
commit("SET_INFO", info); |
|
|
|
|
}, |
|
|
|
|
setTitle({ state, commit }, title) { |
|
|
|
|
commit("SET_TITLE", title); |
|
|
|
|
}, |
|
|
|
|
setLogoUrl({ state, commit }, logoUrl) { |
|
|
|
|
commit("SET_LOGO_URL", logoUrl); |
|
|
|
|
}, |
|
|
|
|
setAvatar({ state, commit }, avatar) { |
|
|
|
|
commit("SET_AVATAR", avatar); |
|
|
|
|
}, |
|
|
|
|
setUserName({ state, commit }, userName) { |
|
|
|
|
commit("SET_USERNAME", userName); |
|
|
|
|
} |
|
|
|
|