上传失败处理

main
mo 1 year ago
parent 1b083f322c
commit 44881935e3

@ -8,6 +8,7 @@
:file-list="fileList"
:on-change="onUploadChange"
:before-upload="beforeFileUpload"
:on-error="handleUploadError"
action="#"
:accept="imgType"
list-type="picture-card"
@ -161,12 +162,18 @@ export default {
let FormDatas = new FormData();
FormDatas.append("multipartFile", file.raw);
this.$modal.loading("正在上传,请稍候...");
uploadBankSlipApi(FormDatas).then((res) => {
this.invoiceForm = res.data;
this.fileList.push({ name: file.name, url: res.data.fileUrl }); //
this.$emit("onConfirm", this.fileList);
this.$modal.closeLoading();
});
uploadBankSlipApi(FormDatas)
.then((res) => {
this.invoiceForm = res.data;
this.fileList.push({ name: file.name, url: res.data.fileUrl }); //
this.$emit("onConfirm", this.fileList);
this.$modal.closeLoading();
})
.catch(() => {
this.fileList = [];
this.$modal.closeLoading();
this.$message.error("上传失败");
});
},
closeImgViewer() {
this.dialogVisible = false;
@ -181,6 +188,10 @@ export default {
this.dialogVisible = true;
}
},
handleUploadError() {
this.$modal.closeLoading();
this.$message.error("上传失败");
},
//
handleScan() {
if (this.fileList.length) {

@ -164,12 +164,17 @@ export default {
let FormDatas = new FormData();
FormDatas.append("multipartFile", file.raw);
this.$modal.loading("正在上传,请稍候...");
uploadInvoiceApi(FormDatas).then((res) => {
this.invoiceForm = res.data;
this.fileList.push({ name: file.name, url: res.data.fileUrl }); //
this.$emit("onConfirm", this.fileList);
this.$modal.closeLoading();
});
uploadInvoiceApi(FormDatas)
.then((res) => {
this.invoiceForm = res.data;
this.fileList.push({ name: file.name, url: res.data.fileUrl }); //
this.$emit("onConfirm", this.fileList);
this.$modal.closeLoading();
})
.catch(() => {
this.fileList = [];
this.$modal.closeLoading();
});
},
closeImgViewer() {
this.dialogVisible = false;

Loading…
Cancel
Save