Эх сурвалжийг харах

修复照片附件上传逻辑

Michael Wang 6 жил өмнө
parent
commit
1d3bd60f57

+ 5 - 1
src/features/OnlineExam/Examing/TextQuestionView.vue

@@ -98,7 +98,6 @@
         </div>
       </div>
 
-      <!-- FIXME -->
       <div v-if="canAttachPhotos">
         <UploadPhotos
           :defaultList="
@@ -305,6 +304,7 @@ export default {
     canAttachPhotos() {
       return (
         this.$store.state.user.schoolDomain === "csu.ecs.qmth.com.cn" ||
+        this.$store.state.user.schoolDomain === "ecs-dev.qmth.com.cn" ||
         (this.$store.state.user.schoolDomain === "iepcc-ps.ecs.qmth.com.cn" &&
           !this.isAudioAnswerType)
       );
@@ -333,10 +333,14 @@ export default {
         if (!ele.innerHTML && pSrcs.length === 0) {
           // 完全为空则重置答案
           this.studentAnswer = null;
+          // 更新answerDiv的内容
+          this.originalStudentAnswer = null;
         } else {
           this.studentAnswer =
             ele.innerHTML +
             `<div class='photo-answers-block'>${imageStr.join("")}</div>`;
+          // 更新answerDiv的内容
+          this.originalStudentAnswer = this.studentAnswer;
         }
       },
     },

+ 24 - 1
src/features/OnlineExam/Examing/UploadPhotos.vue

@@ -26,7 +26,10 @@
     </div>
     <Upload
       ref="upload"
-      v-show="this.uploadList.length < 6"
+      v-show="
+        this.uploadList.length < 6 &&
+          !(this.uploadList.filter(v => v.status === 'uploading').length > 0)
+      "
       :accept="this.format.map(v => 'image/' + v).join()"
       :data="headers"
       :show-upload-list="false"
@@ -237,6 +240,26 @@ export default {
   mounted() {
     this.uploadList = this.$refs.upload.fileList;
   },
+  watch: {
+    uploadList: {
+      handler: function update() {
+        // 禁止同时上传附件
+        // for (const t of this.uploadList) {
+        //   console.log(t.status);
+        // }
+        if (this.uploadList.filter(v => v.status === "uploading").length > 0) {
+          this.$nextTick(() => {
+            this.$Spin.show({});
+          });
+        } else {
+          this.$nextTick(() => {
+            this.$Spin.hide();
+          });
+        }
+      },
+      deep: true,
+    },
+  },
 };
 </script>
 <style scoped>