From 0aa94403314023e7f24e40dbf136c4d3efabb1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Fri, 22 Aug 2025 20:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=83=85=E7=BB=AA=E5=A4=A7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=BB=93=E8=AE=BA=E9=97=AA=E7=83=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AiEmotion.vue | 82 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 13 deletions(-) diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index 5abbffa..9cd8dc0 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -276,10 +276,11 @@
场景应用标题
-
+ +
-
+

L1: 情绪监控

@@ -289,51 +290,56 @@ {{ getStockTypewriterTexts(stock).one2 }}

-

+

{{ getStockConclusion(stock).one1 }}

-

+

{{ getStockConclusion(stock).one2 }}

-
+

L2: 情绪解码

{{ getStockTypewriterTexts(stock).two }}

-

+

{{ getStockConclusion(stock).two }}

-
+

L3: 情绪推演

{{ getStockTypewriterTexts(stock).three }}

-

+

{{ getStockConclusion(stock).three }}

-
+

L4: 情绪套利

{{ getStockTypewriterTexts(stock).four }}

-

+

{{ getStockConclusion(stock).four }}

+ +
+

请稍候...

+
+
-
+

{{ getStockTypewriterTexts(stock).disclaimer }}

-

+

该内容由AI生成,请注意甄别

@@ -914,7 +920,8 @@ const getStockTypewriterTexts = (stock) => { console.warn('getStockTypewriterTexts: 无法获取股票唯一标识'); return null; } - return stockTypewriterTexts.value.get(stockUniqueId) || null; + const texts = stockTypewriterTexts.value.get(stockUniqueId); + return texts || null; }; // 辅助函数:获取股票的打字机可见性状态 @@ -937,6 +944,29 @@ const isStockTypewriting = (stock) => { return stockTypewriterShown.value.has(stockUniqueId) && !stockTypewriterTexts.value.has(stockUniqueId); }; +// 辅助函数:检查股票状态是否准备好显示 +const isStockStateReady = (stock) => { + const stockUniqueId = getStockUniqueId(stock); + if (!stockUniqueId) { + return false; + } + + const conclusion = getStockConclusion(stock); + if (!conclusion) { + return false; + } + + const isFirstTime = !stockTypewriterShown.value.has(stockUniqueId); + + // 如果是第一次且用户主动搜索,需要确保打字机状态已初始化 + if (isFirstTime && isUserInitiated.value) { + return stockTypewriterTexts.value.has(stockUniqueId) && stockTypewriterVisibility.value.has(stockUniqueId); + } + + // 其他情况下,只要有结论数据就可以显示 + return true; +}; + // 监听股票列表变化,当列表为空时隐藏页面数据 watch( () => emotionStore.stockList, @@ -2326,6 +2356,32 @@ async function handleSendMessage(input, onComplete) { // 将结论数据存储到store中的当前激活股票 emotionStore.updateActiveStockConclusion(conclusionResponse.data); + // 确保状态在页面显示前已正确设置 + const stockUniqueId = getStockUniqueId(parsedData); + 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(() => { + console.log('状态设置完成,股票状态准备就绪:', parsedData.name, 'isReady:', isStockStateReady(parsedData)); + }); + } + // 所有数据加载完成,关闭加载状态,显示页面 // isLoading.value = false; isPageLoaded.value = true;