Jelajahi Sumber

优化代码

dusenyao 1 tahun lalu
induk
melakukan
33b5fa8ebe

+ 1 - 0
src/views/book/courseware/data/fill.js

@@ -58,6 +58,7 @@ export function getFillData() {
     property: getFillProperty(),
     content: '',
     audio_file_id: '',
+    record_list: [],
     model_essay: [],
     answer: {
       answer_list: [],

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

@@ -120,6 +120,11 @@ export default {
       this.recordList = JSON.parse(JSON.stringify(newVal));
       this.oldIndex = null;
       this.selectIndex = this.recordList.length > 0 ? this.recordList.length - 1 : null;
+      if (this.recordList.length > 0 && this.type === 'normal') {
+        this.recordtime = this.recordList[this.selectIndex].toltime;
+        this.wavblob = this.recordList[this.selectIndex].wavData;
+        this.changeStatus('normal');
+      }
     },
   },
   created() {

+ 11 - 0
src/views/book/courseware/preview/components/fill/FillPreview.vue

@@ -29,6 +29,9 @@
         ref="record"
         type="normal"
         class="record-box"
+        :answer-record-list="data.record_list"
+        :task-model="isJudgingRightWrong ? 'ANSWER' : ''"
+        @handleWav="handleWav"
       />
     </div>
   </div>
@@ -90,6 +93,11 @@ export default {
           });
         });
       });
+
+      this.handleWav(this.answer.record_list);
+    },
+    'data.record_list'(val) {
+      this.answer.record_list = val;
     },
   },
   created() {
@@ -109,6 +117,9 @@ export default {
       .flat();
   },
   methods: {
+    handleWav(data) {
+      this.data.record_list = data;
+    },
     getMainStyle() {
       const isRow = this.data.property.arrange_type === arrangeTypeList[0].value;
       const isFront = this.data.property.audio_position === audioPositionList[0].value;

+ 3 - 0
src/views/book/courseware/preview/components/matching/MatchingPreview.vue

@@ -204,6 +204,7 @@ export default {
      * @param {string} mark 选项标识
      */
     mousedown(e, i, j, mark) {
+      if (this.disabled) return;
       this.drag = true;
       document.body.style.userSelect = 'none'; // 禁止选中文本
       this.mouseEvent = { clientX: e.clientX, clientY: e.clientY };
@@ -217,6 +218,7 @@ export default {
      * @param {String} mark 选项标识
      */
     mouseup(e, i, j, mark) {
+      if (this.disabled || !this.drag) return;
       let { i: curI, j: curJ, mark: curMark } = this.mousePointer;
       if (curI === -1 && curJ === -1) return;
       if (Math.abs(curJ - j) > 1 || mark === curMark) return;
@@ -256,6 +258,7 @@ export default {
      * @param {String} mark 选项标识
      */
     handleClickConnection(e, i, j, mark) {
+      if (this.disabled) return;
       let { i: curI, j: curJ, mark: curMark } = this.curConnectionPoint;
       // 获取 item-wrapper 元素
       let currentNode = e.target;

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

@@ -22,7 +22,6 @@
 
 <script>
 import { getFillData } from '@/views/book/courseware/data/fill';
-import { getConfig } from '@/utils/auth';
 
 import PreviewMixin from '../common/PreviewMixin';
 import SoundRecord from '../../common/SoundRecord.vue';

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

@@ -87,7 +87,7 @@
       :id="audioId"
       :ref="audioId"
       :src="mp3"
-      preload="meta"
+      preload="metadata"
       @loadedmetadata="onLoadedmetadata"
       @timeupdate="onTimeupdate"
       @canplaythrough="oncanplaythrough"