SanHQin hace 10 meses
padre
commit
5e495e5c75
Se han modificado 1 ficheros con 26 adiciones y 15 borrados
  1. 26 15
      src/components/pages/classroomObservation/components/chatArea.vue

+ 26 - 15
src/components/pages/classroomObservation/components/chatArea.vue

@@ -524,6 +524,9 @@ export default {
 				timer:null,
 				timeDuration:0,
 				audioBlob:[],
+				startTime:0,
+				endTime:0,
+				textList:[],
 			},
 			roleList: [],
 			publicRoleList: [],
@@ -700,11 +703,12 @@ export default {
 				this.$message.success("已开始录音");
 				this.recordedForm.timer = setInterval(()=>{
 					this.recordedForm.timeDuration+=1;
-					this.updateRecordedTime({duration:this.recordedForm.timeDuration})
+					this.recordedForm.endTime = this.recordedForm.timeDuration;
+					this.recordedForm.time = this.updateRecordedTime({duration:this.recordedForm.timeDuration})
 					console.log(this.recordedForm)
 				},1000)
 				let flag = true;
-				let textList = [];
+				this.recordedForm.textList = [];
 				this.recordedForm.timeDuration = 0;
 				// 录音开始
 				iiframe.contentWindow.onRecognizedResult = (e) => {
@@ -720,20 +724,22 @@ export default {
 						this.uploadFileLoading = false;
 						this.transcriptionData.content = "";
 						this.editorBarData.content = "";
-						textList = [];
+						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);
-					textList.push({
+					this.recordedForm.textList.push({
 						value: privText,
-						startTime: "",
-						endTime: "",
-						time: "",
+						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;
 					this.transcriptionData.content += privText;
 
 					let _result = `
@@ -755,13 +761,13 @@ export default {
 									<th>行为编码</th>
 							</tr>
 					`;
-					textList.forEach((item, index) => {
+					this.recordedForm.textList.forEach((item, index) => {
 						_result += `<tr>
 								<td>${index + 1}</td>
-								<td></td>
-								<td></td>
+								<td>${item.startTime}</td>
+								<td>${item.endTime}</td>
 								<td>${item.value}</td>
-								<td></td>
+								<td>${item.time}</td>
 								<td></td>
 								<td></td>
 							</tr>`;
@@ -793,7 +799,10 @@ export default {
 			let hours = Math.floor(duration / 3600);
 			let minutes = Math.floor((duration % 3600) / 60);
 			let seconds = Math.floor(duration % 60);
-			this.recordedForm.time = `${hours.toString().padStart(2, "0")}:${minutes
+			// 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
 				.toString()
 				.padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
 		},
@@ -827,9 +836,9 @@ export default {
 				console.log("结束录音",e);
 				this.recordedForm.audioBlob.push(e.preaudio);
 				let blob = new Blob(this.recordedForm.audioBlob,{
-					type: 'audio/mp3',
+					type: 'audio/wav',
 				})
-				let file = new File([blob],'recordedFile',{type:"text/plain"})
+				let file = new File([blob],'recordedFile.wav',{type:"text/plain"})
 				this.uploadFile(file,{changeText:false,flag:true})
 				iiframe.contentWindow.onSessionStopped = null;
 			}
@@ -857,7 +866,8 @@ export default {
 				this.$message.success("已开始录音")
 				this.recordedForm.timer = setInterval(() => {
 					this.recordedForm.timeDuration+=1,
-					this.updateRecordedTime({duration:this.recordedForm.timeDuration});
+					this.recordedForm.endTime = this.recordedForm.timeDuration;
+					this.recordedForm.time = this.updateRecordedTime({duration:this.recordedForm.timeDuration});
 				}, 1000);
 			} 
 			// if (!recorder.ispause) {
@@ -1344,6 +1354,7 @@ export default {
 								_this.recordedForm.time = "00:00:00"
 								_this.recordedForm.timeDuration = 0;
 								_this.progressData.uploadLoading = false;
+								_this.saveEditorBar()
 								return;
 							}
 							_this.ajax