|
@@ -1,6 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
<Upload
|
|
<Upload
|
|
|
|
+ ref="uploadComp"
|
|
:headers="headers"
|
|
:headers="headers"
|
|
:data="{fileType: fileType}"
|
|
:data="{fileType: fileType}"
|
|
:before-upload="handleBeforeUpload"
|
|
:before-upload="handleBeforeUpload"
|
|
@@ -83,10 +84,32 @@ export default {
|
|
hex: hex
|
|
hex: hex
|
|
});
|
|
});
|
|
|
|
|
|
- if (
|
|
|
|
- ["application/zip", "application/pdf"].includes(getMimetype(hex))
|
|
|
|
- ) {
|
|
|
|
- resolve();
|
|
|
|
|
|
+ if (["application/pdf"].includes(getMimetype(hex))) {
|
|
|
|
+ if (!file.name.endsWith(".pdf")) {
|
|
|
|
+ this.loadingStatus = false;
|
|
|
|
+ this.$Notice.warning({
|
|
|
|
+ title: "文件内容与文件的后缀不一致"
|
|
|
|
+ // desc: file.name + " 文件是pdf文档,但文件名后缀不是.pdf!"
|
|
|
|
+ });
|
|
|
|
+ this.file = null;
|
|
|
|
+ reject("文件内容与文件的后缀不一致,请确认文件是pdf文档!");
|
|
|
|
+ } else {
|
|
|
|
+ resolve();
|
|
|
|
+ }
|
|
|
|
+ } else if (["application/zip"].includes(getMimetype(hex))) {
|
|
|
|
+ if (!file.name.endsWith(".zip")) {
|
|
|
|
+ this.loadingStatus = false;
|
|
|
|
+ // this.$refs.uploadComp.fileList.splice(0);
|
|
|
|
+ // this.$refs.uploadComp.fileList = [];
|
|
|
|
+ this.$Notice.warning({
|
|
|
|
+ title: "文件内容与文件的后缀不一致"
|
|
|
|
+ // desc: file.name + " 文件是zip压缩包,但文件名后缀不是.zip!"
|
|
|
|
+ });
|
|
|
|
+ this.file = null;
|
|
|
|
+ reject("文件内容与文件的后缀不一致,请确认文件是zip压缩包!");
|
|
|
|
+ } else {
|
|
|
|
+ resolve();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
console.log("binary file type check: not zip or pdf");
|
|
console.log("binary file type check: not zip or pdf");
|
|
window._hmt.push([
|
|
window._hmt.push([
|
|
@@ -101,7 +124,7 @@ export default {
|
|
});
|
|
});
|
|
this.file = null;
|
|
this.file = null;
|
|
this.loadingStatus = false;
|
|
this.loadingStatus = false;
|
|
- reject();
|
|
|
|
|
|
+ reject("作答文件损坏");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|