Sfoglia il codice sorgente

离线考试:提示是否覆盖原作答

Michael Wang 6 anni fa
parent
commit
7182d2afee
1 ha cambiato i file con 18 aggiunte e 10 eliminazioni
  1. 18 10
      src/features/OfflineExam/OfflineExamUpload.vue

+ 18 - 10
src/features/OfflineExam/OfflineExamUpload.vue

@@ -200,16 +200,24 @@ export default {
       });
     },
     handleBeforeUpload(file) {
-      if (file.type.includes("/pdf")) {
-        this.fileType = "pdf";
-      } else if (file.type.includes("/zip")) {
-        this.fileType = "zip";
-      }
-      this.file = file;
-      this.loadingStatus = true;
-      return new Promise((resolve, reject) =>
-        this.fileFormatCheck(file, resolve, reject)
-      );
+      return new Promise((resolve, reject) => {
+        this.$Modal.confirm({
+          title: "已有作答附件,是否覆盖?",
+          onCancel: () => reject(-1),
+          onOk: () => resolve()
+        });
+      }).then(() => {
+        if (file.type.includes("/pdf")) {
+          this.fileType = "pdf";
+        } else if (file.type.includes("/zip")) {
+          this.fileType = "zip";
+        }
+        this.file = file;
+        this.loadingStatus = true;
+        return new Promise((resolve, reject) =>
+          this.fileFormatCheck(file, resolve, reject)
+        );
+      });
     }
   }
 };