update pay function
This commit is contained in:
@@ -172,8 +172,8 @@ const ConceptTimelineModal = ({
|
|||||||
return timelineData.map(item => {
|
return timelineData.map(item => {
|
||||||
const priceInfo = getPriceInfo(item.price);
|
const priceInfo = getPriceInfo(item.price);
|
||||||
const hasEvents = item.events && item.events.length > 0;
|
const hasEvents = item.events && item.events.length > 0;
|
||||||
const newsCount = item.events.filter(e => e.type === 'news').length;
|
const newsCount = (item.events || []).filter(e => e.type === 'news').length;
|
||||||
const reportCount = item.events.filter(e => e.type === 'report').length;
|
const reportCount = (item.events || []).filter(e => e.type === 'report').length;
|
||||||
|
|
||||||
// 根据涨跌幅和事件确定颜色
|
// 根据涨跌幅和事件确定颜色
|
||||||
let backgroundColor = '#e2e8f0'; // 默认灰色(无数据)
|
let backgroundColor = '#e2e8f0'; // 默认灰色(无数据)
|
||||||
@@ -188,14 +188,16 @@ const ConceptTimelineModal = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建显示标题:同时显示事件和涨跌幅
|
// 构建显示标题:同时显示事件和涨跌幅
|
||||||
|
const hasPriceData = item.price && item.price.avg_change_pct !== null;
|
||||||
let title = '';
|
let title = '';
|
||||||
if (hasEvents && item.price) {
|
|
||||||
|
if (hasEvents && hasPriceData) {
|
||||||
// 同时有事件和价格数据
|
// 同时有事件和价格数据
|
||||||
title = `📰${newsCount} 📊${reportCount} ${priceInfo.text}`;
|
title = `📰${newsCount} 📊${reportCount} ${priceInfo.text}`;
|
||||||
} else if (hasEvents) {
|
} else if (hasEvents) {
|
||||||
// 只有事件
|
// 只有事件
|
||||||
title = `📰${newsCount} 📊${reportCount}`;
|
title = `📰${newsCount} 📊${reportCount}`;
|
||||||
} else if (item.price) {
|
} else if (hasPriceData) {
|
||||||
// 只有价格数据
|
// 只有价格数据
|
||||||
title = priceInfo.text;
|
title = priceInfo.text;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user