natasha 1 år sedan
förälder
incheckning
1b9013437c

+ 8 - 0
src/components/common/AudioLine.vue

@@ -1,5 +1,12 @@
 <template>
   <div :class="['Audio', mp3Source && mp3Source == 'tts' ? 'Audio-tts' : '']">
+    <template v-if="type==='full'">
+        <div class="full-drive" @click="PlayAudio">
+            <svg-icon icon-class="Type-drive"></svg-icon>
+            <span>听对比</span>
+        </div>
+    </template>
+    <template v-else>
     <div class="audioLine" :class="[]">
       <div
         class="play"
@@ -57,6 +64,7 @@
       </el-dropdown>
       <!-- <svg-icon icon-class="repeat" :class="['icon-repeat',isRepeat?'active':'']"></svg-icon> -->
     </div>
+    </template>
     <audio
       :id="audioId"
       :ref="audioId"

+ 9 - 28
src/components/common/AudioRed.vue

@@ -1,7 +1,13 @@
 <!--  -->
 <template>
   <div v-if="mp3" class="content-voices" @click="handlePlayVoice">
-    <img :src="voiceSrc" :class="type == 'full' ? 'icon-big' : ''" />
+    <div class="full-drive">
+        <svg-icon icon-class="Type-drive"></svg-icon>
+        <span>听对比2</span>
+    </div>
+
+    <!-- <svg-icon icon-class="Type-drive" :style="{color:'#fff'}" :class="type == 'full' ? 'icon-big' : ''"></svg-icon> -->
+    <!-- <img :src="voiceSrc" :class="type == 'full' ? 'icon-big' : ''" /> -->
   </div>
 </template>
 
