Browse Source

个人中心

test
wangxy 3 years ago
parent
commit
eeee4a984a
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/views/personalCenter/userAvatar.vue

+ 10
- 1
src/views/personalCenter/userAvatar.vue View File

@ -62,7 +62,7 @@
</template>
<script>
import { put } from '@/server/api.js';
import { get, put } from '@/server/api.js';
import VuePictureCropper, { cropper } from 'vue-picture-cropper'
export default {
@ -89,6 +89,14 @@ export default {
this.options.img = this.picHeader + '/' + JSON.parse(localStorage.getItem("userInfo")).avatar
},
methods: {
//
updateHeadPic() {
get('/user/getuserinfo').then(({code, data})=>{
if( code==200 && data ){
localStorage.userInfo=JSON.stringify(data)
}
})
},
reset() {
cropper.reset();
},
@ -127,6 +135,7 @@ export default {
if (res.code === 200) {
this.open = false
this.options.img = `${this.picHeader}/${res.data}`
this.updateHeadPic()
this.msgSuccess('修改成功')
} else {
this.msgError(res.msg)


Loading…
Cancel
Save