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