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