Commit b90ea7f3 authored by 周远喜's avatar 周远喜

用户信息查看

parent 813aeee0
......@@ -33,6 +33,7 @@ export default {
},
mounted() {
this.getMenu();
this.initUserInfo();
},
watch: {
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
......@@ -77,19 +78,11 @@ export default {
res.result.avatarUrl != "" &&
res.result.avatarUrl != null
) {
this.userInfo.avatarUrl = res.result.avatarUrl;
this.$store.commit(
"setUserAvatar",
fileUrlDown + res.result.avatarUrl
);
} else {
this.userInfo.avatarUrl = "";
this.$store.commit("setUserAvatar", avatar);
res.result.avatarUrl = fileUrlDown + res.result.avatarUrl;
}
this.userName = res.result.userName;
localStorage.setItem("userName", this.userName);
this.$store.commit("admin/user/setUserAvatar", res.result);
} else {
this.$Message.error("查询失败!");
this.$Message.error("用户信息查询失败!");
}
});
},
......
......@@ -67,6 +67,7 @@ export default {
let that = this;
mgr.getUser().then(function(user) {
if (user) {
console.info("user",user)
that.msg = "该用户已经登录";
const userInfos = {
token: user.access_token,
......
......@@ -7,6 +7,12 @@ export const mutations={
},
setUser(state,info){
state.info=info;
},
setUserAvatar(state,user){
let info=state.info;
info.name=user.name;
info.avatar=user.avatarUrl;
state.info=info;
}
}
export const actions={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment