Prechádzať zdrojové kódy

修改反馈bug及时间处理

qinpeng 2 rokov pred
rodič
commit
dbf5363050

+ 49 - 15
src/components/Adult/preview/Voicefullscreen.vue

@@ -706,7 +706,7 @@
                 src="../../../assets/NPC/qp-back.png"
                 alt=""
                 style="width: 48px; height: 48px"
-                @click="backStatus"
+                @click="backStatus(false)"
               />
               <div
                 :class="[
@@ -1249,7 +1249,7 @@ export default {
       }
     },
     // 返回初始状态
-    backStatus() {
+    backStatus(bool) {
       this.stopAllPlayStart();
       this.regionData = null;
       this.LY_regionData = null;
@@ -1259,12 +1259,45 @@ export default {
       this.LY_curTime = 0;
       this.xunhunShow = false;
       this.wavesurfer_big = null;
-      this.initaudioImage(1, false);
+      this.initaudioImage(1, bool ? true : false);
       if (this.LYstatus == "已结束") {
         wavesurfer_ly = null;
         this.initLYaudioImage(1, false);
       }
     },
+    changetime() {
+      let _this = this;
+      if (_this.curSentIndex != 0) {
+        _this.item.forEach((items) => {
+          items.timeList.forEach((it) => {
+            let AllNullTime = 0;
+            for (let i = _this.curSentIndex; i > 0; i--) {
+              if (i > 0) {
+                AllNullTime +=
+                  _this.curQue.wordTime[i].bg - _this.curQue.wordTime[i - 1].ed;
+              }
+            }
+            it.wordBg =
+              it.wordBg - _this.curQue.wordTime[_this.curSentIndex].bg;
+            it.wordEd =
+              it.wordEd - _this.curQue.wordTime[_this.curSentIndex].bg;
+          });
+        });
+        let AllNullTime = 0;
+        for (let i = _this.curSentIndex; i > 0; i--) {
+          if (i > 0) {
+            AllNullTime +=
+              _this.curQue.wordTime[i].bg - _this.curQue.wordTime[i - 1].ed;
+          }
+        }
+        _this.ed =
+          _this.curQue.wordTime[_this.curSentIndex].ed -
+          _this.curQue.wordTime[_this.curSentIndex].bg;
+        _this.bg =
+          _this.curQue.wordTime[_this.curSentIndex].bg -
+          _this.curQue.wordTime[_this.curSentIndex].bg;
+      }
+    },
     // 切换录音模式
     cutPatternType(type) {
       let _this = this;
@@ -1275,6 +1308,7 @@ export default {
       });
       this.patternType = type;
       if (type == "录音模式") {
+        this.changetime();
         this.initaudioImage(null, false);
         if (this.curQue.Bookanswer.practiceModel[this.curSentIndex]) {
           this.curjuzi(
@@ -1434,6 +1468,8 @@ export default {
       }).then((res) => {
         const objectUrl = window.URL.createObjectURL(res);
         this.wavesurfer_big.load(objectUrl);
+        let start = this.bg / 1000;
+        let end = this.ed / 1000;
         that.wavesurfer_big.on("ready", function (e) {
           if (!that.regionData) {
             that.wavesurfer_big.enableDragSelection({
@@ -1442,7 +1478,7 @@ export default {
             that.wavesurfer_big.clearRegions(); // 音频加载完成
           }
           if (!audioRate) {
-            that.wavesurfer_big.play();
+            that.wavesurfer_big.play(start, end);
           } else {
             if (isPlaying) {
               that.playMusic("play");
@@ -1534,21 +1570,14 @@ export default {
         that.ShowcurentTime = newtime;
       });
     },
-    curjuzi(src, playBool) {
+    curjuzi(src) {
       let _this = this;
-      let start = this.bg / 1000;
-      let end = this.ed / 1000;
-      if (playBool) {
-        _this.wavesurfer_big.play(start, end);
-      }
-
       let node = document.getElementById("waveform_big");
       node.children[0].style.height = "130px";
       let lynode = document.getElementById("ly_big");
       lynode.style.display = "flex";
       if (src) {
         _this.LY_url = src;
-        this.initLYaudioImage(1);
       } else {
         let node = document.getElementById("waveform_big");
         node.children[0].style.height = "308px";
@@ -2091,6 +2120,7 @@ export default {
       _this.pauseAudio();
       _this.isPlaying = false;
       let item = JSON.parse(JSON.stringify(_this.sentList[_this.curSentIndex]));
+
       if (item.sentArr) {
         _this.item = item.sentArr;
         _this.enwords = item.enwords;
@@ -2100,6 +2130,7 @@ export default {
       _this.sentList.forEach((item) => {
         this.isCollArr.push(false);
       });
+
       _this.bg = _this.curQue.wordTime[_this.curSentIndex].bg;
       _this.ed = _this.curQue.wordTime[_this.curSentIndex].ed;
       let maxTime = (_this.ed - _this.bg) / 1000;
@@ -2109,12 +2140,15 @@ export default {
         _this.maxTime = maxTime;
       }
       if (this.patternType == "录音模式") {
+        this.changetime();
         if (this.curQue.Bookanswer.practiceModel[this.curSentIndex]) {
+          this.backStatus(true);
           this.curjuzi(
             this.curQue.Bookanswer.practiceModel[this.curSentIndex].recordSrc
           );
           this.LYstatus = "已结束";
         } else {
+          this.backStatus(true);
           this.curjuzi();
           this.LYstatus = "未开始";
         }
@@ -2293,7 +2327,7 @@ export default {
             let start = this.bg / 1000;
             let end = this.ed / 1000;
             if (time * 1000 == this.ed || this.curTime * 1000 == 0) {
-              this.wavesurfer_big.play();
+              this.wavesurfer_big.play(start, end);
             } else {
               this.wavesurfer_big.play(this.curTime / 1000, end);
             }
@@ -3154,12 +3188,12 @@ export default {
 <style lang="scss">
 #waveform_big {
   > :nth-child(1) {
-    overflow: hidden !important;
+    overflow-x: scroll;
   }
 }
 #waveform_ly {
   > :nth-child(1) {
-    overflow: hidden !important;
+    overflow-x: scroll;
   }
 }
 .NPC-Big-Book-preview-green {