guanchunjie 3 سال پیش
والد
کامیت
61d4f4a991
2فایلهای تغییر یافته به همراه31 افزوده شده و 5 حذف شده
  1. 13 2
      src/components/Adult/preview/AudioLine.vue
  2. 18 3
      src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue

+ 13 - 2
src/components/Adult/preview/AudioLine.vue

@@ -89,6 +89,7 @@ export default {
       duioCurrentTime: null, // 剩余时间
       count: 0,
       loading: null,
+      isClick: false,
     };
   },
   // 计算属性 类似于data概念
@@ -145,6 +146,7 @@ export default {
       _this.audio.playing = false;
       _this.audio.isPlaying = false;
       _this.$emit("handleListenRead", false);
+      _this.isClick = false;
     });
 
     this.$nextTick(() => {
@@ -185,6 +187,7 @@ export default {
         this.$refs[audioId].pause();
         this.audio.playing = false;
         this.$emit("handleListenRead", false);
+        this.isClick = false;
       } else {
         if (this.count == 0) {
           this.audio.loading = true;
@@ -198,6 +201,7 @@ export default {
         }
         this.$emit("handleChangeStopAudio");
         this.$emit("handleListenRead", true);
+        this.isClick = true;
       }
     },
     oncanplaythrough() {
@@ -237,8 +241,15 @@ export default {
       this.audio.currentTime = res.target.currentTime;
       this.getCurTime(res.target.currentTime);
       this.playValue = (this.audio.currentTime / this.audio.maxTime) * 100;
-      if (this.audio.currentTime * 1000 > this.ed) {
-        this.$refs[audioId].pause();
+      if (this.type == "audioLine") {
+        if (!this.isClick && this.audio.currentTime * 1000 > this.ed) {
+          this.$refs[audioId].pause();
+          this.$emit("emptyEd");
+        }
+      } else {
+        if (this.audio.currentTime * 1000 > this.ed) {
+          this.$refs[audioId].pause();
+        }
       }
     },
     onTimeupdateTime(res, playFlag) {

+ 18 - 3
src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue

@@ -20,7 +20,10 @@
             :width="555"
             :isRepeat="isRepeat"
             :mp3Source="curQue.mp3_list[0].source"
+            :ed="ed"
+            type="audioLine"
             @handleChangeStopAudio="handleChangeStopAudio"
+            @emptyEd="emptyEd"
           />
         </template>
       </div>
@@ -57,7 +60,10 @@
                 curQue.wordTime &&
                   curQue.wordTime[index] &&
                   curQue.wordTime[index].bg,
-                index
+                index,
+                curQue.wordTime &&
+                  curQue.wordTime[index] &&
+                  curQue.wordTime[index].ed
               )
             "
           >
@@ -353,6 +359,7 @@
                   :sentPause="sentPause"
                   :isRecord="isRecord"
                   :handleChangeStopAudio="handleChangeStopAudio"
+                  :getPlayStatus="getPlayStatus"
                 />
               </div>
             </div>
@@ -363,7 +370,7 @@
     </template>
     <div class="voice-full-screen" :id="'screen-' + mathNum">
       <Voicefullscreen
-        v-if="isFull&&resObj"
+        v-if="isFull && resObj"
         :themeColor="themeColor"
         :curQue="curQue"
         :sentList="resObj.sentList"
@@ -466,6 +473,7 @@ export default {
       isRecord: false,
       isFull: false,
       mathNum: Math.random().toString(36).substr(2),
+      ed: undefined,
     };
   },
   computed: {
@@ -489,6 +497,9 @@ export default {
   },
   //方法集合
   methods: {
+    getPlayStatus(val) {
+      //this.isPlaying = val;
+    },
     pauseAudio() {
       let audio = document.getElementsByTagName("audio");
       audio.forEach((item) => {
@@ -690,17 +701,21 @@ export default {
       return total;
     },
     //点击播放某个句子
-    handleChangeTime(time, index) {
+    handleChangeTime(time, index, ed) {
       let _this = this;
       if (_this.isRepeat) {
         _this.currSent = _this.curQue.wordTime[index];
       }
       _this.sentIndex = index;
+      _this.ed = ed;
       if (time) {
         _this.curTime = time;
         _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
       }
     },
+    emptyEd() {
+      this.ed = undefined;
+    },
     handleWav(data) {},
     // 录音时暂停音频播放
     handleParentPlay() {