|
|
@ -28,8 +28,8 @@
|
|
|
|
:action="ossUploadUrl"
|
|
|
|
:action="ossUploadUrl"
|
|
|
|
:data="uploadData"
|
|
|
|
:data="uploadData"
|
|
|
|
:show-file-list="false"
|
|
|
|
:show-file-list="false"
|
|
|
|
:on-success="handleAvatarSuccess"
|
|
|
|
:on-success="handleUploadSuccess"
|
|
|
|
:before-upload="handleBeforeLoad"
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-button>修改头像</el-button>
|
|
|
|
<el-button>修改头像</el-button>
|
|
|
|
</el-upload>
|
|
|
|
</el-upload>
|
|
|
@ -90,7 +90,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.initData();
|
|
|
|
this.initData();
|
|
|
|
this.getOssUrl();
|
|
|
|
this.getOssConfig();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
initData() {
|
|
|
|
initData() {
|
|
|
@ -103,7 +103,7 @@ export default {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getOssUrl() {
|
|
|
|
async getOssConfig() {
|
|
|
|
const { result } = await ApiPostGetOssConfig({
|
|
|
|
const { result } = await ApiPostGetOssConfig({
|
|
|
|
configId: "account-avatar/",
|
|
|
|
configId: "account-avatar/",
|
|
|
|
serviceName: "uc",
|
|
|
|
serviceName: "uc",
|
|
|
@ -122,14 +122,14 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 获取文件名
|
|
|
|
// 获取文件名
|
|
|
|
handleBeforeLoad(file) {
|
|
|
|
handleBeforeUpload(file) {
|
|
|
|
this.fileName = file.name;
|
|
|
|
this.fileName = file.name;
|
|
|
|
Object.assign(this.uploadData, {
|
|
|
|
Object.assign(this.uploadData, {
|
|
|
|
key: `${this.ossDirName}${"${filename}"}`,
|
|
|
|
key: `${this.ossDirName}${"${filename}"}`,
|
|
|
|
name: file.name,
|
|
|
|
name: file.name,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handleAvatarSuccess() {
|
|
|
|
handleUploadSuccess() {
|
|
|
|
this.form.avatar = `${this.ossUploadUrl}/${this.ossDirName}${this.fileName}`;
|
|
|
|
this.form.avatar = `${this.ossUploadUrl}/${this.ossDirName}${this.fileName}`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSubmit() {
|
|
|
|
onSubmit() {
|
|
|
|