|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-circle img-lg" />
|
|
|
|
|
|
|
+ <img v-bind:src="user.avatar" @click="editCropper()" title="点击上传头像" class="img-circle img-lg" />
|
|
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
|
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :xs="24" :md="12" :style="{height: '350px'}">
|
|
<el-col :xs="24" :md="12" :style="{height: '350px'}">
|
|
@@ -61,6 +61,7 @@ export default {
|
|
|
components: { VueCropper },
|
|
components: { VueCropper },
|
|
|
props: {
|
|
props: {
|
|
|
user: {
|
|
user: {
|
|
|
|
|
+ avatar: Object,
|
|
|
type: Object
|
|
type: Object
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -127,7 +128,8 @@ export default {
|
|
|
uploadAvatar(formData).then(response => {
|
|
uploadAvatar(formData).then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
- this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
|
|
|
|
|
|
|
+ this.options.img = response.imgUrl;
|
|
|
|
|
+ this.user.avatar = response.imgUrl;
|
|
|
store.commit('SET_AVATAR', this.options.img);
|
|
store.commit('SET_AVATAR', this.options.img);
|
|
|
this.msgSuccess("修改成功");
|
|
this.msgSuccess("修改成功");
|
|
|
}
|
|
}
|
|
@@ -141,4 +143,4 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
-</script>
|
|
|
|
|
|
|
+</script>
|