瀏覽代碼

文章录音问题修改

gcj 3 年之前
父節點
當前提交
4074537244

+ 15 - 1
src/components/Adult/preview/ArticleViewChs/Practicechs.vue

@@ -317,6 +317,7 @@
                   curQue.Bookanswer.practiceModel[index].recordList
                 "
                 :tmIndex="index"
+                :sentIndex="sentIndex"
                 @handleWav="handleWav"
                 v-if="refresh"
               />
@@ -421,8 +422,21 @@ export default {
   watch: {
     sentIndex: {
       handler: function (newVal, oldVal) {
+        let _this = this;
         if (newVal != oldVal) {
-          this.wavblob = "";
+          let Bookanswer = _this.curQue.Bookanswer;
+          if (
+            Bookanswer &&
+            Bookanswer.practiceModel &&
+            Bookanswer.practiceModel[newVal] &&
+            Bookanswer.practiceModel[newVal].recordList &&
+            Bookanswer.practiceModel[newVal].recordList.length > 0
+          ) {
+            _this.wavblob =
+              Bookanswer.practiceModel[newVal].recordList[0].wavData;
+          } else {
+            _this.wavblob = "";
+          }
         }
       },
       deep: true,

+ 15 - 1
src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue

@@ -423,6 +423,7 @@
                 "
                 :tmIndex="index"
                 @handleWav="handleWav"
+                :sentIndex="sentIndex"
                 v-if="refresh"
               />
               <div
@@ -576,8 +577,21 @@ export default {
   watch: {
     sentIndex: {
       handler: function (newVal, oldVal) {
+        let _this = this;
         if (newVal != oldVal) {
-          this.wavblob = "";
+          let Bookanswer = _this.curQue.Bookanswer;
+          if (
+            Bookanswer &&
+            Bookanswer.practiceModel &&
+            Bookanswer.practiceModel[newVal] &&
+            Bookanswer.practiceModel[newVal].recordList &&
+            Bookanswer.practiceModel[newVal].recordList.length > 0
+          ) {
+            _this.wavblob =
+              Bookanswer.practiceModel[newVal].recordList[0].wavData;
+          } else {
+            _this.wavblob = "";
+          }
         }
       },
       deep: true,

+ 13 - 1
src/components/Adult/preview/Soundrecord.vue

@@ -140,6 +140,7 @@ export default {
     "tmIndex",
     "answerRecordList",
     "TaskModel",
+    "sentIndex",
   ],
   data() {
     return {
@@ -163,7 +164,18 @@ export default {
     };
   },
   computed: {},
-  watch: {},
+  watch: {
+    sentIndex: {
+      handler: function (newVal, oldVal) {
+        if (newVal != oldVal) {
+          if (this.recordList.length > 0) {
+            this.selectIndex = 0;
+          }
+        }
+      },
+      deep: true,
+    },
+  },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
     this.handleActive();

+ 6 - 0
src/components/Adult/preview/Voicefullscreen.vue

@@ -553,6 +553,7 @@
               :isRecord="isRecord"
               :handleChangeStopAudio="handleChangeStopAudio"
               :getPlayStatus="getPlayStatus"
+              :key="'mp3Compare' + curSentIndex"
             />
           </div>
         </div>
@@ -997,6 +998,11 @@ export default {
     },
     getSentence() {
       let _this = this;
+      _this.isShowCompare =
+        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex] &&
+        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList &&
+        _this.curQue.Bookanswer.practiceModel[_this.curSentIndex].recordList
+          .length > 0;
       _this.pauseAudio();
       _this.isPlaying = false;
       let item = JSON.parse(JSON.stringify(_this.sentList[_this.curSentIndex]));