Explorar el Código

1)整体录音暂停。
2)点击最下面的条界面会抖动。
3)完成录音后,合并音频后,更新一下时长。

natasha hace 3 semanas
padre
commit
dfe3c6425e

+ 32 - 24
src/views/book/courseware/preview/common/RecordScoreWholeBtn.vue

@@ -246,6 +246,7 @@ export default {
       this.wholeRecordSelectList[this.selectWholeIndex].src = obj.audio_file_url;
       this.wholeRecordSelectList[this.selectWholeIndex].audio_file_id = obj.audio_file_id;
       this.wholeRecordSelectList[this.selectWholeIndex].toltime = obj.media_duration;
+      this.recordtime = obj.media_duration;
     },
     // 点击开始录音按钮
     changeMicroStatus() {
@@ -568,33 +569,40 @@ export default {
       return Promise.resolve();
     },
     async playmicrophone(totalTimes) {
-      this.isPlaying = true;
-      if (this.selectWholeIndex || this.selectWholeIndex === 0) {
-        let totalTime = totalTimes;
-
+      if (this.isPlaying) {
+        this.isPlaying = false;
         this.audio.pause();
-        // 历史答案存 dataURL(同步播放,行为与改动前一致),新答案存 file_id(先换 URL)
-        const src = this.wholeRecordSelectList[this.selectWholeIndex].src;
-        if (!src) {
-          this.isPlaying = false;
-          this.$message.warning('录音加载失败,请稍后重试');
-          return;
-        }
-        this.audio.load();
-        this.audio.src = src;
-        this.oldIndex = this.selectWholeIndex;
-        playAudioElement(this.audio);
-        this.playtime = 0;
-        this.recordtime = totalTime;
         clearInterval(this.timer);
-        this.timer = setInterval(() => {
-          if (this.playtime < totalTime) {
-            this.playtime += 1;
-            this.recordtime = totalTime - this.playtime;
-          } else {
-            clearInterval(this.timer);
+        this.recordtime = this.wholeRecordSelectList[this.selectWholeIndex].toltime;
+      } else {
+        this.isPlaying = true;
+        if (this.selectWholeIndex || this.selectWholeIndex === 0) {
+          let totalTime = totalTimes;
+
+          this.audio.pause();
+          // 历史答案存 dataURL(同步播放,行为与改动前一致),新答案存 file_id(先换 URL)
+          const src = this.wholeRecordSelectList[this.selectWholeIndex].src;
+          if (!src) {
+            this.isPlaying = false;
+            this.$message.warning('录音加载失败,请稍后重试');
+            return;
           }
-        }, 1000);
+          this.audio.load();
+          this.audio.src = src;
+          this.oldIndex = this.selectWholeIndex;
+          playAudioElement(this.audio);
+          this.playtime = 0;
+          this.recordtime = totalTime;
+          clearInterval(this.timer);
+          this.timer = setInterval(() => {
+            if (this.playtime < totalTime) {
+              this.playtime += 1;
+              this.recordtime = totalTime - this.playtime;
+            } else {
+              clearInterval(this.timer);
+            }
+          }, 1000);
+        }
       }
     },
     // 高亮初始值

+ 1 - 1
src/views/book/courseware/preview/components/article/Practicechs.vue

@@ -76,7 +76,7 @@
     <div
       :style="{
         height: curQue.property.content_height ? curQue.property.content_height + 'px' : '',
-        overflow: 'auto',
+        overflow: curQue.property.content_height ? 'auto' : 'hidden',
       }"
     >
       <template v-if="resObj">

+ 1 - 1
src/views/book/courseware/preview/components/dialogue_article/Practicechs.vue

@@ -69,7 +69,7 @@
     <div
       :style="{
         height: curQue.property.content_height ? curQue.property.content_height + 'px' : '',
-        overflow: 'auto',
+        overflow: curQue.property.content_height ? 'auto' : 'hidden',
       }"
     >
       <template v-if="resObj">