natasha 1 месяц назад
Родитель
Сommit
e4a6fb571d

+ 10 - 0
src/views/book/courseware/preview/common/SoundRecord.vue

@@ -447,6 +447,16 @@ export default {
         }
       }
     },
+    // 重置状态
+    handleReset() {
+      this.hasMicro = '';
+      this.recordtime = 0;
+      window.stopAudioSound = () => {
+        if (this.audio) {
+          this.audio.pause();
+        }
+      };
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/character/CharacterPreview.vue

@@ -398,7 +398,7 @@
           </div>
         </div>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -584,6 +584,10 @@ export default {
       this.writer.updateColor('strokeColor', color);
       this.writer.updateColor('drawingColor', color);
     },
+    // 重做
+    retry() {
+      this.handleData();
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/character_structure/CharacterStructurePreview.vue

@@ -152,7 +152,7 @@
           </div>
         </div>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -386,6 +386,10 @@ export default {
 
       return classname;
     },
+    // 重做
+    retry() {
+      this.handleData([]);
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/image_text/ImageTextPreview.vue

@@ -58,7 +58,7 @@
         />
       </div>
     </div>
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -281,6 +281,10 @@ export default {
       if (theme !== '') this.sentenceTheme = theme;
       if (size) this.fontSize = size;
     },
+    // 重做
+    retry() {
+      this.initData();
+    },
   },
 };
 </script>

+ 18 - 1
src/views/book/courseware/preview/components/newWord_template/NewWordTemplatePreview.vue

@@ -56,6 +56,7 @@
                     : '#deebff',
               }"
               @input="changeAnswer(item, index)"
+              ref="editDiv"
             />
           </div>
           <div class="items-flex">
@@ -101,6 +102,7 @@
                         ? data.unified_attrib.assist_color
                         : '#deebff',
                   }"
+                  ref="editDiv"
                   @input="changeAnswer(item, index, indexs)"
                 />
               </div>
@@ -181,6 +183,7 @@
                         ? data.unified_attrib.assist_color
                         : '#deebff',
                   }"
+                  ref="editDiv"
                   @input="changeAnswer(items, index, indexs)"
                 />
               </div>
@@ -201,6 +204,7 @@
                     ? data.unified_attrib.assist_color
                     : '#deebff',
               }"
+              ref="editDiv"
               @input="changeAnswer(item, index)"
             />
           </div>
@@ -208,7 +212,7 @@
         </div>
       </div>
     </div>
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -540,6 +544,19 @@ export default {
 
       return classname;
     },
+    // 重做
+    retry() {
+      this.handleData();
+      if (this.$refs.editDiv) {
+        if (this.$refs.editDiv.length > 0) {
+          this.$refs.editDiv.forEach((item) => {
+            item.handleReset();
+          });
+        } else {
+          this.$refs.editDiv.handleReset();
+        }
+      }
+    },
   },
 };
 </script>

+ 3 - 0
src/views/book/courseware/preview/components/newWord_template/components/EditDiv.vue

@@ -279,6 +279,9 @@ export default {
       e.target.innerHTML = e.target.innerHTML.replace(/&nbsp;/gi, '').trim();
       this.$emit('input', e.target.innerHTML);
     },
+    handleReset() {
+      document.getElementById(this.id).innerHTML = '';
+    },
   },
 };
 </script>

+ 8 - 1
src/views/book/courseware/preview/components/pinyin_base/PinyinBasePreview.vue

@@ -150,7 +150,7 @@
           />
         </template>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -660,6 +660,13 @@ export default {
         .join(' ');
       item.con = answer;
     },
+    // 重做
+    retry() {
+      this.handleData();
+      if (this.data.property.fun_type !== 'mark' && this.isEnable(this.data.property.is_enable_voice_answer)) {
+        this.$refs.record.handleReset();
+      }
+    },
   },
 };
 </script>

+ 7 - 1
src/views/book/courseware/preview/components/record_input/RecordInputPreview.vue

@@ -27,7 +27,7 @@
           @handleWav="handleWav"
         />
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -84,6 +84,12 @@ export default {
     handleWav(data) {
       this.data.answer.answer_list.answer_record_list = data;
     },
+    // 重做
+    retry() {
+      this.data.answer.answer_list.input = '';
+      this.data.answer.answer_list.answer_record_list = [];
+      this.$refs.record.handleReset();
+    },
   },
 };
 </script>

+ 11 - 0
src/views/book/courseware/preview/components/record_input/SoundRecord.vue

@@ -377,6 +377,17 @@ export default {
         }
       }
     },
+    // 重置状态
+    handleReset() {
+      this.hasMicro = '';
+
+      this.recordtime = 0;
+      window.stopAudioSound = () => {
+        if (this.audio) {
+          this.audio.pause();
+        }
+      };
+    },
   },
 };
 </script>

+ 23 - 1
src/views/book/courseware/preview/components/table/TablePreview.vue

@@ -222,7 +222,7 @@
           </tr>
         </table>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -666,6 +666,28 @@ export default {
       }
       return {};
     },
+    // 重做
+    retry() {
+      this.data.option_list.forEach((item) => {
+        item.forEach((items) => {
+          items.model_essay.forEach((li) => {
+            if (li.type === 'input') {
+              li.value = '';
+              li.write_base64 = '';
+            }
+          });
+        });
+      });
+      if (this.$refs.record) {
+        if (this.$refs.record.length > 0) {
+          this.$refs.record.forEach((item) => {
+            item.handleReset();
+          });
+        } else {
+          this.$refs.record.handleReset();
+        }
+      }
+    },
   },
 };
 </script>

+ 0 - 1
src/views/book/courseware/preview/components/video_interaction/VideoInteractionPreview.vue

@@ -25,7 +25,6 @@
       @click="lookReport"
       >{{ convertText('查看答题报告') }}</el-button
     >
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"