Procházet zdrojové kódy

修改问卷支持 RAR ZIP格式

1
mo před 3 roky
rodič
revize
a62229e0ed
1 změnil soubory, kde provedl 21 přidání a 7 odebrání
  1. 21 7
      src/views/setQuestions/components/answerList.vue

+ 21 - 7
src/views/setQuestions/components/answerList.vue

@@ -63,7 +63,7 @@
           :accept="
             questionList[currentIndex - 1]['type'] == 'image'
               ? '.jpg, .jpeg, .png'
-              : '.XLSX,.XLS,.DOCX,.PDF,.TXT,.PSD,.EPS'
+              : '.XLSX,.XLS,.DOCX,.PDF,.TXT,.PSD,.EPS,.RAR,.ZIP '
           "
           :before-upload="
             (flie) => {
@@ -96,7 +96,7 @@
             仅支持上传JPG、PNG、JPEG、GIF文件,且不超过5MB
           </div>
           <div slot="tip" v-else class="el-upload__tip">
-            仅支持上传XLSX、XLS、DOCX、PDF、TXT、PSD、EPS文件,且不超过5MB
+            仅支持上传XLSX、XLS、DOCX、PDF、TXT、PSD、EPS、RAR、ZIP文件,且不超过5MB
           </div>
         </el-upload>
       </el-card>
@@ -136,7 +136,7 @@
         @click="onSubmit"
         >提交</el-button
       >
-            <el-button
+      <el-button
         size="large"
         type="primary"
         v-if="questionList[currentIndex - 1]['type'] == 'image'"
@@ -148,7 +148,7 @@
         @click="onSubmit"
         >提交</el-button
       >
-            <el-button
+      <el-button
         size="large"
         type="primary"
         v-if="questionList[currentIndex - 1]['type'] == 'file'"
@@ -298,7 +298,7 @@ export default {
               })
             ),
           };
-         this.fileList = [];
+          this.fileList = [];
         } else if (selectList.type == "file") {
           this.checkList[this.currentIndex - 1] = {
             questionnaireQuestionId: selectList.id,
@@ -311,7 +311,7 @@ export default {
               })
             ),
           };
-         this.fileList = [];
+          this.fileList = [];
         }
 
         // 1 为终止答题
@@ -343,7 +343,17 @@ export default {
       // const isJPG = file.type === 'image/jpeg';
       const isLt2M = file.size / 1024 / 1024 < 5;
       const imgType = ["JPG", "PNG", "JPEG", "GIF"];
-        const testType = ["XLSX", "XLS", "DOCX", "PDF", "TXT","PSD","EPS"];
+      const testType = [
+        "XLSX",
+        "XLS",
+        "DOCX",
+        "PDF",
+        "TXT",
+        "PSD",
+        "EPS",
+        "RAR",
+        "ZIP",
+      ];
       const fileExtension = file.name.split(".").pop().toUpperCase();
       console.log(
         type,
@@ -382,6 +392,10 @@ export default {
     },
     handleUploadSuccess(response, file, list, question) {
       this.uploadLoading = false;
+      if (response.code != 200) {
+        this.$message.error(response.msg);
+        return;
+      }
       this.$message.success("上传附件成功");
       this.fileList = [...list];
       console.log(this.fileList);