|
|
@@ -272,11 +272,13 @@ export default {
|
|
|
audioStart() {
|
|
|
this.onStartRecordWithMicrosoft();
|
|
|
},
|
|
|
- toggleRecording() {
|
|
|
- return new Promise(resolve => {
|
|
|
+ async toggleRecording() {
|
|
|
+ return new Promise(async resolve => {
|
|
|
if (this.recordedForm.status == 1) {
|
|
|
// 检查录音时间是否至少为5秒
|
|
|
- const now = new Date();
|
|
|
+ const now = new Date(await this.getServerTime());
|
|
|
+ console.log('now', now)
|
|
|
+ console.log('recordingStartTime',this.recordingStartTime)
|
|
|
const duration = (now - new Date(this.recordingStartTime)) / 1000;
|
|
|
if (duration < 5) {
|
|
|
this.$message.warning(this.lang.ssRecordingTimeAtLeast5Seconds);
|
|
|
@@ -321,10 +323,12 @@ export default {
|
|
|
// });
|
|
|
|
|
|
} else {
|
|
|
- const now = new Date();
|
|
|
+ console.log('recordingEndTime',this.recordingEndTime)
|
|
|
+ const now = new Date(await this.getServerTime());
|
|
|
+ console.log('now', now)
|
|
|
const duration = (now - new Date(this.recordingEndTime)) / 1000;
|
|
|
if (duration < 5) {
|
|
|
- this.$message.warning('录音时间至少间距5秒');
|
|
|
+ this.$message.warning(this.lang.ssRecordingTimeAtLeast5Seconds);
|
|
|
return;
|
|
|
}
|
|
|
this.onStartRecordWithMicrosoft();
|
|
|
@@ -334,7 +338,7 @@ export default {
|
|
|
// })
|
|
|
},
|
|
|
// ============ start 微软录音转译
|
|
|
- onStartRecordWithMicrosoft() {
|
|
|
+ async onStartRecordWithMicrosoft() {
|
|
|
let iiframe = this.$refs["iiframe"];
|
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
|
"languageOptions"
|
|
|
@@ -345,10 +349,7 @@ export default {
|
|
|
console.log("开始录音", iiframe);
|
|
|
this.recordedForm.status = 1;
|
|
|
// 记录开始录音时间
|
|
|
- this.recordingStartTime = new Date().toLocaleString("zh-CN", {
|
|
|
- hour12: false,
|
|
|
- timeZone: "Asia/Shanghai"
|
|
|
- }).replace(/\//g, "-");
|
|
|
+ this.recordingStartTime = await this.getServerTime();
|
|
|
iiframe.contentWindow.window.onRecognizedResult = e => {
|
|
|
console.log("onRecognizedResult", e);
|
|
|
this.recordedForm.endTime = this.recordedForm.timeDuration;
|