natasha 1 éve
szülő
commit
e4206a5f87

+ 1 - 0
src/components/Adult/preview/SentenceModule.vue

@@ -788,6 +788,7 @@
                         "
                         :index="index"
                         :indexs="indexs"
+                        :modelType="curQue.type"
                         @handleWav="handleWav"
                       />
                     </div>

+ 3 - 0
src/components/Adult/preview/SentenceMulModule.vue

@@ -606,6 +606,7 @@
                             "
                             :index="index"
                             :indexs="indexs"
+                            :modelType="curQue.type"
                             @handleWav="handleWav"
                           />
                         </div>
@@ -710,6 +711,7 @@
                             "
                             :index="index"
                             :indexs="indexs"
+                            :modelType="curQue.type"
                             @handleWav="handleWav"
                           />
                         </div>
@@ -858,6 +860,7 @@
                           "
                           :index="index"
                           :indexs="indexs"
+                          :modelType="curQue.type"
                           @handleWav="handleWav"
                         />
                       </div>

+ 50 - 34
src/components/Adult/preview/Soundrecord.vue

@@ -6,7 +6,7 @@
         :class="[
           'record',
           microphoneStatus ? 'active' : '',
-          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
         ]"
         @click="microphone"
       />
@@ -16,7 +16,7 @@
           'record-time',
           microphoneStatus ? 'record-ing' : '',
           selectIndex || selectIndex == 0 ? 'record-black' : '',
-          type && type == 'normal' ? 'record-time-flex' : '',
+          type && type == 'normal' ? 'record-time-flex' : ''
         ]"
         >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
       >
@@ -37,7 +37,7 @@
         :class="[
           'record',
           microphoneStatus ? 'active' : '',
-          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
         ]"
         @click="microphone"
       />
@@ -71,7 +71,7 @@
           hasMicro && (!TaskModel || TaskModel != 'ANSWER')
             ? 'record-delete-has'
             : '',
-          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
         ]"
         @click="handleDelete"
       />
@@ -81,7 +81,7 @@
         :class="[
           'record',
           microphoneStatus ? 'active' : '',
-          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
         ]"
         @click="microphone"
       />
@@ -89,7 +89,7 @@
         :class="[
           'record-time',
           microphoneStatus ? 'record-ing' : '',
-          selectIndex || selectIndex == 0 ? 'record-black' : '',
+          selectIndex || selectIndex == 0 ? 'record-black' : ''
         ]"
         >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
       >
@@ -122,7 +122,7 @@
           hasMicro && (!TaskModel || TaskModel != 'ANSWER')
             ? 'record-delete-has'
             : '',
-          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
         ]"
         @click="handleDelete"
       />
@@ -144,14 +144,16 @@ export default {
     "TaskModel",
     "sentIndex",
     "modelType",
-    "tmsIndex"
+    "tmsIndex",
+    "index",
+    "indexs"
   ],
   data() {
     return {
       recorder: new Recorder({
         sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
         sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
-        numChannels: 1, // 声道,支持 1 或 2, 默认是1
+        numChannels: 1 // 声道,支持 1 或 2, 默认是1
       }),
       microphoneStatus: false,
       hasMicro: "", // 录音后的样式class
@@ -164,7 +166,7 @@ export default {
       selectIndex: null, // 选中的录音索引
       oldIndex: null, // 存储播放录音索引
       playtime: 0, // 播放时间
-      isPlaying: false,
+      isPlaying: false
     };
   },
   computed: {},
@@ -177,20 +179,20 @@ export default {
           }
         }
       },
-      deep: true,
+      deep: true
     },
     answerRecordList(newVal) {
       let _this = this;
       _this.recordList = newVal;
       _this.selectIndex = _this.recordList.length - 1;
-    },
+    }
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
     this.handleActive();
     let that = this;
 
-    window.stopAudioSound = function () {
+    window.stopAudioSound = function() {
       if (that.audio) {
         that.audio.pause();
       }
@@ -208,14 +210,14 @@ export default {
       _this.recordFile = _this.recordList.length + 1;
       _this.handleChangeRecord(0);
     }
-    _this.audio.addEventListener("play", function () {
+    _this.audio.addEventListener("play", function() {
       _this.changeStatus("active");
       _this.isPlaying = true;
     });
-    _this.audio.addEventListener("pause", function () {
+    _this.audio.addEventListener("pause", function() {
       _this.changeStatus("normal");
     });
-    _this.audio.addEventListener("ended", function () {
+    _this.audio.addEventListener("ended", function() {
       _this.changeStatus("normal");
       _this.isPlaying = false;
     });
@@ -225,7 +227,7 @@ export default {
   beforeUpdate() {}, // 生命周期 - 更新之前
   updated() {}, // 生命周期 - 更新之后
   beforeDestroy() {
-      this.audio.pause();
+    this.audio.pause();
   }, // 生命周期 - 销毁之前
   destroyed() {}, // 生命周期 - 销毁完成
   activated() {},
@@ -254,7 +256,7 @@ export default {
             name: _this.fileName
               ? _this.fileName + _this.recordFile
               : "Recording " + _this.recordFile,
-            id: _this.recordFile + Math.round(Math.random() * 10),
+            id: _this.recordFile + Math.round(Math.random() * 10)
           };
           if (this.selectData) obj.selectData = this.selectData;
           _this.recordList.push(obj);
@@ -280,19 +282,33 @@ export default {
             _this.recordList[_this.selectIndex].fileSize = fileSize;
             _this.wavblob = _this.recordList[_this.selectIndex].wavData;
             _this.$emit("getWavblob", _this.wavblob);
-            if(_this.modelType&&_this.modelType==='NewWord_chs'){
-                _this.$emit(
-                    "handleWav",
-                    JSON.parse(JSON.stringify(_this.recordList)),
-                    _this.tmIndex,
-                    _this.tmsIndex
-                );
-            }else{
-                _this.$emit(
-                    "handleWav",
-                    JSON.parse(JSON.stringify(_this.recordList)),
-                    _this.tmIndex
-                );
+            console.log(_this.modelType);
+            if (_this.modelType && _this.modelType === "NewWord_chs") {
+              _this.$emit(
+                "handleWav",
+                JSON.parse(JSON.stringify(_this.recordList)),
+                _this.tmIndex,
+                _this.tmsIndex
+              );
+            } else if (
+              _this.modelType &&
+              (_this.modelType === "sentence_segtemp_chs" ||
+                _this.modelType === "sentence_single_chs" ||
+                _this.modelType === "sentence_set_chs")
+            ) {
+              _this.$emit(
+                "handleWav",
+                JSON.parse(JSON.stringify(_this.recordList)),
+                _this.tmIndex,
+                _this.index,
+                _this.indexs
+              );
+            } else {
+              _this.$emit(
+                "handleWav",
+                JSON.parse(JSON.stringify(_this.recordList)),
+                _this.tmIndex
+              );
             }
             if (this.recordList[this.selectIndex].selectData) {
               this.$emit(
@@ -418,14 +434,14 @@ export default {
           _this.oldIndex = null;
           _this.isPlaying = false;
           clearInterval(_this.timer);
-          _this.audio.addEventListener("ended", function () {
+          _this.audio.addEventListener("ended", function() {
             _this.changeStatus("normal");
             _this.isPlaying = false;
           });
         }
       }
-    },
-  }, // 如果页面有keep-alive缓存功能,这个函数会触发
+    }
+  } // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>