natasha hai 1 ano
pai
achega
ae154e192c

+ 13 - 1
src/components/common/AudioLine.vue

@@ -85,6 +85,7 @@ export default {
     "themeColor",
     "hideSlider",
     "ed",
+    "showEd",
     "bg",
     "audioId",
     "type",
@@ -289,7 +290,18 @@ export default {
       if (this.type == "audioLine") {
         if (!this.isClick && this.audio.currentTime * 1000 > this.ed) {
           this.$refs[audioId].pause();
-          this.$emit("emptyEd");
+          if(this.$parent.repeatAfter){
+            this.$emit("emptyEd",true);
+          }else{
+            this.$emit("emptyEd");
+          }
+        }else if(this.showEd && this.audio.currentTime * 1000 > this.ed){
+            this.$refs[audioId].pause();
+            if(this.$parent.repeatAfter){
+                this.$emit("emptyEd",true);
+            }else{
+                this.$emit("emptyEd");
+            }
         }
       } else {
         if (this.audio.currentTime * 1000 > this.ed) {

+ 43 - 6
src/views/bookShelf/components/PracticeModel.vue

@@ -48,6 +48,7 @@
                 :mp3Source="'mp3'"
                 type="audioLine"
                 :ed="ed"
+                :showEd="showEd"
                 @emptyEd="emptyEd"
             />
             <svg-icon icon-class="icon-wrapper" class="wrapper"></svg-icon>
@@ -378,10 +379,25 @@ export default {
             } else {
                 this.curTime = curTime * 1000;
             }
+        } else if((this.singleModel||this.autoNextSent)&&this.playSentIndex>-1&&this.repeatAfter){
+            let time = curTime * 1000;
+            this.curTime = curTime * 1000;
+            // for(let i=0; i<this.resArr.timeList.length;i++){
+            //     if(this.curTime>this.resArr.timeList[i].s&&this.curTime<=this.resArr.timeList[i].e){
+            //         this.playSentIndex = i
+            //         break
+            //     }
+            // }
+            if (time >= this.resArr.timeList[this.playSentIndex].s || time <= this.resArr.timeList[this.playSentIndex].e) {
+                // this.curTime = this.resArr.timeList[this.playSentIndex].s;
+                this.ed = this.resArr.timeList[this.playSentIndex].e;
+                this.showEd = true
+                // this.$refs.audioLine.onTimeupdateTime(this.resArr.timeList[this.playSentIndex].s / 1000, true);
+            } 
         }else{
             this.curTime = curTime * 1000;  
             for(let i=0; i<this.resArr.timeList.length;i++){
-                if(this.curTime>=this.resArr.timeList[i].s&&this.curTime<this.resArr.timeList[i].e){
+                if(this.curTime>this.resArr.timeList[i].s&&this.curTime<=this.resArr.timeList[i].e){
                     this.playSentIndex = i
                     break
                 }
@@ -427,6 +443,13 @@ export default {
       }else{
         if (time>=0) {
             this.curTime = time;
+            for(let i=0; i<this.resArr.timeList.length;i++){
+                if(this.curTime>this.resArr.timeList[i].s&&this.curTime<=this.resArr.timeList[i].e){
+                    this.playSentIndex = i
+                    break
+                }
+            }
+            console.log(this.playSentIndex)
             if(ed){
                 this.ed = ed;
             }
@@ -435,8 +458,15 @@ export default {
       }
       
     },
-    emptyEd() {
+    emptyEd(flag) {
       this.ed = undefined;
+      if(flag){
+        this.showEd = false
+        console.log('jieshula ')
+        if(!this.microphoneStatus){
+            this.microphone()
+        }
+      }
     },
     //经过每个词,高亮句子
     handleMouseover(pItem) {
@@ -459,7 +489,6 @@ export default {
       this.audioc.pause();
       if(_this.$refs.audioLine.audio.playing){
             _this.$refs.audioLine.PlayAudio()
-            _this.showEd = false
       }
       if (!this.microphoneStatus) {
         _this.hasMicro = "";
@@ -592,6 +621,9 @@ export default {
         this.historyLoading = true
         this.audio.pause();
         this.audioc.pause();
+        if(this.microphoneStatus){
+            this.microphone()
+        }
         if(this.$refs.audioLine.audio.playing){
             this.$refs.audioLine.PlayAudio()
         }
@@ -626,7 +658,13 @@ export default {
         }
         getLogin(MethodName, data)
         .then((res) => {
-            
+            if(this.repeatAfter){
+            if(this.autoNextSent&&this.resArr.timeList[this.playSentIndex+1]){
+                this.playSentIndex = this.playSentIndex+1
+                this.ed = this.resArr.timeList[this.playSentIndex+1].e
+                this.handleChangeTime(this.resArr.timeList[this.playSentIndex+1].s)
+            }
+          }
         })
     },
     // 对比
@@ -635,7 +673,7 @@ export default {
         _this.isCompare = true
         // let curTime = _this.resArr.timeList[_this.playSentIndex].s
         // for(let i=0; i<this.resArr.timeList.length;i++){
-        //     if(curTime>=this.resArr.timeList[i].s&&curTime<this.resArr.timeList[i].e){
+        //     if(curTime>this.resArr.timeList[i].s&&curTime<=this.resArr.timeList[i].e){
         //         this.playSentIndex = i
         //         break
         //     }
@@ -656,7 +694,6 @@ export default {
             _this.audioc.pause();
             _this.audioc.load();
             _this.handleChangeTime(_this.resArr.timeList[playSentIndex].s,_this.resArr.timeList[playSentIndex].e)
-            console.log(playSentIndex)
             _this.timeC = setInterval(() => {
                 if(_this.curTime>=_this.resArr.timeList[playSentIndex].e - 250){
                     _this.curTime = _this.resArr.timeList[playSentIndex].s