|
@@ -12,6 +12,7 @@
|
|
|
:on-success="handleAvatarSuccess"
|
|
|
:on-error="handleError"
|
|
|
:on-progress="onProgress"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
:disabled="limit <= value.length"
|
|
|
>
|
|
|
<i slot="default" class="el-icon-plus" />
|
|
@@ -86,7 +87,9 @@ export default {
|
|
|
token: getToken()
|
|
|
},
|
|
|
imgList: this.value,
|
|
|
- tmp: []
|
|
|
+ tmp: [],
|
|
|
+
|
|
|
+ loading: null
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -125,6 +128,7 @@ export default {
|
|
|
handleError() {
|
|
|
this.mark = false;
|
|
|
this.$error('上传失败,请稍后重试...');
|
|
|
+ this.loading.close();
|
|
|
},
|
|
|
handleAvatarSuccess(res, file, fileList) {
|
|
|
if (file.response.code !== 200) {
|
|
@@ -143,7 +147,9 @@ export default {
|
|
|
: [];
|
|
|
this.$nextTick(() => {
|
|
|
this.$emit('input', result);
|
|
|
+ this.$message.success('上传成功');
|
|
|
this.mark = false;
|
|
|
+ this.loading.close();
|
|
|
});
|
|
|
},
|
|
|
// handleChange(file, fileList) {
|
|
@@ -168,6 +174,14 @@ export default {
|
|
|
handlePictureCardPreview(file) {
|
|
|
this.dialogImageUrl = file.url;
|
|
|
this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ handleBeforeUpload() {
|
|
|
+ this.loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|