@@ -71,6 +77,7 @@ export default {
   // 方法集合
   methods: {
     handlePlayVoice() {
+        debugger
       let _this = this;
       console.log(this.audio.paused);
       if (!_this.audio.paused) {
@@ -96,31 +103,5 @@ export default {
 </script>
 <style lang='scss' scoped>
 //@import url(); 引入公共css类
-.content-voices {
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  width: 100%;
-  font-size: 0;
-  cursor: pointer;
-  span {
-    color: #2c2c2c;
-    font-size: 24px;
-    line-height: 30px;
-    float: left;
-    font-family: sourceR;
-    &.noMp3 {
-      margin-left: 0px;
-    }
-  }
-  img {
-    width: 16px;
-    height: 16px;
-    float: left;
-  }
-  .icon-big {
-    width: 24px;
-    height: 24px;
-  }
-}
+
 </style>

+ 70 - 57
src/components/common/Soundrecorddiff.vue

@@ -4,17 +4,20 @@
     <div
       :class="['record-main', microphoneStatus ? 'active' : '']"
     >
-      <div class="record-main-inner" @click="microphone">
-        <div class="record" />
-        <span v-if="microphoneStatus" class="record-time">{{
+      <div class="record-main-inner" @click="microphone" v-if="!microphoneStatus">
+        <div class="record">
+            <svg-icon icon-class="Voice-luyin" :style="{color:'#fff',fontSize:'28px'}"></svg-icon>
+        </div>
+        <!-- <span v-if="microphoneStatus" class="record-time">{{
           handleDateTime(recordtime)
-        }}</span>
+        }}</span> -->
       </div>
+      <img @click="microphone" class="luyin-gif" :style="{width:'56px'}" v-else src="../../assets/voice-gif.png" />
     </div>
 
     <div
       v-if="
-        !microphoneStatus && recordList.length > 0
+        !microphoneStatus && recordList.length > 0 &&selectIndex || selectIndex == 0
       "
       :class="[
         'hasRecord',
@@ -31,31 +34,31 @@
           )
         "
       >
-        <svg-icon icon-class="play-fill" className="icon-svg"></svg-icon>
+        <svg-icon icon-class="pause" className="icon-svg" v-if="hasMicro!=='normal'"></svg-icon>
+        <svg-icon icon-class="play-fill" className="icon-svg" v-else></svg-icon>
       </div>
-      <span
+      <!-- <span
         class="record-time"
         >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
-      >
-      <el-select
+      > -->
+    </div>
+    <el-select 
         v-model="selectIndex"
         placeholder="No recording"
         no-data-text="No recording"
         :popper-append-to-body="false"
         @change="handleChangeRecord"
-      >
+        class="diff-select"
+        :class="[bgIndex == 1 ? 'diff-select-white' : '']"
+        v-if="recordList.length > 0"
+    >
         <el-option
-          v-for="(item, index) in recordList"
-          :key="'recordList' + index"
-          :label="item.name"
-          :value="index"
-        />
-      </el-select>
-      <a
-        class="record-delete"
-        @click="handleDelete"
-      />
-    </div>
+            v-for="(item, index) in recordList"
+            :key="'recordList' + index"
+            :label="'录音'+(index+1)"
+            :value="index">
+        </el-option>
+    </el-select>
   </div>
 </template>
 
@@ -93,7 +96,19 @@ export default {
       isPlaying: false,
     };
   },
-  watch: {},
+  watch: {
+    answerRecordList: {
+      handler(val, oldVal) {
+        let _this = this;
+        _this.recordList = _this.answerRecordList
+        ? JSON.parse(JSON.stringify(_this.answerRecordList))
+        : [];
+        
+      },
+      // 深度观察监听
+      deep: true,
+    },
+  },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
     this.handleActive();
@@ -120,6 +135,8 @@ export default {
           !_this.microphoneStatus && _this.recordList.length > 0
         );
       _this.$forceUpdate();
+    }else{
+        _this.selectIndex = null
     }
     _this.audio.addEventListener("play", function () {
       _this.changeStatus("active");
@@ -168,7 +185,6 @@ export default {
             : "Recording " + _this.recordFile,
           id: _this.recordFile + Math.round(Math.random() * 10),
         };
-        console.log(this.selectData);
         if (this.selectData) obj.selectData = this.selectData;
         _this.recordList.push(obj);
         _this.recordFile++;
@@ -191,18 +207,8 @@ export default {
           _this.recordList[_this.selectIndex].fileSize = fileSize;
 
           _this.wavblob = _this.recordList[_this.selectIndex].wavData;
-          _this.$emit("getWavblob", _this.wavblob);
-          _this.$emit(
-            "handleWav",
-            JSON.parse(JSON.stringify(_this.recordList)),
-            _this.tmIndex
-          );
-          if (this.recordList[this.selectIndex].selectData) {
-            this.$emit(
-              "getSelectData",
-              this.recordList[this.selectIndex].selectData
-            );
-          }
+          _this.$emit("getWavblob", _this.wavblob,reader.result);
+
         };
       }
       _this.$emit(
@@ -339,9 +345,10 @@ export default {
   // border: 1px solid rgba(0, 0, 0, 0.1);
   // border-radius: 8px;
   .playBack {
-    width: 24px;
-    height: 24px;
+    font-size: 24px;
+    line-height: 24px;
     margin-left: 8px;
+    color: #175DFF;
     // background: url("../../../assets/icon/play-24-normal-Black.png") center
     //   no-repeat;
     // background-size: 100%;
@@ -358,12 +365,10 @@ export default {
     // }
   }
   .playBack-white {
-    width: 24px;
-    height: 24px;
+    font-size: 24px;
     margin-left: 8px;
-    // background: url("../../../assets/icon/play-24-normal-white.png") center
-    //   no-repeat;
-    // background-size: 100%;
+    line-height: 24px;
+    color: #FFD617;
     cursor: pointer;
     // &.normal {
     //   background: url("../../../assets/icon/play-24-normal-white.png") center
@@ -395,18 +400,19 @@ export default {
     margin-left: 8px;
   }
   .record-main {
-    width: 162px;
+    // width: 162px;
     height: 136px;
     box-sizing: border-box;
-    padding: 40px 8px 40px 40px;
+    padding: 40px 16px 40px 40px;
     &.active {
     //   background: url("../../../assets/NPC/vocie-gif.png") no-repeat left top;
       background-size: 100% 100%;
     }
     &-inner {
-      padding: 16px 16px;
+      padding: 12px 12px;
       box-sizing: border-box;
       width: fit-content;
+      width: 56px;
       height: 56px;
       border-radius: 40px;
       display: flex;
@@ -418,13 +424,6 @@ export default {
       cursor: pointer;
     }
   }
-
-  .record {
-    width: 24px;
-    height: 24px;
-    // background: url("../../../assets/NPC/voice-24.png") center no-repeat;
-    background-size: 100%;
-  }
   .record-time {
     color: #fff;
     font-size: 16px;
@@ -444,10 +443,9 @@ export default {
     justify-content: center;
     align-items: center;
     height: 56px;
-    padding: 16px 0 16px 16px;
-    border-radius: 40px 0 0 40px;
+    padding: 16px;
+    border-radius: 40px;
     border: 1px solid rgba(0, 0, 0, 0.1);
-    border-right: 0px solid rgba(0, 0, 0, 0.1);
     box-sizing: border-box;
 
     .record-time {
@@ -475,8 +473,8 @@ export default {
       }
     }
     &-white {
-      background: rgba(255, 255, 255, 0.1);
-      border: 1px solid rgba(0, 0, 0, 0.1);
+      background: rgba(0, 0, 0, 0.24);
+      border: 1px solid rgba(0, 0, 0, 0.24);
       border-right: 0;
       .record-time {
         color: #fff;
@@ -550,4 +548,19 @@ export default {
     }
   }
 }
+.diff-select{
+    margin-left: 16px;
+    width: 116px;
+    .el-input__inner{
+        padding: 8px 16px;
+    }
+    &-white{
+        .el-input__inner{
+            background: rgba(0, 0, 0, 0.24);
+            border-color: rgba(0, 0, 0, 0.24);
+            color: #fff;
+            font-weight: 500;
+        }
+    }
+}
 </style>

+ 31 - 0
src/styles/index.scss

@@ -277,4 +277,35 @@ ul {
         display: block;
         /* 在打印时显示水印 */
     }
+}
+
+.full-drive {
+    border-radius: 40px;
+    width: 120px;
+    height: 48px;
+    flex-shrink: 0;
+    line-height: 48px;
+    text-align: center;
+    font-size: 16px;
+    color: #000000;
+    border: 1px solid rgba(0, 0, 0, 0.24);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    .svg-icon {
+        width: 24px;
+        height: 24px;
+        font-size: 24px;
+        margin-right: 8px;
+    }
+}
+
+.compare-box-white {
+    .full-drive {
+        background: rgba(0, 0, 0, 0.24);
+        color: #fff;
+        .svg-icon {
+            color: #fff;
+        }
+    }
 }

+ 27 - 5
src/views/bookShelf/components/Voicefullscreen.vue

@@ -221,6 +221,7 @@
             :tmIndex="curSentIndex"
             :key="'Soundrecorddiff' + curSentIndex"
           />
+        </div>
           <div
             :class="['compare-box', bgIndex == 1 ? 'compare-box-white' : '']"
             v-if="isShowCompare"
@@ -241,9 +242,9 @@
               :handleChangeStopAudio="handleChangeStopAudio"
               :getPlayStatus="getPlayStatus"
               :key="'mp3Compare' + curSentIndex"
+              
             />
           </div>
-        </div>
         <div
           :class="[
             'page-count',
@@ -599,8 +600,25 @@ export default {
     getMicrophoneStatus(bool) {
       this.isRecording = bool;
     },
-    getWavblob(wavblob) {
-      this.wavblob = wavblob;
+    getWavblob(wavblob,wav) {
+      this.wavblob = wav;
+      if(wav){
+        this.addRecord(wav)
+      }
+    },
+    addRecord(wav){
+        let MethodName = "/PaperServer/Client/UserSentRec/AddUserSentRec";
+        let data = {
+            sent_id: this.curQue.art_corpus_data.sentList[this.curSentIndex].id,
+            rec_sound_data: wav
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                this.getAllRecordList()
+            }
+            
+        })
     },
     sentPause(isRecord) {
       this.isRecord = isRecord;
@@ -640,8 +658,7 @@ export default {
     changeBg(bgIndex) {
       this.bgIndex = bgIndex;
     },
-    getSentence() {
-        let _this = this;
+    getAllRecordList(){
         let MethodName = "/PaperServer/Client/UserSentRec/RecListInUserSent";
         let data = {
             sent_id: this.curQue.art_corpus_data.sentList[this.curSentIndex].id,
@@ -653,6 +670,10 @@ export default {
                 this.historySentRecordList = res.data.all
             }
         })
+    },
+    getSentence() {
+        let _this = this;
+        _this.getAllRecordList()
       _this.isShowCompare = _this.historySentRecordList.length > 0;
       _this.pauseAudio();
       _this.isPlaying = false;
@@ -689,6 +710,7 @@ export default {
     },
     handleWav(list, tmIndex) {
       tmIndex = tmIndex ? tmIndex : 0;
+
     //   this.$emit("handleWav", list, tmIndex);
     },
     // 录音时暂停音频播放