|
|
@ -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) |
|
|
|