natasha 1 year ago
parent
commit
e1fe522829
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/components/Adult/preview/AudioLine.vue

+ 7 - 5
src/components/Adult/preview/AudioLine.vue

@@ -14,6 +14,7 @@
         :class="[
         :class="[
           audio.loading ? 'loadBtn' : audio.playing ? 'playBtn' : 'pauseBtn'
           audio.loading ? 'loadBtn' : audio.playing ? 'playBtn' : 'pauseBtn'
         ]"
         ]"
+        :disabled="audio.loading"
         @click="PlayAudio"
         @click="PlayAudio"
       />
       />
       <template v-if="!isRepeat">
       <template v-if="!isRepeat">
@@ -119,7 +120,7 @@ export default {
   // 监控data中数据变化
   // 监控data中数据变化
   watch: {
   watch: {
     stopAudio: {
     stopAudio: {
-      handler(val, oldVal) {
+      handler(val) {
         const _this = this;
         const _this = this;
         if (val) {
         if (val) {
           _this.$refs[_this.audioId].pause();
           _this.$refs[_this.audioId].pause();
@@ -146,7 +147,7 @@ export default {
     _this.$refs[audioId].addEventListener("play", function() {
     _this.$refs[audioId].addEventListener("play", function() {
       _this.audio.playing = true;
       _this.audio.playing = true;
       _this.audio.isPlaying = true;
       _this.audio.isPlaying = true;
-      _this.audio.loading = false;
+      // _this.audio.loading = false;
     });
     });
     _this.$refs[audioId].addEventListener("pause", function() {
     _this.$refs[audioId].addEventListener("pause", function() {
       _this.audio.playing = false;
       _this.audio.playing = false;
@@ -222,13 +223,12 @@ export default {
           if (this.audio.currentTime === 0) {
           if (this.audio.currentTime === 0) {
             if (!document.querySelector(".el-message")) {
             if (!document.querySelector(".el-message")) {
               _this.$message({
               _this.$message({
-                showClose: true,
                 message: "音频正在加载中,请等待",
                 message: "音频正在加载中,请等待",
                 type: "warning",
                 type: "warning",
                 duration: 0
                 duration: 0
               });
               });
             }
             }
-
+            this.audio.loading = true;
             if (_this.timer) {
             if (_this.timer) {
               clearInterval(_this.timer);
               clearInterval(_this.timer);
             }
             }
@@ -239,6 +239,7 @@ export default {
             clearInterval(_this.timer);
             clearInterval(_this.timer);
             _this.timer = null;
             _this.timer = null;
             _this.$message.closeAll();
             _this.$message.closeAll();
+            this.audio.loading = false;
           }
           }
         }, 300);
         }, 300);
 
 
@@ -256,7 +257,7 @@ export default {
     oncanplaythrough() {
     oncanplaythrough() {
       let _this = this;
       let _this = this;
       // setTimeout(() => {
       // setTimeout(() => {
-      _this.audio.loading = false;
+      // _this.audio.loading = false;
 
 
       // }, 10000);
       // }, 10000);
     },
     },
@@ -372,6 +373,7 @@ export default {
   beforeDestory() {
   beforeDestory() {
     this.$message.closeAll();
     this.$message.closeAll();
     clearInterval(this.timer);
     clearInterval(this.timer);
+    this.audio.loading = false;
   },
   },
   // 生命周期-销毁完成
   // 生命周期-销毁完成
   destoryed() {}
   destoryed() {}