上传头像

dev
yujialong 3 years ago
parent 9692dce543
commit 4084a5870a
  1. 5
      src/components/Header.vue
  2. 2
      src/views/setting/Person.vue

@ -6,7 +6,7 @@
<div class="header-right"> <div class="header-right">
<div class="header-user-con"> <div class="header-user-con">
<div class="user" @click="toPerson"> <div class="user" @click="toPerson">
<el-avatar :size="40" :src="avatar"></el-avatar> <el-avatar :size="40" :src="$store.state.avatar"></el-avatar>
<span class="user-avator">{{userName}}</span> <span class="user-avator">{{userName}}</span>
</div> </div>
<el-divider class="ml20" direction="vertical"></el-divider> <el-divider class="ml20" direction="vertical"></el-divider>
@ -19,7 +19,6 @@
export default { export default {
data() { data() {
return { return {
avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
userName: '' userName: ''
}; };
}, },
@ -30,7 +29,7 @@ export default {
getUserInfo(){ getUserInfo(){
this.$get(this.api.queryUserInfoDetails).then(res => { this.$get(this.api.queryUserInfoDetails).then(res => {
let userInfo = res.result.hrUserInfo let userInfo = res.result.hrUserInfo
if(userInfo.userAvatars) this.avatar = userInfo.userAvatars if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars})
this.userName = userInfo.userName this.userName = userInfo.userName
}).catch(err => {}) }).catch(err => {})
}, },

@ -567,7 +567,7 @@ export default {
// //
getRes(res) { getRes(res) {
this.avatar = res.message this.avatar = res.message
this.$store.commit('userPhoto',{avatar:res.message}) this.$store.commit('userAvatar',{avatar:res.message})
}, },
getdata() { getdata() {
this.$get(this.api.queryUserInfoDetails).then(res => { this.$get(this.api.queryUserInfoDetails).then(res => {

Loading…
Cancel
Save