修改课程详情页bug

This commit is contained in:
田岩
2025-09-01 16:45:37 +08:00
parent 4789c1d563
commit 4c2859405e
8 changed files with 54 additions and 33 deletions
+8
View File
@@ -126,6 +126,14 @@
const audioStore = useAudioStore();
const { dataInfo } = toRefs(props);
const status = computed(() => props.status);
watch(
() => props.status,
(val) => {
if (val === '') {
textShow.value = false;
}
}
);
const emit = defineEmits(['changePlay', 'buutton_click']);
// 中间显示的文字
+24 -22
View File
@@ -1,11 +1,10 @@
<template>
<view class="talk-btns">
<view class="touch-btn" @click="disabled_click">
<view class="touch-btn" @click="disabled_click">
<uv-button
:disabled="props.isDisabled"
class="touch-btn"
@touchstart="startRecord"
@touchend="stopRecord"
@touchend="stopRecord(false)"
@touchmove="handleMove"
v-if="!keyboardIsShow"
:customStyle="{ height: '92rpx' }"
@@ -135,7 +134,7 @@
const startTimer = ref(null); // 延迟启动的定时器ID
const startFlag = ref(1);
const startRecord = (obj) => {
if(props.isDisabled) return;
if (props.isDisabled) return;
// 开始录音
console.log('开始录音', recordingStatus.value);
if (recordingStatus.value !== 'not_started') return;
@@ -144,33 +143,34 @@
console.log('延迟开始');
recordingStatus.value = 'preparing';
popupRef.value.open();
recorderManager.start({duration:6000});
recorderManager.start({ duration: 120000 });
startTime = Date.now();
setInterval(() => {
const endTime = Date.now();
const recordDuration = (endTime - startTime) / 1000;
console.log('当前录音时间1', recordDuration);
})
}, 1000);
}, 80);
};
// 结束录音
const stopRecord = () => {
if(props.isDisabled) return;
const stopRecord = (status = false) => {
if (props.isDisabled) return;
console.log('结束录音嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻');
if (startTimer.value) {
clearTimeout(startTimer.value);
startTimer.value = null;
}
const endTime = Date.now();
const times = Math.max(500 - endTime + startTime, 0);
setTimeout(() => {
console.log('延迟数据', times);
if (status) {
nextTick(() => {
popupRef.value.close();
recorderManager.stop();
});
}, times);
} else {
const endTime = Date.now();
const times = Math.max(500 - endTime + startTime, 0);
setTimeout(() => {
console.log('延迟数据', times);
nextTick(() => {
popupRef.value.close();
recorderManager.stop();
});
}, times);
}
nextTick(() => (recordingStatus.value = 'not_started'));
};
@@ -187,6 +187,8 @@
nextTick(() => common.msg('说话时间太短,没有听清!'));
return;
}
stopRecord(true); // 在去主动执行一次关闭
console.log('录音结束,时长:', recordDuration, '秒');
emit('submit', 'voice', res.tempFilePath);
});
@@ -196,9 +198,9 @@
if (recordingStatus.value !== 'preparing') {
stopRecord();
}
startTime = Date.now();
recordingStatus.value = 'in_recording';
});
// #endif