This commit is contained in:
2025-08-28 14:47:17 +08:00
parent cc7566905a
commit 7c11c480ff
5 changed files with 34 additions and 499 deletions

View File

@@ -273,32 +273,44 @@ function getDifficultyName(difficulty) {
document.addEventListener('DOMContentLoaded', function() {
// 渲染题目
renderQuestions();
// 添加录音按钮事件绑定
// 修改录音按钮事件绑定代码
const startRecordBtn = document.getElementById('startRecordBtn');
const stopRecordBtn = document.getElementById('stopRecordBtn');
const recordingIndicator = document.getElementById('recordingIndicator');
// 隐藏停止讲话按钮,因为我们不需要它
if (stopRecordBtn) {
stopRecordBtn.style.display = 'none';
}
if (startRecordBtn && stopRecordBtn && recordingIndicator) {
startRecordBtn.addEventListener('click', function() {
// 显示录音指示器
recordingIndicator.style.display = 'block';
// 这里添加实际录音功能逻辑
console.log('开始录音...');
// 示例调用录音API或相关函数
// startRecording();
});
stopRecordBtn.addEventListener('click', function() {
// 隐藏录音指示器
recordingIndicator.style.display = 'none';
// 这里添加停止录音功能逻辑
console.log('停止录音...');
// 示例:停止录音并处理音频
// stopRecording();
});
// 点击"帮我讲题"按钮
startRecordBtn.addEventListener('click', function() {
// 显示录音指示器
recordingIndicator.style.display = 'flex';
// 隐藏"帮我讲题"按钮,显示"停止讲话"按钮
startRecordBtn.style.display = 'none';
stopRecordBtn.style.display = 'flex';
// 这里添加实际录音功能逻辑
console.log('开始录音...');
// 示例调用录音API或相关函数
// startRecording();
});
// 点击"停止讲话"按钮
stopRecordBtn.addEventListener('click', function() {
// 隐藏录音指示器
recordingIndicator.style.display = 'none';
// 隐藏"停止讲话"按钮,显示"帮我讲题"按钮
stopRecordBtn.style.display = 'none';
startRecordBtn.style.display = 'flex';
// 这里添加停止录音功能逻辑
console.log('停止录音...');
// 示例:停止录音并处理音频
// stopRecording();
});
} else {
console.error('录音相关DOM元素未找到');
console.error('录音相关DOM元素未找到');
}
// 提交当前难度的答案