+
{{ 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;