From af362f3ceb8081c017c4da0744bc14e3fbd221af Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Sun, 23 Nov 2025 13:40:46 +0800 Subject: [PATCH] update pay function --- src/views/Concept/ConceptTimelineModal.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/Concept/ConceptTimelineModal.js b/src/views/Concept/ConceptTimelineModal.js index 37abfdb2..0268d8cf 100644 --- a/src/views/Concept/ConceptTimelineModal.js +++ b/src/views/Concept/ConceptTimelineModal.js @@ -172,8 +172,8 @@ const ConceptTimelineModal = ({ return timelineData.map(item => { const priceInfo = getPriceInfo(item.price); const hasEvents = item.events && item.events.length > 0; - const newsCount = item.events.filter(e => e.type === 'news').length; - const reportCount = item.events.filter(e => e.type === 'report').length; + const newsCount = (item.events || []).filter(e => e.type === 'news').length; + const reportCount = (item.events || []).filter(e => e.type === 'report').length; // 根据涨跌幅和事件确定颜色 let backgroundColor = '#e2e8f0'; // 默认灰色(无数据) @@ -188,14 +188,16 @@ const ConceptTimelineModal = ({ } // 构建显示标题:同时显示事件和涨跌幅 + const hasPriceData = item.price && item.price.avg_change_pct !== null; let title = ''; - if (hasEvents && item.price) { + + if (hasEvents && hasPriceData) { // 同时有事件和价格数据 title = `📰${newsCount} 📊${reportCount} ${priceInfo.text}`; } else if (hasEvents) { // 只有事件 title = `📰${newsCount} 📊${reportCount}`; - } else if (item.price) { + } else if (hasPriceData) { // 只有价格数据 title = priceInfo.text; }