From ff6281ab35e45b43897288f20b748a823e7ecff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Thu, 14 Aug 2025 11:20:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9F=B3=E9=A2=91=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E6=97=B6=E7=9A=84=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AiEmotion.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index 496a05f..e8c5eee 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -56,7 +56,7 @@
- 喇叭 @@ -257,9 +257,22 @@ const toggleVoiceForUser = (stock) => { // 如果当前点击的股票正在播放,则暂停 if (currentState.isPlaying) { console.log('暂停当前股票音频:', stock.stockInfo?.name); - stopAudio(); - emotionAudioStore.resetAudioState(); + // 暂停音频而不是停止 + if (emotionAudioStore.nowSound && emotionAudioStore.nowSound.playing()) { + emotionAudioStore.nowSound.pause(); + emotionAudioStore.isPaused = true; + emotionAudioStore.isPlaying = false; + } setStockAudioState(stock, { isPlaying: false, isPaused: true }); + } else if (currentState.isPaused) { + // 如果当前股票处于暂停状态,则继续播放 + console.log('继续播放当前股票音频:', stock.stockInfo?.name); + if (emotionAudioStore.nowSound) { + emotionAudioStore.nowSound.play(); + emotionAudioStore.isPaused = false; + emotionAudioStore.isPlaying = true; + } + setStockAudioState(stock, { isPlaying: true, isPaused: false }); } else { // 如果有其他音频正在播放,先停止 if (isAnyAudioPlaying) {