Browse Source

添加图片再删除,相当于答案重置

Michael Wang 6 năm trước cách đây
mục cha
commit
0b48340a9d
1 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 9 3
      src/features/OnlineExam/Examing/TextQuestionView.vue

+ 9 - 3
src/features/OnlineExam/Examing/TextQuestionView.vue

@@ -315,9 +315,15 @@ export default {
         const pEle = ele.querySelectorAll(".photo-answers-block");
         if (pEle) [...pEle].forEach(v => v.remove());
         console.log(ele.innerHTML);
-        this.studentAnswer =
-          ele.innerHTML +
-          `<div class='photo-answers-block'>${imageStr.join("")}</div>`;
+
+        if (!this.studentAnswer && pSrcs.length === 0) {
+          // 完全为空则重置答案
+          this.studentAnswer = null;
+        } else {
+          this.studentAnswer =
+            ele.innerHTML +
+            `<div class='photo-answers-block'>${imageStr.join("")}</div>`;
+        }
       }
     }
   },