|
@@ -522,7 +522,8 @@ export default {
|
|
|
time: "00:00:00", //时间
|
|
|
status: 0, //0--未录音 1--正在录音 2--暂停 3--录音结束
|
|
|
timer:null,
|
|
|
- timeDuration:0
|
|
|
+ timeDuration:0,
|
|
|
+ audioBlob:null,
|
|
|
},
|
|
|
roleList: [],
|
|
|
publicRoleList: [],
|
|
@@ -621,7 +622,7 @@ export default {
|
|
|
"请上传.wav,.txt,.pdf,.xlsx,.doc,.docx格式的文件"
|
|
|
);
|
|
|
}
|
|
|
- this.uploadFile(file);
|
|
|
+ this.uploadFile(file,{changeText:true,flag:true,});
|
|
|
// this.uploadWavFileAndGetText(file);
|
|
|
};
|
|
|
},
|
|
@@ -690,29 +691,35 @@ export default {
|
|
|
});
|
|
|
} else if (this.controlsStatus != 1 && this.recordedForm.status == 0) {
|
|
|
let iiframe = this.$refs["iiframe"];
|
|
|
- iiframe.contentWindow.testdoContinuousPronunciationAssessment();
|
|
|
+ // iiframe.contentWindow.testdoContinuousPronunciationAssessment();
|
|
|
this.controlsStatus = 1;
|
|
|
this.recordedForm.status = 1;
|
|
|
this.$message.success("已开始录音");
|
|
|
- textList = [];
|
|
|
+ let flag = true;
|
|
|
+ let textList = [];
|
|
|
this.recordedForm.timeDuration = 0;
|
|
|
- iiframe.contentWindow.onRecognizedResult = function (e) {
|
|
|
+ // 录音开始
|
|
|
+ iiframe.contentWindow.onRecognizedResult = (e) => {
|
|
|
+ // let e = {
|
|
|
+ // privText:"测试测试"
|
|
|
+ // }
|
|
|
if (flag) {
|
|
|
- _this.controlsStatus = 2;
|
|
|
- _this.showIndexPage = false;
|
|
|
- _this.pageStatus = 1;
|
|
|
- _this.editorBarData.type = "0";
|
|
|
+ // this.controlsStatus = 1;
|
|
|
+ this.showIndexPage = false;
|
|
|
+ this.pageStatus = 1;
|
|
|
+ this.editorBarData.type = "0";
|
|
|
flag = false;
|
|
|
- _this.uploadFileLoading = false;
|
|
|
- _this.transcriptionData.content = "";
|
|
|
- _this.editorBarData.content = "";
|
|
|
+ this.uploadFileLoading = false;
|
|
|
+ this.transcriptionData.content = "";
|
|
|
+ this.editorBarData.content = "";
|
|
|
textList = [];
|
|
|
- _this.recordedForm.timer = setInterval(()=>{
|
|
|
- _this.recordedForm.timeDuration+=1000;
|
|
|
- _this.updateRecordedTime({duration:_this.recordedForm.timeDuration})
|
|
|
+ this.recordedForm.timer = setInterval(()=>{
|
|
|
+ this.recordedForm.timeDuration+=1;
|
|
|
+ this.updateRecordedTime({duration:this.recordedForm.timeDuration})
|
|
|
+ console.log(this.recordedForm)
|
|
|
},1000)
|
|
|
}
|
|
|
- _this.showGetTextLoading = true;
|
|
|
+ this.showGetTextLoading = true;
|
|
|
let privText = e.privText;
|
|
|
console.log("👇转译对象👇");
|
|
|
console.log(e);
|
|
@@ -724,7 +731,7 @@ export default {
|
|
|
endTime: "",
|
|
|
time: "",
|
|
|
});
|
|
|
- _this.transcriptionData.content += privText;
|
|
|
+ this.transcriptionData.content += privText;
|
|
|
|
|
|
let _result = `
|
|
|
<table
|
|
@@ -768,45 +775,16 @@ export default {
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>`;
|
|
|
- _this.editorBarData.content = _result;
|
|
|
+ this.editorBarData.content = _result;
|
|
|
};
|
|
|
|
|
|
- // recorder.initRecorder(); //初始化录音
|
|
|
- // recorder.destroy(); // 销毁录音
|
|
|
- // // 开始录音
|
|
|
- // recorder.start().then(
|
|
|
- // () => {
|
|
|
- // this.controlsStatus = 1;
|
|
|
- // this.recordedForm.status = 1;
|
|
|
- // recorder.onprogress = this.updateRecordedTime;
|
|
|
- // this.$message.success("录音已开始");
|
|
|
- // },
|
|
|
- // (error) => {
|
|
|
- // this.controlsStatus = 0;
|
|
|
- // this.recordedForm.status = 0;
|
|
|
- // // _this.$message.error(`${error.name} : ${error.message}`);
|
|
|
- // this.$message.error(
|
|
|
- // `没有找到可使用的麦克风,或者您没有允许此网页使用麦克风`
|
|
|
- // );
|
|
|
- // // 出错了
|
|
|
- // console.log(`${error.name} : ${error.message}`);
|
|
|
- // // if (_this.calcTimer) {
|
|
|
- // // clearInterval(_this.calcTimer)
|
|
|
- // // _this.calcTimer = null;
|
|
|
- // // }
|
|
|
- // }
|
|
|
- // );
|
|
|
+
|
|
|
} else if ([1, 2].includes(this.recordedForm.status)) {
|
|
|
this.controlsStatus = 1;
|
|
|
this.$message.info("还在录音中");
|
|
|
}
|
|
|
// this.controlsStatus = 1;
|
|
|
},
|
|
|
- // 录音中
|
|
|
- isRecorded(e) {
|
|
|
- console.log("录音中");
|
|
|
- console.log(e);
|
|
|
- },
|
|
|
updateRecordedTime({ duration }) {
|
|
|
// 更新currentTime,将秒数转换为时分秒格式
|
|
|
let hours = Math.floor(duration / 3600);
|
|
@@ -832,9 +810,22 @@ export default {
|
|
|
// this.TapeNum = 0;
|
|
|
// },
|
|
|
async finishRecorded() {
|
|
|
- this.recordedForm.status = 3;
|
|
|
- this.$message.success("已借宿录音")
|
|
|
- clearInterval(this.recordedForm.timer);
|
|
|
+ let iiframe = this.$refs["iiframe"];
|
|
|
+ iiframe.contentWindow.window.document.getElementById(
|
|
|
+ "scenarioStopButton"
|
|
|
+ ).click()
|
|
|
+ // 录音借宿
|
|
|
+ iiframe.contentWindow.sessionStopped = (s,e)=>{
|
|
|
+ this.recordedForm.status = 3;
|
|
|
+ this.controlsStatus = 2;
|
|
|
+ this.$message.success("已结束录音")
|
|
|
+ clearInterval(this.recordedForm.timer);
|
|
|
+ console.log("结束录音👇")
|
|
|
+ console.log("结束录音",e);
|
|
|
+ this.recordedForm.audioBlob = e.preaudio;
|
|
|
+ this.uploadFile(this.recordedForm.audioBlob,{changeText:false,flag:true})
|
|
|
+ }
|
|
|
+
|
|
|
// this.uploadFileLoading = true;
|
|
|
// recorder.stop();
|
|
|
// this.$message.success("已结束录音");
|
|
@@ -857,7 +848,7 @@ export default {
|
|
|
this.recordedForm.status = 1;
|
|
|
this.$message.success("已开始录音")
|
|
|
this.recordedForm.timer = setInterval(() => {
|
|
|
- this.recordedForm.timeDuration+=1000,
|
|
|
+ this.recordedForm.timeDuration+=1,
|
|
|
this.updateRecordedTime({duration:this.recordedForm.timeDuration});
|
|
|
}, 1000);
|
|
|
}
|
|
@@ -1274,7 +1265,9 @@ export default {
|
|
|
files: [audioFile],
|
|
|
});
|
|
|
},
|
|
|
- uploadFile(file, flag = true) {
|
|
|
+ uploadFile(file,{changeText=true,flag=true}) {
|
|
|
+ console.log('👇')
|
|
|
+ console.log(changeText,flag)
|
|
|
var credentials = {
|
|
|
accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
@@ -1336,7 +1329,7 @@ export default {
|
|
|
// } else if(otherRegex.test(data.Location)){
|
|
|
//
|
|
|
if (audioRegex.test(data.Location)) {
|
|
|
- _this.wavFileGetText(file);
|
|
|
+ if(changeText)_this.wavFileGetText(file);
|
|
|
_this.$emit("changeAudioUrl", data);
|
|
|
_this.loading = false;
|
|
|
_this.progressData.uploadLoading = false;
|
|
@@ -1591,7 +1584,7 @@ export default {
|
|
|
var blob = new Blob([text], { type: "text/plain;charset=utf-8" });
|
|
|
blob.lastModifiedDate = new Date();
|
|
|
blob.name = `${this.tid}-classroomObservation.txt`;
|
|
|
- return this.uploadFile(blob, false);
|
|
|
+ return this.uploadFile(blob, {changeText:false,flag:false});
|
|
|
} else {
|
|
|
// this.loading = true;
|
|
|
// let div = document.createElement("div");
|
|
@@ -1696,7 +1689,7 @@ export default {
|
|
|
},
|
|
|
// 转录文稿修改
|
|
|
changeEditor(val) {
|
|
|
- console.log(val);
|
|
|
+ // console.log(val);
|
|
|
// this.editorBarData.content = val;
|
|
|
// console.log(this.editorBarData)
|
|
|
this.$forceUpdate();
|