|
@@ -200,7 +200,7 @@
|
|
|
key="sent-repeatAfter">
|
|
|
</el-switch>
|
|
|
</div>
|
|
|
- <div class="item" v-if="repeatAfter">
|
|
|
+ <div class="item">
|
|
|
<span>单句模式</span>
|
|
|
<el-switch
|
|
|
v-model="singleModel"
|
|
@@ -210,7 +210,7 @@
|
|
|
@change="mutualExclusive('singleModel','autoNextSent')">
|
|
|
</el-switch>
|
|
|
</div>
|
|
|
- <div class="item" v-if="repeatAfter">
|
|
|
+ <div class="item">
|
|
|
<span>自动下一句</span>
|
|
|
<el-switch
|
|
|
v-model="autoNextSent"
|
|
@@ -319,7 +319,8 @@ export default {
|
|
|
ed: undefined,
|
|
|
showEd: false, //是否看ed的值
|
|
|
historyLoading: false,
|
|
|
- timeC: null
|
|
|
+ timeC: null,
|
|
|
+ isCompare: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -344,12 +345,7 @@ export default {
|
|
|
changePlaySent(type){
|
|
|
this.audio.pause();
|
|
|
this.audioc.pause();
|
|
|
- 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){
|
|
|
- this.playSentIndex = i
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if(type==='-'){
|
|
|
if(this.playSentIndex>0){
|
|
|
this.playSentIndex--
|
|
@@ -366,7 +362,24 @@ export default {
|
|
|
this.handleChangeTime(this.resArr.timeList[this.playSentIndex].s)
|
|
|
},
|
|
|
getCurTime(curTime) {
|
|
|
- this.curTime = curTime * 1000;
|
|
|
+ if(this.isCompare){
|
|
|
+ let time = curTime * 1000;
|
|
|
+ if (time >= this.resArr.timeList[this.playSentIndex].e || time <= this.resArr.timeList[this.playSentIndex].s) {
|
|
|
+ // this.curTime = this.resArr.timeList[this.playSentIndex].s;
|
|
|
+ // this.$refs.audioLine.onTimeupdateTime(_this.currSent.bg / 1000, true);
|
|
|
+ } else {
|
|
|
+ this.curTime = curTime * 1000;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.curTime = curTime * 1000;
|
|
|
+ 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){
|
|
|
+ this.playSentIndex = i
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
returnCurrentTime(){
|
|
|
return this.curTime
|
|
@@ -465,12 +478,6 @@ export default {
|
|
|
_this.recordFile++;
|
|
|
_this.selectIndex = _this.recordList.length - 1;
|
|
|
} else {
|
|
|
- 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){
|
|
|
- this.playSentIndex = i
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
this.hasMicro = "normal";
|
|
|
this.recorder.stop();
|
|
|
clearInterval(_this.timer);
|
|
@@ -617,15 +624,16 @@ export default {
|
|
|
// 对比
|
|
|
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.isCompare = true
|
|
|
+ // 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 = JSON.parse(JSON.stringify(_this.playSentIndex))
|
|
|
+ if(playSentIndex===-1){
|
|
|
this.$message.warning('请先选择要对比的句子')
|
|
|
return
|
|
|
}
|
|
@@ -639,11 +647,11 @@ export default {
|
|
|
} 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){
|
|
|
+ if(_this.curTime>=_this.resArr.timeList[playSentIndex].e - 250){
|
|
|
+ _this.curTime = _this.resArr.timeList[playSentIndex].s
|
|
|
clearInterval(_this.timeC)
|
|
|
_this.playWavdata()
|
|
|
}
|
|
@@ -654,6 +662,9 @@ export default {
|
|
|
let _this = this;
|
|
|
_this.audioc.src = _this.wavblob;
|
|
|
_this.audioc.play();
|
|
|
+ _this.audioc.addEventListener("ended", function () {
|
|
|
+ _this.isCompare = false
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|