|
@ -290,6 +290,8 @@ const typewriterTimers = ref([]); |
|
|
const stockTypewriterShown = ref(new Map()); |
|
|
const stockTypewriterShown = ref(new Map()); |
|
|
// 记录每个股票是否已经播放过音频 |
|
|
// 记录每个股票是否已经播放过音频 |
|
|
const stockAudioPlayed = ref(new Map()); |
|
|
const stockAudioPlayed = ref(new Map()); |
|
|
|
|
|
// 存储当前的完成回调函数 |
|
|
|
|
|
const currentOnCompleteCallback = ref(null); |
|
|
|
|
|
|
|
|
// 音频播放相关数据 |
|
|
// 音频播放相关数据 |
|
|
const audioUrl = ref(''); |
|
|
const audioUrl = ref(''); |
|
@ -650,6 +652,9 @@ watch(parsedConclusion, (newConclusion) => { |
|
|
function startTypewriterEffect(conclusion, onComplete) { |
|
|
function startTypewriterEffect(conclusion, onComplete) { |
|
|
console.log('开始打字机效果,结论数据:', conclusion); |
|
|
console.log('开始打字机效果,结论数据:', conclusion); |
|
|
|
|
|
|
|
|
|
|
|
// 保存当前的完成回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = onComplete; |
|
|
|
|
|
|
|
|
// 详细调试各个字段 |
|
|
// 详细调试各个字段 |
|
|
console.log('L1字段 - one1:', conclusion.one1); |
|
|
console.log('L1字段 - one1:', conclusion.one1); |
|
|
console.log('L1字段 - one2:', conclusion.one2); |
|
|
console.log('L1字段 - one2:', conclusion.one2); |
|
@ -787,6 +792,8 @@ function startTypewriterEffect(conclusion, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
}, 100); |
|
|
}, 100); |
|
|
} |
|
|
} |
|
@ -914,6 +921,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -936,6 +945,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -957,6 +968,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -996,6 +1009,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -1066,6 +1081,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 如果不需要打字机效果,直接调用完成回调 |
|
|
// 如果不需要打字机效果,直接调用完成回调 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -1084,6 +1101,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -1096,6 +1115,8 @@ async function handleSendMessage(input, onComplete) { |
|
|
// 调用完成回调,重新启用输入框 |
|
|
// 调用完成回调,重新启用输入框 |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
if (onComplete && typeof onComplete === 'function') { |
|
|
onComplete(); |
|
|
onComplete(); |
|
|
|
|
|
// 清除保存的回调函数 |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
} finally { |
|
|
} finally { |
|
@ -1653,6 +1674,13 @@ onMounted(async () => { |
|
|
// 组件卸载时清理定时器、音频和observer |
|
|
// 组件卸载时清理定时器、音频和observer |
|
|
onUnmounted(() => { |
|
|
onUnmounted(() => { |
|
|
clearTypewriterTimers(); |
|
|
clearTypewriterTimers(); |
|
|
|
|
|
|
|
|
|
|
|
// 如果有未完成的回调函数,调用它来重新启用输入框 |
|
|
|
|
|
if (currentOnCompleteCallback.value && typeof currentOnCompleteCallback.value === 'function') { |
|
|
|
|
|
currentOnCompleteCallback.value(); |
|
|
|
|
|
currentOnCompleteCallback.value = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
stopAudio(); |
|
|
stopAudio(); |
|
|
|
|
|
|
|
|
// 重置触发状态 |
|
|
// 重置触发状态 |
|
|