Переглянути джерело

Merge branch 'master' into NPC-lhd

natasha 3 роки тому
батько
коміт
b7f1eac3bb

+ 13 - 10
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) {
@@ -254,14 +265,6 @@ export default {
           }
         });
         this.$refs[audioId].play();
-      }else{
-            let audio = document.getElementsByTagName("audio");
-            audio.forEach((item) => {
-                if (item.id !== audioId) {
-                    item.pause();
-                }
-            });
-            this.$refs[audioId].pause();
       }
     },
     // 将整数转换成 时:分:秒的格式

+ 29 - 18
src/components/Adult/preview/DialogueArticleViewChs/AnswerModel.vue

@@ -73,7 +73,7 @@
                                 ? 'noFont'
                                 : '',
                             ]"
-                            >{{ pItem.pinyin }}</span
+                            >{{ pItem.pinyin | handlePY }}</span
                           >
                           <template v-if="!pItem.isHeng">
                             <span
@@ -106,10 +106,13 @@
                               pItem.className ? pItem.className : '',
                               noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                             ]"
-                            >{{ pItem.pinyin }}</span
+                            >{{ pItem.pinyin | handlePY }}</span
                           >
                         </span>
-                        <span class="NNPE-words-box" v-if="item.wordsList[pIndex + 1]">
+                        <span
+                          class="NNPE-words-box"
+                          v-if="item.wordsList[pIndex + 1]"
+                        >
                           <span
                             v-if="pyPosition == 'top'"
                             class="NNPE-pinyin"
@@ -121,7 +124,9 @@
                                 : '',
                             ]"
                             style="text-align: left"
-                            >{{ item.wordsList[pIndex + 1].pinyin }}</span
+                            >{{
+                              item.wordsList[pIndex + 1].pinyin | handlePY
+                            }}</span
                           >
 
                           <span
@@ -151,7 +156,9 @@
                                 : '',
                             ]"
                             style="text-align: left"
-                            >{{ item.wordsList[pIndex + 1].pinyin }}</span
+                            >{{
+                              item.wordsList[pIndex + 1].pinyin | handlePY
+                            }}</span
                           >
                         </span>
                       </template>
@@ -159,17 +166,14 @@
                       <!--下一个元素不是标点-->
                       <template v-else>
                         <span
-                          v-if="pyPosition == 'top'&&item.wordsList[pIndex + 1]"
+                          v-if="pyPosition == 'top'"
                           class="NNPE-pinyin"
                           :class="[
                             pItem.padding ? 'padding' : '',
                             pItem.className ? pItem.className : '',
-                            noFont.indexOf(item.wordsList[pIndex + 1].pinyin) >
-                            -1
-                              ? 'noFont'
-                              : '',
+                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                           ]"
-                          >{{ pItem.pinyin }}</span
+                          >{{ pItem.pinyin | handlePY }}</span
                         >
                         <template v-if="!pItem.isHeng">
                           <span
@@ -196,17 +200,14 @@
                           </div>
                         </template>
                         <span
-                          v-if="pyPosition == 'bottom'&&item.wordsList[pIndex + 1]"
+                          v-if="pyPosition == 'bottom'"
                           class="NNPE-pinyin"
                           :class="[
                             pItem.padding ? 'padding' : '',
                             pItem.className ? pItem.className : '',
-                            noFont.indexOf(item.wordsList[pIndex + 1].pinyin) >
-                            -1
-                              ? 'noFont'
-                              : '',
+                            noFont.indexOf(pItem.pinyin) > -1 ? 'noFont' : '',
                           ]"
-                          >{{ pItem.pinyin }}</span
+                          >{{ pItem.pinyin | handlePY }}</span
                         >
                       </template>
                     </template>
@@ -408,6 +409,16 @@ export default {
       });
       return str;
     },
+    handlePY(pinyin) {
+      let reg = /_{2,}/g;
+      let py = "";
+      if (reg.test(pinyin)) {
+        py = "";
+      } else {
+        py = pinyin;
+      }
+      return py;
+    },
   },
   data() {
     return {
@@ -416,7 +427,7 @@ export default {
       chsFhList: [",", "。", "“", ":", "》", "《", "?", "!", ";"],
       enFhList: [",", ".", ";", "?", "!", ":", ">", "<"],
       newWords: ["鱼", "辩礼义"],
-      noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "/"],
+      noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "/", "_"],
       oldHz: "",
       hz: "",
       top: 0,

+ 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() {