Browse Source

Merge branch 'milestone-20250710-上线前优化' into dev

songjie/feature-20250628160649-上线前优化
宋杰 4 weeks ago
parent
commit
edf64c5102
  1. 56
      src/views/AiEmotion.vue

56
src/views/AiEmotion.vue

@ -420,10 +420,10 @@ const toggleVoiceForUser = (stock) => {
const isAnyAudioPlaying = const isAnyAudioPlaying =
emotionAudioStore.isPlaying || currentState.isPlaying; emotionAudioStore.isPlaying || currentState.isPlaying;
//
//
if (currentState.isPlaying) { if (currentState.isPlaying) {
console.log("暂停当前股票音频:", stock.stockInfo?.name); console.log("暂停当前股票音频:", stock.stockInfo?.name);
//
//
if (emotionAudioStore.nowSound && emotionAudioStore.nowSound.playing()) { if (emotionAudioStore.nowSound && emotionAudioStore.nowSound.playing()) {
emotionAudioStore.nowSound.pause(); emotionAudioStore.nowSound.pause();
emotionAudioStore.isPaused = true; emotionAudioStore.isPaused = true;
@ -431,9 +431,13 @@ const toggleVoiceForUser = (stock) => {
} }
setStockAudioState(stock, { isPlaying: false, isPaused: true }); setStockAudioState(stock, { isPlaying: false, isPaused: true });
} else if (currentState.isPaused) { } else if (currentState.isPaused) {
//
//
console.log("继续播放当前股票音频:", stock.stockInfo?.name); console.log("继续播放当前股票音频:", stock.stockInfo?.name);
if (emotionAudioStore.nowSound) { if (emotionAudioStore.nowSound) {
//
if (emotionAudioStore.playbackPosition > 0) {
emotionAudioStore.nowSound.seek(emotionAudioStore.playbackPosition);
}
emotionAudioStore.nowSound.play(); emotionAudioStore.nowSound.play();
emotionAudioStore.isPaused = false; emotionAudioStore.isPaused = false;
emotionAudioStore.isPlaying = true; emotionAudioStore.isPlaying = true;
@ -958,9 +962,20 @@ const isStockStateReady = (stock) => {
const isFirstTime = !stockTypewriterShown.value.has(stockUniqueId); const isFirstTime = !stockTypewriterShown.value.has(stockUniqueId);
//
// true
if (isFirstTime && isUserInitiated.value) { if (isFirstTime && isUserInitiated.value) {
return stockTypewriterTexts.value.has(stockUniqueId) && stockTypewriterVisibility.value.has(stockUniqueId);
//
if (!stockTypewriterTexts.value.has(stockUniqueId)) {
stockTypewriterTexts.value.set(stockUniqueId, {
one1: "", one2: "", two: "", three: "", four: "", disclaimer: ""
});
}
if (!stockTypewriterVisibility.value.has(stockUniqueId)) {
stockTypewriterVisibility.value.set(stockUniqueId, {
one: false, two: false, three: false, four: false, disclaimer: false
});
}
return true;
} }
// //
@ -1583,15 +1598,19 @@ const playNextAudio = () => {
console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name); console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name);
} }
//
//
if ( if (
currentPlayIndex === 0 && currentPlayIndex === 0 &&
audioInfo.shouldStartTypewriter && audioInfo.shouldStartTypewriter &&
parsedConclusion.value
parsedConclusion.value &&
!emotionAudioStore.isPaused && //
emotionAudioStore.playbackPosition === 0 //
) { ) {
console.log("🎬 第一个音频开始播放,同时启动打字机效果"); console.log("🎬 第一个音频开始播放,同时启动打字机效果");
const stockId = currentStock ? getStockUniqueId(currentStock) : null; const stockId = currentStock ? getStockUniqueId(currentStock) : null;
startTypewriterEffect(parsedConclusion.value, stockId, audioInfo.onComplete); startTypewriterEffect(parsedConclusion.value, stockId, audioInfo.onComplete);
} else if (currentPlayIndex === 0 && audioInfo.shouldStartTypewriter) {
console.log("🔄 从暂停状态恢复播放,不重新启动打字机效果");
} }
}, },
onpause: () => { onpause: () => {
@ -2356,29 +2375,12 @@ async function handleSendMessage(input, onComplete) {
// store // store
emotionStore.updateActiveStockConclusion(conclusionResponse.data); emotionStore.updateActiveStockConclusion(conclusionResponse.data);
//
// isStockStateReady
const stockUniqueId = getStockUniqueId(parsedData); const stockUniqueId = getStockUniqueId(parsedData);
if (stockUniqueId) { if (stockUniqueId) {
const isFirstTime = !stockTypewriterShown.value.has(stockUniqueId);
if (isFirstTime && isUserInitiated.value) {
//
console.log('初始化打字机状态:', parsedData.name);
stockTypewriterTexts.value.set(stockUniqueId, {
one1: "", one2: "", two: "", three: "", four: "", disclaimer: ""
});
stockTypewriterVisibility.value.set(stockUniqueId, {
one: false, two: false, three: false, four: false, disclaimer: false
});
} else {
//
console.log('设置完整显示模式:', parsedData.name);
stockTypewriterTexts.value.delete(stockUniqueId);
stockTypewriterVisibility.value.delete(stockUniqueId);
}
//
//
nextTick(() => { nextTick(() => {
console.log('状态设置完成,股票状态准备就绪:', parsedData.name, 'isReady:', isStockStateReady(parsedData));
console.log('数据加载完成,股票状态准备就绪:', parsedData.name, 'isReady:', isStockStateReady(parsedData));
}); });
} }

Loading…
Cancel
Save