|
@@ -161,7 +161,7 @@
|
|
<svg-icon icon-class="Go-start" :style="{color:colorObj.type==='white'||colorObj.type==='darkGreen'?'#000':'#fff'}"></svg-icon>
|
|
<svg-icon icon-class="Go-start" :style="{color:colorObj.type==='white'||colorObj.type==='darkGreen'?'#000':'#fff'}"></svg-icon>
|
|
<span :style="{color:colorObj.type==='armyGreen'?'#7C8983':''}">上一句</span>
|
|
<span :style="{color:colorObj.type==='armyGreen'?'#7C8983':''}">上一句</span>
|
|
</div>
|
|
</div>
|
|
- <div class="operate-item">
|
|
|
|
|
|
+ <div class="operate-item" @click="compare">
|
|
<svg-icon icon-class="Type-drive" :style="{color:colorObj.type==='white'||colorObj.type==='darkGreen'?'#000':'#fff'}"></svg-icon>
|
|
<svg-icon icon-class="Type-drive" :style="{color:colorObj.type==='white'||colorObj.type==='darkGreen'?'#000':'#fff'}"></svg-icon>
|
|
<span :style="{color:colorObj.type==='armyGreen'?'#7C8983':''}">听对比</span>
|
|
<span :style="{color:colorObj.type==='armyGreen'?'#7C8983':''}">听对比</span>
|
|
</div>
|
|
</div>
|
|
@@ -304,6 +304,7 @@ export default {
|
|
hasMicro: "", // 录音后的样式class
|
|
hasMicro: "", // 录音后的样式class
|
|
wavblob: null,
|
|
wavblob: null,
|
|
audio: new window.Audio(),
|
|
audio: new window.Audio(),
|
|
|
|
+ audioc: new window.Audio(), // 对比
|
|
recordList: [], // 录音文件数组
|
|
recordList: [], // 录音文件数组
|
|
recordtime: 0, // 录音时长
|
|
recordtime: 0, // 录音时长
|
|
timer: null, // 计时器
|
|
timer: null, // 计时器
|
|
@@ -317,7 +318,8 @@ export default {
|
|
historySentRecordList: [], // 单句历史录音list
|
|
historySentRecordList: [], // 单句历史录音list
|
|
ed: undefined,
|
|
ed: undefined,
|
|
showEd: false, //是否看ed的值
|
|
showEd: false, //是否看ed的值
|
|
- historyLoading: false
|
|
|
|
|
|
+ historyLoading: false,
|
|
|
|
+ timeC: null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -340,6 +342,8 @@ export default {
|
|
//方法集合
|
|
//方法集合
|
|
methods: {
|
|
methods: {
|
|
changePlaySent(type){
|
|
changePlaySent(type){
|
|
|
|
+ this.audio.pause();
|
|
|
|
+ this.audioc.pause();
|
|
for(let i=0; i<this.resArr.timeList.length;i++){
|
|
for(let i=0; i<this.resArr.timeList.length;i++){
|
|
if(this.curTime>=this.resArr.timeList[i].s&&this.curTime<this.resArr.timeList[i].e){
|
|
if(this.curTime>=this.resArr.timeList[i].s&&this.curTime<this.resArr.timeList[i].e){
|
|
this.playSentIndex = i
|
|
this.playSentIndex = i
|
|
@@ -395,6 +399,8 @@ export default {
|
|
console.log(this.resArr)
|
|
console.log(this.resArr)
|
|
},
|
|
},
|
|
handleChangeTime(time,ed,flag) {
|
|
handleChangeTime(time,ed,flag) {
|
|
|
|
+ this.audio.pause();
|
|
|
|
+ this.audioc.pause();
|
|
if(flag){
|
|
if(flag){
|
|
this.$refs.audioLine.PlayAudio()
|
|
this.$refs.audioLine.PlayAudio()
|
|
}else{
|
|
}else{
|
|
@@ -428,6 +434,8 @@ export default {
|
|
// 开始录音
|
|
// 开始录音
|
|
microphone() {
|
|
microphone() {
|
|
let _this = this;
|
|
let _this = this;
|
|
|
|
+ this.audio.pause();
|
|
|
|
+ this.audioc.pause();
|
|
if(_this.$refs.audioLine.audio.playing){
|
|
if(_this.$refs.audioLine.audio.playing){
|
|
_this.$refs.audioLine.PlayAudio()
|
|
_this.$refs.audioLine.PlayAudio()
|
|
_this.showEd = false
|
|
_this.showEd = false
|
|
@@ -502,6 +510,7 @@ export default {
|
|
_this.$emit("getMicrophoneStatus", _this.microphoneStatus);
|
|
_this.$emit("getMicrophoneStatus", _this.microphoneStatus);
|
|
},
|
|
},
|
|
playmicrophone(totalTimes) {
|
|
playmicrophone(totalTimes) {
|
|
|
|
+ this.audioc.pause();
|
|
if (this.hasMicro) {
|
|
if (this.hasMicro) {
|
|
this.isPlayings = true;
|
|
this.isPlayings = true;
|
|
if (this.selectIndex || this.selectIndex == 0) {
|
|
if (this.selectIndex || this.selectIndex == 0) {
|
|
@@ -566,6 +575,8 @@ export default {
|
|
lookHistory(index){
|
|
lookHistory(index){
|
|
this.historyFlag = true
|
|
this.historyFlag = true
|
|
this.historyLoading = true
|
|
this.historyLoading = true
|
|
|
|
+ this.audio.pause();
|
|
|
|
+ this.audioc.pause();
|
|
if(this.$refs.audioLine.audio.playing){
|
|
if(this.$refs.audioLine.audio.playing){
|
|
this.$refs.audioLine.PlayAudio()
|
|
this.$refs.audioLine.PlayAudio()
|
|
}
|
|
}
|
|
@@ -602,7 +613,48 @@ export default {
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ // 对比
|
|
|
|
+ compare(){
|
|
|
|
+ let _this = this;
|
|
|
|
+ let curTime = _this.resArr.timeList[_this.playSentIndex].s
|
|
|
|
+ for(let i=0; i<this.resArr.timeList.length;i++){
|
|
|
|
+ if(curTime>=this.resArr.timeList[i].s&&curTime<this.resArr.timeList[i].e){
|
|
|
|
+ this.playSentIndex = i
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let playSentIndex = _this.playSentIndex
|
|
|
|
+ if(this.playSentIndex===-1){
|
|
|
|
+ this.$message.warning('请先选择要对比的句子')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(!this.wavblob){
|
|
|
|
+ this.$message.warning('请先录音')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.audio.pause()
|
|
|
|
+ if (!this.audioc.paused) {
|
|
|
|
+ this.audioc.pause();
|
|
|
|
+ } else {
|
|
|
|
+ _this.audioc.pause();
|
|
|
|
+ _this.audioc.load();
|
|
|
|
+ _this.curTime = _this.resArr.timeList[playSentIndex].s
|
|
|
|
+ _this.handleChangeTime(_this.resArr.timeList[playSentIndex].s,_this.resArr.timeList[playSentIndex].e)
|
|
|
|
+ console.log(playSentIndex)
|
|
|
|
+ _this.timeC = setInterval(() => {
|
|
|
|
+ if(_this.curTime>=_this.resArr.timeList[playSentIndex].e){
|
|
|
|
+ clearInterval(_this.timeC)
|
|
|
|
+ _this.playWavdata()
|
|
|
|
+ }
|
|
|
|
+ }, 500);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ playWavdata(){
|
|
|
|
+ let _this = this;
|
|
|
|
+ _this.audioc.src = _this.wavblob;
|
|
|
|
+ _this.audioc.play();
|
|
|
|
+ },
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {},
|
|
created() {},
|
|
@@ -616,7 +668,9 @@ export default {
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
beforeUpdate() {}, //生命周期 - 更新之前
|
|
beforeUpdate() {}, //生命周期 - 更新之前
|
|
updated() {}, //生命周期 - 更新之后
|
|
updated() {}, //生命周期 - 更新之后
|
|
- beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
|
|
|
+ beforeDestroy() {
|
|
|
|
+ clearInterval(this.timeC)
|
|
|
|
+ }, //生命周期 - 销毁之前
|
|
destroyed() {}, //生命周期 - 销毁完成
|
|
destroyed() {}, //生命周期 - 销毁完成
|
|
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
};
|
|
};
|