|
|
@ -323,6 +323,10 @@ watch(currentStock, (newStock) => { |
|
|
|
// 页面加载状态现在由 handleSendMessage 统一控制 |
|
|
|
// 停止当前播放的音频 |
|
|
|
stopAudio(); |
|
|
|
// 清理音频URL,确保不会播放之前股票的音频 |
|
|
|
audioUrl.value = ''; |
|
|
|
// 只停止音频播放,不清理currentAudioUrl,让新音频能正确设置 |
|
|
|
emotionAudioStore.stop(); |
|
|
|
// 清理正在进行的打字机效果定时器 |
|
|
|
clearTypewriterTimers(); |
|
|
|
// 重置触发状态,让每个股票都能独立触发效果 |
|
|
@ -360,6 +364,28 @@ watch(currentStock, (newStock) => { |
|
|
|
four: !!conclusion.four, |
|
|
|
disclaimer: true |
|
|
|
}; |
|
|
|
|
|
|
|
// 重要:即使已经显示过,也要播放当前股票的音频 |
|
|
|
// 提取音频URL并播放 |
|
|
|
let voiceUrl = null; |
|
|
|
if (conclusion.url) { |
|
|
|
voiceUrl = conclusion.url.toString().trim().replace(/[`\s]/g, ''); |
|
|
|
} else if (conclusion.audioUrl) { |
|
|
|
voiceUrl = conclusion.audioUrl.toString().trim().replace(/[`\s]/g, ''); |
|
|
|
} else if (conclusion.voice_url) { |
|
|
|
voiceUrl = conclusion.voice_url.toString().trim().replace(/[`\s]/g, ''); |
|
|
|
} else if (conclusion.audio) { |
|
|
|
voiceUrl = conclusion.audio.toString().trim().replace(/[`\s]/g, ''); |
|
|
|
} else if (conclusion.tts_url) { |
|
|
|
voiceUrl = conclusion.tts_url.toString().trim().replace(/[`\s]/g, ''); |
|
|
|
} |
|
|
|
|
|
|
|
if (voiceUrl && voiceUrl.startsWith('http')) { |
|
|
|
console.log('切换到已显示股票,播放对应音频:', voiceUrl); |
|
|
|
audioUrl.value = voiceUrl; |
|
|
|
// 立即播放当前股票的音频 |
|
|
|
playAudio(voiceUrl); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('解析结论数据失败:', error); |
|
|
|
} |
|
|
|