update 优化多文件 多图片上传

2.X
疯狂的狮子li 3 years ago
parent 3f682fc80c
commit bc72868fc5

@ -151,6 +151,7 @@ export default {
}, },
// //
handleUploadSuccess(res) { handleUploadSuccess(res) {
if (res.code === 200) {
this.uploadList.push({ name: res.data.fileName, url: res.data.url }); this.uploadList.push({ name: res.data.fileName, url: res.data.url });
if (this.uploadList.length === this.number) { if (this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList); this.fileList = this.fileList.concat(this.uploadList);
@ -159,6 +160,10 @@ export default {
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading(); this.$modal.closeLoading();
} }
} else {
this.$modal.msgError(res.msg);
this.$modal.closeLoading();
}
}, },
// //
handleDelete(index) { handleDelete(index) {

@ -122,6 +122,7 @@ export default {
}, },
// //
handleUploadSuccess(res) { handleUploadSuccess(res) {
if (res.code == 200) {
this.uploadList.push({ name: res.data.fileName, url: res.data.url }); this.uploadList.push({ name: res.data.fileName, url: res.data.url });
if (this.uploadList.length === this.number) { if (this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList); this.fileList = this.fileList.concat(this.uploadList);
@ -130,6 +131,10 @@ export default {
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading(); this.$modal.closeLoading();
} }
} else {
this.$modal.msgError(res.msg);
this.$modal.closeLoading();
}
}, },
// loading // loading
handleBeforeUpload(file) { handleBeforeUpload(file) {

Loading…
Cancel
Save