Sfoglia il codice sorgente

兼容文章没有音频情况

natasha 1 anno fa
parent
commit
456dfe38cf

+ 8 - 2
src/views/bookShelf/components/InnerTextSearch.vue

@@ -453,9 +453,15 @@ export default {
           };
           resArr[item.pno].wordsList.push(obj);
         });
-        resArr[item.pno].timeList.push(
+        if (
+          articleInfo.art_sound_srt_data &&
+          articleInfo.art_sound_srt_data.sents &&
           articleInfo.art_sound_srt_data.sents[index]
-        );
+        ) {
+          resArr[item.pno].timeList.push(
+            articleInfo.art_sound_srt_data.sents[index]
+          );
+        }
       });
       this.resArr = resArr;
     },

+ 8 - 2
src/views/bookShelf/components/LexicalType.vue

@@ -753,9 +753,15 @@ export default {
           };
           resArr[item.pno].wordsList.push(obj);
         });
-        resArr[item.pno].timeList.push(
+        if (
+          articleInfo.art_sound_srt_data &&
+          articleInfo.art_sound_srt_data.sents &&
           articleInfo.art_sound_srt_data.sents[index]
-        );
+        ) {
+          resArr[item.pno].timeList.push(
+            articleInfo.art_sound_srt_data.sents[index]
+          );
+        }
       });
       this.resArr = resArr;
     },

+ 8 - 2
src/views/bookShelf/components/NormalModel.vue

@@ -400,9 +400,15 @@ export default {
           };
           resArr[item.pno].wordsList.push(obj);
         });
-        resArr[item.pno].timeList.push(
+        if (
+          articleInfo.art_sound_srt_data &&
+          articleInfo.art_sound_srt_data.sents &&
           articleInfo.art_sound_srt_data.sents[index]
-        );
+        ) {
+          resArr[item.pno].timeList.push(
+            articleInfo.art_sound_srt_data.sents[index]
+          );
+        }
       });
       this.resArr = resArr;
     },

+ 22 - 9
src/views/bookShelf/components/PracticeModel.vue

@@ -607,7 +607,11 @@ export default {
           this.playSentIndex = 0;
         }
       }
-      this.handleChangeTime(this.resArr.timeList[this.playSentIndex].s);
+      this.handleChangeTime(
+        this.resArr.timeList[this.playSentIndex]
+          ? this.resArr.timeList[this.playSentIndex].s
+          : null
+      );
     },
     getCurTime(curTime) {
       if (this.isCompare) {
@@ -697,10 +701,15 @@ export default {
           wordlist.push(obj);
         });
         resArr.wordsList.push(wordlist);
-        resArr.timeList.push(articleInfo.art_sound_srt_data.sents[index]);
+        if (
+          articleInfo.art_sound_srt_data &&
+          articleInfo.art_sound_srt_data.sents &&
+          articleInfo.art_sound_srt_data.sents[index]
+        ) {
+          resArr.timeList.push(articleInfo.art_sound_srt_data.sents[index]);
+        }
       });
       this.resArr = resArr;
-      console.log(this.resArr);
     },
     handleChangeTime(time, ed, flag, type) {
       this.audio.pause();
@@ -730,7 +739,8 @@ export default {
           } else {
             this.ed = undefined;
           }
-          this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
+          if (this.$refs.audioLine)
+            this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
         }
       }
     },
@@ -762,7 +772,7 @@ export default {
       let _this = this;
       this.audio.pause();
       this.audioc.pause();
-      if (_this.$refs.audioLine.audio.playing) {
+      if (_this.$refs.audioLine && _this.$refs.audioLine.audio.playing) {
         _this.$refs.audioLine.PlayAudio();
       }
       if (!this.microphoneStatus) {
@@ -974,10 +984,13 @@ export default {
       } else {
         _this.audioc.pause();
         _this.audioc.load();
-        _this.handleChangeTime(
-          _this.resArr.timeList[playSentIndex].s,
-          _this.resArr.timeList[playSentIndex].e
-        );
+        if (_this.resArr.timeList[playSentIndex]) {
+          _this.handleChangeTime(
+            _this.resArr.timeList[playSentIndex].s,
+            _this.resArr.timeList[playSentIndex].e
+          );
+        }
+
         _this.timeC = setInterval(() => {
           if (_this.curTime >= _this.resArr.timeList[playSentIndex].e - 250) {
             _this.curTime = _this.resArr.timeList[playSentIndex].s;

File diff suppressed because it is too large
+ 403 - 355
src/views/bookShelf/components/Voicefullscreen.vue


Some files were not shown because too many files changed in this diff