Kaynağa Gözat

组件重做方法

dsy 1 gün önce
ebeveyn
işleme
3131431ef9
20 değiştirilmiş dosya ile 136 ekleme ve 29 silme
  1. 0 4
      src/courseware_preview/index.vue
  2. 5 1
      src/views/book/courseware/preview/components/character/CharacterPreview.vue
  3. 5 1
      src/views/book/courseware/preview/components/character_structure/CharacterStructurePreview.vue
  4. 1 3
      src/views/book/courseware/preview/components/common/PreviewMixin.js
  5. 1 5
      src/views/book/courseware/preview/components/fill/FillPreview.vue
  6. 5 1
      src/views/book/courseware/preview/components/image_text/ImageTextPreview.vue
  7. 4 1
      src/views/book/courseware/preview/components/input/InputPreview.vue
  8. 4 1
      src/views/book/courseware/preview/components/judge/JudgePreview.vue
  9. 5 3
      src/views/book/courseware/preview/components/label/LabelPreview.vue
  10. 10 1
      src/views/book/courseware/preview/components/matching/MatchingPreview.vue
  11. 18 1
      src/views/book/courseware/preview/components/newWord_template/NewWordTemplatePreview.vue
  12. 3 0
      src/views/book/courseware/preview/components/newWord_template/components/EditDiv.vue
  13. 8 1
      src/views/book/courseware/preview/components/pinyin_base/PinyinBasePreview.vue
  14. 7 1
      src/views/book/courseware/preview/components/record_input/RecordInputPreview.vue
  15. 11 0
      src/views/book/courseware/preview/components/record_input/SoundRecord.vue
  16. 5 1
      src/views/book/courseware/preview/components/select/SelectPreview.vue
  17. 10 1
      src/views/book/courseware/preview/components/sort/SortPreview.vue
  18. 23 1
      src/views/book/courseware/preview/components/table/TablePreview.vue
  19. 0 1
      src/views/book/courseware/preview/components/video_interaction/VideoInteractionPreview.vue
  20. 11 1
      src/views/book/courseware/preview/components/voice_matrix/VoiceMatrixPreview.vue

+ 0 - 4
src/courseware_preview/index.vue

@@ -96,8 +96,6 @@
 import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview.vue';
 import { isTrue } from '@/utils/validate';
 import MindMap from '@/components/MindMap.vue';
-import VideoPlay from '@/views/book/courseware/preview/components/common/VideoPlay.vue';
-import AudioPlay from '@/views/book/courseware/preview/components/common/AudioPlay.vue';
 import ExplanatoryNoteDialog from '@/components/ExplanatoryNoteDialog.vue';
 import VisNetwork from '@/components/VisNetwork.vue';
 import * as OpenCC from 'opencc-js';
