|
@@ -521,12 +521,12 @@ export default {
|
|
|
recordedForm: {
|
|
|
time: "00:00:00", //时间
|
|
|
status: 0, //0--未录音 1--正在录音 2--暂停 3--录音结束
|
|
|
- timer:null,
|
|
|
- timeDuration:0,
|
|
|
- audioBlob:[],
|
|
|
- startTime:0,
|
|
|
- endTime:0,
|
|
|
- textList:[],
|
|
|
+ timer: null,
|
|
|
+ timeDuration: 0,
|
|
|
+ audioBlob: [],
|
|
|
+ startTime: 0,
|
|
|
+ endTime: 0,
|
|
|
+ textList: [],
|
|
|
},
|
|
|
roleList: [],
|
|
|
publicRoleList: [],
|
|
@@ -625,7 +625,7 @@ export default {
|
|
|
"请上传.wav,.txt,.pdf,.xlsx,.doc,.docx格式的文件"
|
|
|
);
|
|
|
}
|
|
|
- this.uploadFile(file,{changeText:true,flag:true,});
|
|
|
+ this.uploadFile(file, { changeText: true, flag: true });
|
|
|
// this.uploadWavFileAndGetText(file);
|
|
|
};
|
|
|
},
|
|
@@ -701,12 +701,13 @@ export default {
|
|
|
this.controlsStatus = 1;
|
|
|
this.recordedForm.status = 1;
|
|
|
this.$message.success("已开始录音");
|
|
|
- this.recordedForm.timer = setInterval(()=>{
|
|
|
- this.recordedForm.timeDuration+=1;
|
|
|
- this.recordedForm.endTime = this.recordedForm.timeDuration;
|
|
|
- this.recordedForm.time = this.updateRecordedTime({duration:this.recordedForm.timeDuration})
|
|
|
- console.log(this.recordedForm)
|
|
|
- },1000)
|
|
|
+ this.recordedForm.timer = setInterval(() => {
|
|
|
+ this.recordedForm.timeDuration += 1;
|
|
|
+ this.recordedForm.time = this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.timeDuration,
|
|
|
+ });
|
|
|
+ console.log(this.recordedForm);
|
|
|
+ }, 1000);
|
|
|
let flag = true;
|
|
|
this.recordedForm.textList = [];
|
|
|
this.recordedForm.timeDuration = 0;
|
|
@@ -719,7 +720,7 @@ export default {
|
|
|
// }
|
|
|
this.recordedForm.endTime = this.recordedForm.timeDuration;
|
|
|
if (flag) {
|
|
|
- // this.controlsStatus = 1;
|
|
|
+ this.controlsStatus = 1;
|
|
|
this.showIndexPage = false;
|
|
|
this.pageStatus = 1;
|
|
|
this.editorBarData.type = "0";
|
|
@@ -731,18 +732,24 @@ export default {
|
|
|
}
|
|
|
this.showGetTextLoading = true;
|
|
|
let privText = e.privText;
|
|
|
- if(privText == undefined || privText == "undefined")return;
|
|
|
+ if (privText == undefined || privText == "undefined") return;
|
|
|
console.log("👇转译对象👇");
|
|
|
console.log(e);
|
|
|
console.log("👇转译结果👇");
|
|
|
console.log(privText);
|
|
|
this.recordedForm.textList.push({
|
|
|
value: privText,
|
|
|
- startTime: this.updateRecordedTime({duration:this.recordedForm.startTime}),
|
|
|
- endTime: this.updateRecordedTime({duration:this.recordedForm.endTime}),
|
|
|
- time: this.updateRecordedTime({duration:(this.recordedForm.endTime-this.recordedForm.startTime)}),
|
|
|
+ startTime: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.startTime,
|
|
|
+ }),
|
|
|
+ endTime: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.endTime,
|
|
|
+ }),
|
|
|
+ time: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.endTime - this.recordedForm.startTime,
|
|
|
+ }),
|
|
|
});
|
|
|
- this.recordedForm.startTime = this.recordedForm.timeDuration+1;
|
|
|
+ this.recordedForm.startTime = this.recordedForm.timeDuration + 1;
|
|
|
this.transcriptionData.content += privText;
|
|
|
|
|
|
let _result = `
|
|
@@ -789,8 +796,6 @@ export default {
|
|
|
</table>`;
|
|
|
this.editorBarData.content = _result;
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
} else if ([1, 2].includes(this.recordedForm.status)) {
|
|
|
this.controlsStatus = 1;
|
|
|
this.$message.info("还在录音中");
|
|
@@ -805,7 +810,7 @@ export default {
|
|
|
// this.recordedForm.time = `${hours.toString().padStart(2, "0")}:${minutes
|
|
|
// .toString()
|
|
|
// .padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
|
|
|
- return `${hours.toString().padStart(2, "0")}:${minutes
|
|
|
+ return `${hours.toString().padStart(2, "0")}:${minutes
|
|
|
.toString()
|
|
|
.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
|
|
|
},
|
|
@@ -826,26 +831,27 @@ export default {
|
|
|
// },
|
|
|
async finishRecorded() {
|
|
|
let iiframe = this.$refs["iiframe"];
|
|
|
- iiframe.contentWindow.window.document.getElementById(
|
|
|
- "scenarioStopButton"
|
|
|
- ).click()
|
|
|
+ iiframe.contentWindow.window.document
|
|
|
+ .getElementById("scenarioStopButton")
|
|
|
+ .click();
|
|
|
// 录音借宿
|
|
|
- iiframe.contentWindow.onSessionStopped = (s,e)=>{
|
|
|
+ iiframe.contentWindow.onSessionStopped = (s, e) => {
|
|
|
this.recordedForm.status = 3;
|
|
|
this.controlsStatus = 2;
|
|
|
- this.$message.success("已结束录音")
|
|
|
+ this.$message.success("已结束录音");
|
|
|
clearInterval(this.recordedForm.timer);
|
|
|
- console.log("结束录音👇")
|
|
|
- console.log("结束录音",e);
|
|
|
+ console.log("结束录音👇");
|
|
|
+ console.log("结束录音", e);
|
|
|
this.recordedForm.audioBlob.push(e.preaudio);
|
|
|
- let blob = new Blob(this.recordedForm.audioBlob,{
|
|
|
- type: 'audio/wav',
|
|
|
- })
|
|
|
- let file = new File([blob],'recordedFile.wav',{type:"text/plain"})
|
|
|
- this.uploadFile(file,{changeText:false,flag:true})
|
|
|
+ let blob = new Blob(this.recordedForm.audioBlob, {
|
|
|
+ type: "audio/wav",
|
|
|
+ });
|
|
|
+ let file = new File([blob], "recordedFile.wav", { type: "text/plain" });
|
|
|
+ this.uploadFile(file, { changeText: false, flag: true });
|
|
|
iiframe.contentWindow.onSessionStopped = null;
|
|
|
- }
|
|
|
-
|
|
|
+ iiframe.contentWindow.onRecognizedResult = null;
|
|
|
+ };
|
|
|
+
|
|
|
// this.uploadFileLoading = true;
|
|
|
// recorder.stop();
|
|
|
// this.$message.success("已结束录音");
|
|
@@ -860,19 +866,137 @@ export default {
|
|
|
// this.uploadWavFileAndGetText(audioFile);
|
|
|
},
|
|
|
stopRecorded() {
|
|
|
- if(this.recordedForm.status==1){//暂停
|
|
|
- this.recordedForm.status = 2;
|
|
|
- clearInterval(this.recordedForm.timer)
|
|
|
- this.$message.success("已暂停录音")
|
|
|
- }else if(this.recordedForm.status==2){//开始
|
|
|
+ if (this.recordedForm.status == 1) {
|
|
|
+ //暂停
|
|
|
+ let iiframe = this.$refs["iiframe"];
|
|
|
+ iiframe.contentWindow.window.document
|
|
|
+ .getElementById("scenarioStopButton")
|
|
|
+ .click();
|
|
|
+ // 录音借宿
|
|
|
+ iiframe.contentWindow.onSessionStopped = (s, e) => {
|
|
|
+ this.recordedForm.status = 2;
|
|
|
+
|
|
|
+ this.$message.success("已停止录音");
|
|
|
+ clearInterval(this.recordedForm.timer);
|
|
|
+ console.log("停止录音👇");
|
|
|
+ console.log("停止录音", e);
|
|
|
+ this.recordedForm.audioBlob.push(e.preaudio);
|
|
|
+ iiframe.contentWindow.onSessionStopped = null;
|
|
|
+ iiframe.contentWindow.onRecognizedResult = null;
|
|
|
+ };
|
|
|
+ // this.recordedForm.status = 2;
|
|
|
+ // clearInterval(this.recordedForm.timer)
|
|
|
+ // this.$message.success("已暂停录音")
|
|
|
+ } else if (this.recordedForm.status == 2) {
|
|
|
+ //开始
|
|
|
+ let iiframe = this.$refs["iiframe"];
|
|
|
+ iiframe.contentWindow.window.document.getElementById(
|
|
|
+ "languageOptions"
|
|
|
+ ).selectedIndex = 2;
|
|
|
+ iiframe.contentWindow.testdoContinuousPronunciationAssessment();
|
|
|
+ this.controlsStatus = 1;
|
|
|
this.recordedForm.status = 1;
|
|
|
- this.$message.success("已开始录音")
|
|
|
+ this.$message.success("已开始录音");
|
|
|
this.recordedForm.timer = setInterval(() => {
|
|
|
- this.recordedForm.timeDuration+=1,
|
|
|
-
|
|
|
- this.recordedForm.time = this.updateRecordedTime({duration:this.recordedForm.timeDuration});
|
|
|
+ this.recordedForm.timeDuration += 1;
|
|
|
+ this.recordedForm.time = this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.timeDuration,
|
|
|
+ });
|
|
|
}, 1000);
|
|
|
- }
|
|
|
+ // let flag = false;
|
|
|
+ // this.recordedForm.textList = [];
|
|
|
+ // this.recordedForm.timeDuration = 0;
|
|
|
+ // this.recordedForm.startTime = 1;
|
|
|
+ // this.recordedForm.endTime = 0;
|
|
|
+ // 录音开始
|
|
|
+ iiframe.contentWindow.onRecognizedResult = (e) => {
|
|
|
+ // let e = {
|
|
|
+ // privText:"测试测试"
|
|
|
+ // }
|
|
|
+ this.recordedForm.endTime = this.recordedForm.timeDuration;
|
|
|
+ // if (flag) {
|
|
|
+ // // 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.recordedForm.textList = [];
|
|
|
+ // }
|
|
|
+ this.showGetTextLoading = true;
|
|
|
+ let privText = e.privText;
|
|
|
+ if (privText == undefined || privText == "undefined") return;
|
|
|
+ console.log("👇转译对象👇");
|
|
|
+ console.log(e);
|
|
|
+ console.log("👇转译结果👇");
|
|
|
+ console.log(privText);
|
|
|
+ this.recordedForm.textList.push({
|
|
|
+ value: privText,
|
|
|
+ startTime: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.startTime,
|
|
|
+ }),
|
|
|
+ endTime: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.endTime,
|
|
|
+ }),
|
|
|
+ time: this.updateRecordedTime({
|
|
|
+ duration: this.recordedForm.endTime - this.recordedForm.startTime,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ this.recordedForm.startTime = this.recordedForm.timeDuration + 1;
|
|
|
+ this.transcriptionData.content += privText;
|
|
|
+
|
|
|
+ let _result = `
|
|
|
+ <table
|
|
|
+ border="0"
|
|
|
+ width="100%"
|
|
|
+ cellpadding="0"
|
|
|
+ cellspacing="0"
|
|
|
+ style="text-align: center"
|
|
|
+ >
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th>序号</th>
|
|
|
+ <th>开始时间</th>
|
|
|
+ <th>结束时间</th>
|
|
|
+ <th>发言内容</th>
|
|
|
+ <th>时长</th>
|
|
|
+ <th>说话人身份</th>
|
|
|
+ <th>行为编码</th>
|
|
|
+ </tr>
|
|
|
+ `;
|
|
|
+ this.recordedForm.textList.forEach((item, index) => {
|
|
|
+ _result += `<tr>
|
|
|
+ <td>${index + 1}</td>
|
|
|
+ <td>${item.startTime}</td>
|
|
|
+ <td>${item.endTime}</td>
|
|
|
+ <td>${item.value}</td>
|
|
|
+ <td>${item.time}</td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>`;
|
|
|
+ });
|
|
|
+ _result += `
|
|
|
+ <tr>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>`;
|
|
|
+ this.editorBarData.content = _result;
|
|
|
+ };
|
|
|
+ // this.$message.success("已开始录音")
|
|
|
+ // this.recordedForm.timer = setInterval(() => {
|
|
|
+ // this.recordedForm.timeDuration+=1,
|
|
|
+ // this.recordedForm.time = this.updateRecordedTime({duration:this.recordedForm.timeDuration});
|
|
|
+ // }, 1000);
|
|
|
+ }
|
|
|
// if (!recorder.ispause) {
|
|
|
// recorder.pause();
|
|
|
// this.recordedForm.status = 2;
|
|
@@ -1286,9 +1410,7 @@ export default {
|
|
|
files: [audioFile],
|
|
|
});
|
|
|
},
|
|
|
- uploadFile(file,{changeText=true,flag=true}) {
|
|
|
- console.log('👇')
|
|
|
- console.log(changeText,flag)
|
|
|
+ uploadFile(file, { changeText = true, flag = true }) {
|
|
|
var credentials = {
|
|
|
accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
@@ -1350,14 +1472,15 @@ export default {
|
|
|
// } else if(otherRegex.test(data.Location)){
|
|
|
//
|
|
|
if (audioRegex.test(data.Location)) {
|
|
|
- if(changeText)_this.wavFileGetText(file);
|
|
|
+ if (changeText) _this.wavFileGetText(file);
|
|
|
_this.$emit("changeAudioUrl", data);
|
|
|
_this.loading = false;
|
|
|
_this.recordedForm.audioBlob = [];
|
|
|
- _this.recordedForm.time = "00:00:00"
|
|
|
+ _this.recordedForm.time = "00:00:00";
|
|
|
_this.recordedForm.timeDuration = 0;
|
|
|
_this.progressData.uploadLoading = false;
|
|
|
- _this.saveEditorBar()
|
|
|
+ _this.recordedForm.textList = [];
|
|
|
+ _this.saveEditorBar();
|
|
|
return;
|
|
|
}
|
|
|
_this.ajax
|
|
@@ -1609,7 +1732,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, {changeText:false,flag:false});
|
|
|
+ return this.uploadFile(blob, { changeText: false, flag: false });
|
|
|
} else {
|
|
|
// this.loading = true;
|
|
|
// let div = document.createElement("div");
|