update pay function

This commit is contained in:
2025-11-23 13:40:46 +08:00
parent e01092365e
commit af362f3ceb

View File

@@ -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;
}