Browse Source

修改音频播放时的按钮样式;

master
宋杰 3 days ago
parent
commit
ff6281ab35
  1. 19
      src/views/AiEmotion.vue

19
src/views/AiEmotion.vue

@ -56,7 +56,7 @@
<div class="message-container">
<!-- 显示该股票对应的用户输入内容 -->
<div class="user-message-container">
<img :src="isVoice && getStockAudioState(stock).isPlaying ? voiceNoActive : voice" class="user-message-speaker"
<img :src="isVoice && getStockAudioState(stock).isPlaying ? voice : voiceNoActive" class="user-message-speaker"
:class="{
'speaker-active': isVoice && getStockAudioState(stock).isPlaying
}" @click="() => toggleVoiceForUser(stock)" alt="喇叭" />
@ -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) {

Loading…
Cancel
Save