|
@@ -274,10 +274,10 @@
|
|
|
style="width:580px;padding-left:80px;"
|
|
|
>
|
|
|
<el-upload
|
|
|
- class="upload-demo"
|
|
|
+ :class="{ disabled: uploadDisabled }"
|
|
|
ref="upload"
|
|
|
action
|
|
|
- :limit="6"
|
|
|
+ :limit="fileLimit"
|
|
|
:http-request="customUpload"
|
|
|
:before-upload="beforeFileUpload"
|
|
|
:on-success="handleSuccess"
|
|
@@ -356,7 +356,7 @@
|
|
|
<el-form-item label="作答结果">
|
|
|
<div style="width:580px;padding-left:80px;">
|
|
|
<el-upload
|
|
|
- class="upload-demo"
|
|
|
+ :class="{ disabled: true }"
|
|
|
action
|
|
|
:limit="6"
|
|
|
:file-list="imageAnswerFileList"
|
|
@@ -423,13 +423,12 @@ export default {
|
|
|
total: 0,
|
|
|
tableLoading: false,
|
|
|
showAllCondition: false,
|
|
|
- currentOfflineFiles: [],
|
|
|
fileType: "zip",
|
|
|
accept: "application/zip",
|
|
|
fileList: [],
|
|
|
- offlineFiles: [],
|
|
|
downloadImageDialogVisible: false,
|
|
|
imageAnswerFileList: [],
|
|
|
+ fileLimit: 6,
|
|
|
form: {
|
|
|
examRecordDataId: null,
|
|
|
hasStranger: null,
|
|
@@ -473,7 +472,12 @@ export default {
|
|
|
computed: {
|
|
|
...mapState({ user: state => state.user }),
|
|
|
batchSubmitUploadDisabled() {
|
|
|
- return this.fileList.length != this.md5Size;
|
|
|
+ return this.fileList.length == 0 || this.fileList.length != this.md5Size;
|
|
|
+ },
|
|
|
+ //计算是否显示图片上传框
|
|
|
+ uploadDisabled() {
|
|
|
+ debugger;
|
|
|
+ return this.fileList.length >= this.fileLimit;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -482,6 +486,7 @@ export default {
|
|
|
this.removeImgs();
|
|
|
},
|
|
|
handleChange(file, fileList) {
|
|
|
+ debugger;
|
|
|
this.fileList = fileList;
|
|
|
this.calcSummary(this.fileList);
|
|
|
},
|
|
@@ -510,6 +515,7 @@ export default {
|
|
|
this.fileList.splice(index, 1);
|
|
|
this.calcSummary(this.fileList);
|
|
|
},
|
|
|
+
|
|
|
calcSummary(fileList) {
|
|
|
this.summaryList = [];
|
|
|
this.md5Size = 0;
|
|
@@ -530,6 +536,7 @@ export default {
|
|
|
console.log(file);
|
|
|
},
|
|
|
removeImgs() {
|
|
|
+ this.fileList = [];
|
|
|
this.$refs.upload.clearFiles();
|
|
|
},
|
|
|
resetForm() {
|
|
@@ -838,21 +845,6 @@ export default {
|
|
|
this.offlineAnswerFile = file;
|
|
|
});
|
|
|
|
|
|
- // function blobToArray(blob) {
|
|
|
- // return new Promise((resolve) => {
|
|
|
- // var reader = new FileReader();
|
|
|
- // reader.addEventListener("loadend", function() {
|
|
|
- // // reader.result contains the contents of blob as a typed array
|
|
|
- // resolve(reader.result);
|
|
|
- // });
|
|
|
- // reader.readAsArrayBuffer(blob);
|
|
|
- // });
|
|
|
- // }
|
|
|
- // const buffer = blobToArray(file);
|
|
|
- // const fileMd5 = MD5(buffer);
|
|
|
- // console.log(fileMd5);
|
|
|
- // this.summary = fileMd5;
|
|
|
-
|
|
|
this.uploadData = {
|
|
|
examRecordDataId: this.currentOfflineExamRecordDataId,
|
|
|
summary: this.summary
|
|
@@ -865,16 +857,6 @@ export default {
|
|
|
});
|
|
|
return promise; //通过返回一个promis对象解决
|
|
|
},
|
|
|
- blobToArray(blob) {
|
|
|
- return new Promise(resolve => {
|
|
|
- var reader = new FileReader();
|
|
|
- reader.addEventListener("loadend", function() {
|
|
|
- // reader.result contains the contents of blob as a typed array
|
|
|
- resolve(reader.result);
|
|
|
- });
|
|
|
- reader.readAsArrayBuffer(blob);
|
|
|
- });
|
|
|
- },
|
|
|
submitUpload() {
|
|
|
debugger;
|
|
|
this.uploadAnswerDialogLoading = true;
|
|
@@ -886,11 +868,6 @@ export default {
|
|
|
param.append("examRecordDataId", this.currentOfflineExamRecordDataId);
|
|
|
param.append("fileType", this.fileType);
|
|
|
|
|
|
- // const buffer = this.blobToArray(this.offlineAnswerFile);
|
|
|
- // const fileMd5 = MD5(buffer);
|
|
|
- // console.log(fileMd5);
|
|
|
- // this.summary = fileMd5;
|
|
|
- // param.append("summary", this.summary);
|
|
|
this.$http
|
|
|
.post("/api/ecs_oe_admin/offlineExam/submitPaper", param, config)
|
|
|
.then(() => {
|
|
@@ -1014,8 +991,7 @@ export default {
|
|
|
this.$message.success("上传成功");
|
|
|
},
|
|
|
customUpload(file) {
|
|
|
- debugger;
|
|
|
- this.offlineFiles.push(file.file);
|
|
|
+ console.log(file);
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
@@ -1026,5 +1002,8 @@ export default {
|
|
|
.offline_file {
|
|
|
color: blue;
|
|
|
}
|
|
|
+.disabled .el-upload--picture-card {
|
|
|
+ display: none !important;
|
|
|
+}
|
|
|
</style>
|
|
|
<style scoped src="../style/common.css"></style>
|