修改语音掉线

This commit is contained in:
田岩
2025-09-17 22:30:31 +08:00
parent 1f27e0ebf5
commit 0d708632ea
6 changed files with 44 additions and 23 deletions
-1
View File
@@ -206,7 +206,6 @@
// 赋值显示
console.log('displayTime', displayTime);
voiceTime.value = displayTime + 's';
console.log('displayTime', voiceTime.value);
});
watch(
() => props.dataInfo.voicePath,
+14 -6
View File
@@ -148,6 +148,7 @@
};
// 结束录音
const stopRecord = (status = false) => {
console.log('结束录音stopRecord', status);
if (props.isDisabled) return;
if (startTimer.value) {
clearTimeout(startTimer.value);
@@ -162,10 +163,12 @@
const times = Math.max(500 - endTime + startTime, 0);
setTimeout(() => {
console.log('延迟数据', times);
nextTick(() => {
popupRef.value.close();
recorderManager.stop();
});
// nextTick(() => {
// });
popupRef.value.close();
console.log('停止录音');
recorderManager.stop();
}, times);
}
nextTick(() => (recordingStatus.value = 'not_started'));
@@ -181,13 +184,18 @@
console.log('说话时长', recordDuration);
if (props.minRecordDuration > recordDuration) {
nextTick(() => common.msg('说话时间太短,没有听清!'));
// console.log('说话时间太短,没有听清');
return;
}
stopRecord(true); // 在去主动执行一次关闭
popupRef.value?.close();
recordingStatus.value = 'not_started'
// stopRecord(true); // 在去主动执行一次关闭
console.log('录音结束,时长:', recordDuration, '秒');
emit('submit', 'voice', res.tempFilePath);
});
recorderManager.onError(function (err) {
console.log('录音错误', err);
});
recorderManager.onStart(function (res) {
// 检测是否已经抬手结束了
console.log('检测是否已经抬手结束了', recordingStatus.value);