Explorar o código

修改切换音频的旧音频的问题。

qinpeng %!s(int64=2) %!d(string=hai) anos
pai
achega
4dc4eb8b17
Modificáronse 1 ficheiros con 19 adicións e 3 borrados
  1. 19 3
      src/components/Adult/preview/Voicefullscreen.vue

+ 19 - 3
src/components/Adult/preview/Voicefullscreen.vue

@@ -1094,6 +1094,13 @@ export default {
   methods: {
     // 切换录音模式
     cutPatternType(type) {
+      this.loading = true;
+      let _this = this;
+      _this.$nextTick(() => {
+        if (_this.$refs.audioLineSent) {
+          _this.$refs.audioLineSent.PlayAudio();
+        }
+      });
       this.patternType = type;
       if (type == "录音模式") {
         this.initaudioImage();
@@ -1119,7 +1126,6 @@ export default {
       this.pCtx = this.pCanvas.getContext("2d");
     },
     initaudioImage(src) {
-      this.loading = true;
       this.wavesurfer = WaveSurfer.create({
         container: this.$refs.waveform,
         barWidth: 1,
@@ -1173,14 +1179,15 @@ export default {
         let end = this.ed / 1000;
         that.wavesurfer.on("ready", function (e) {
           that.wavesurfer.play(start, end);
-          that.loading = false;
           that.wavesurfer.zoom(Number(0.001));
         });
         that.wavesurfer_big.on("ready", function (e) {
           that.wavesurfer_big.play(start, end);
-          that.loading = false;
           that.wavesurfer_big.zoom(Number(600));
           that.wavesurfer_big.setMute(true);
+          that.loading = false;
+          that.$forceUpdate();
+          console.log(that.loading);
         });
       });
 
@@ -1712,6 +1719,9 @@ export default {
       }
     },
     prevSentence() {
+      if (this.loading) {
+        return;
+      }
       if (this.curSentIndex == 0) {
         this.$message.warning("已经是第一个句子了");
         return;
@@ -1724,6 +1734,10 @@ export default {
       }
     },
     nextSentence() {
+      console.log(this.loading);
+      if (this.loading) {
+        return;
+      }
       if (this.curSentIndex == this.sentList.length - 1) {
         this.$message.warning("已经是最后一个句子了");
         return;
@@ -1852,8 +1866,10 @@ export default {
           this.curjuzi(
             this.curQue.Bookanswer.practiceModel[this.curSentIndex].recordSrc
           );
+          this.LYstatus = "已结束";
         } else {
           this.curjuzi();
+          this.LYstatus = "未开始";
         }
       } else {
         _this.$nextTick(() => {