@@ -129,8 +127,6 @@ export default {
   components: {
     CoursewarePreview,
     MindMap,
-    VideoPlay,
-    AudioPlay,
     ExplanatoryNoteDialog,
     VisNetwork,
   },

+ 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>

+ 1 - 3
src/views/book/courseware/preview/components/common/PreviewMixin.js

@@ -140,9 +140,7 @@ const mixin = {
       this.isJudgingRightWrong = isJudgingRightWrong;
       this.isShowRightAnswer = isShowRightAnswer;
       this.disabled = disabled;
-      if (userAnswer) {
-        this.answer = userAnswer;
-      }
+      if (userAnswer) this.answer = userAnswer;
     },
     /**
      * 获取批改信息

+ 1 - 5
src/views/book/courseware/preview/components/fill/FillPreview.vue

@@ -103,11 +103,7 @@
 
     <WriteDialog :visible.sync="writeVisible" @confirm="handleWriteConfirm" />
     <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
-    <AnswerCorrect
-      :answer-correct="data?.answer_correct"
-      :visible.sync="visibleAnswerCorrect"
-      @closeAnswerCorrect="closeAnswerCorrect"
-    />
+    <AnswerCorrect :visible.sync="visibleAnswerCorrect" @closeAnswerCorrect="closeAnswerCorrect" />
     <AnswerAnalysis
       :visible.sync="visibleAnswerAnalysis"
       :answer-list="data.answer_list"

+ 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>

+ 4 - 1
src/views/book/courseware/preview/components/input/InputPreview.vue

@@ -28,7 +28,7 @@
       </div>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -106,6 +106,9 @@ export default {
         gridTemplateAreas: this.showLang ? "'rich input' 'lang lang'" : "'rich input'",
       };
     },
+    retry() {
+      this.data.answer.text = '';
+    },
   },
 };
 </script>

+ 4 - 1
src/views/book/courseware/preview/components/judge/JudgePreview.vue

@@ -56,7 +56,7 @@
       </ul>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -211,6 +211,9 @@ export default {
       }
       return isCorrectType && !(selectOption.option_type === option_type) ? 'answer-right' : '';
     },
+    retry() {
+      this.answer.answer_list = [];
+    },
   },
 };
 </script>

+ 5 - 3
src/views/book/courseware/preview/components/label/LabelPreview.vue

@@ -4,11 +4,13 @@
     <div class="main">
       <el-tag v-for="(tag, i) in data.dynamicTags" :key="i" size="medium" :style="{ color: tag.color }">
         <span v-if="'ZH' == getLang()">
-          {{ tag.name }}
+          {{ convertText(tag.name) }}
         </span>
         <span v-else style="display: flex; flex-direction: column; line-height: 20px">
-          <span>{{ tag.name }}</span>
-          <span style="color: black">{{ tag.mult_language_list?.find((item) => item.type === getLang())?.name }}</span>
+          <span>{{ convertText(tag.name) }}</span>
+          <span style="color: black">
+            {{ convertText(tag?.mult_language_list?.find((item) => item.type === getLang())?.name || '') }}</span
+          >
         </span>
       </el-tag>
     </div>

+ 10 - 1
src/views/book/courseware/preview/components/matching/MatchingPreview.vue

@@ -36,7 +36,7 @@
       </ul>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -514,6 +514,15 @@ export default {
 
       return isRight ? 'right' : 'wrong';
     },
+    retry() {
+      this.clearLine();
+      this.$set(
+        this,
+        'answerList',
+        this.answerList.map((item) => item.map(({ mark }) => ({ mark, preMark: [], nextMark: [] }))),
+      );
+      this.$set(this, 'answer', { answer_list: [], is_right: false });
+    },
   },
 };
 </script>

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

@@ -43,6 +43,7 @@
           >
             <EditDiv
               :id="'b' + item.content + index"
+              ref="editDiv"
               v-model="userAnswer[index].answer_pinyin"
               :can-edit="!item.is_example && !disabled"
               :text-align="'center'"
@@ -87,6 +88,7 @@
               >
                 <EditDiv
                   :id="'c' + items.con + index + indexs"
+                  ref="editDiv"
                   v-model="userAnswer[index].item[indexs].answer_pinyin"
                   :can-edit="!items.is_example && !disabled"
                   :text-align="'center'"
@@ -169,6 +171,7 @@
                 <EditDiv
                   v-if="items && items.type === 'hanzi' && items.is_can_input_answer"
                   :id="'a' + items.con + index + indexs"
+                  ref="editDiv"
                   v-model="userAnswer[index].item[indexs].answer"
                   :can-edit="!items.is_example && !disabled"
                   :text-align="'center'"
@@ -189,6 +192,7 @@
           <div v-if="data.answer_type.indexOf('en') > -1 && data.property.model === 'input'" class="inputdv en-common">
             <EditDiv
               :id="'d' + item.content + index"
+              ref="editDiv"
               v-model="userAnswer[index].answer_en"
               :can-edit="!item.is_example && !disabled"
               :text-align="'center'"
@@ -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>

+ 5 - 1
src/views/book/courseware/preview/components/select/SelectPreview.vue

@@ -39,7 +39,7 @@
       </ul>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -174,6 +174,10 @@ export default {
       }
       return answerClass;
     },
+
+    retry() {
+      this.answer.answer_list = [];
+    },
   },
 };
 </script>

+ 10 - 1
src/views/book/courseware/preview/components/sort/SortPreview.vue

@@ -41,7 +41,7 @@
       </ul>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -195,6 +195,15 @@ export default {
       this.clickIndexList = [];
       this.answer.answer_list = this.move_list.map(({ mark }) => mark);
     },
+    retry() {
+      const optionList = structuredClone(this.data.option_list);
+      this.move_list =
+        this.data.property.order_type === orderTypeList[0].value
+          ? optionList
+          : optionList.sort(() => Math.random() - 0.5);
+      this.answer.answer_list = [];
+      this.is_all_right = false;
+    },
   },
 };
 </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"

+ 11 - 1
src/views/book/courseware/preview/components/voice_matrix/VoiceMatrixPreview.vue

@@ -209,7 +209,7 @@
       </div>
     </div>
 
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -581,6 +581,16 @@ export default {
         });
       });
     },
+
+    retry() {
+      this.clearSelectCell();
+      this.selectedLine = { type: '', index: -1 };
+      this.handleParentPlay();
+      this.wavblob = null;
+      this.matrixSelectLrc = null;
+      this.data.record_list = [];
+      this.$refs.luyin?.handleReset();
+    },
   },
 };
 </script>