update pay function

This commit is contained in:
2025-11-24 19:49:42 +08:00
parent 4a0e156bec
commit 412f2a3d79
2 changed files with 85 additions and 0 deletions

View File

@@ -170,6 +170,21 @@ const KLineChartModal: React.FC<KLineChartModalProps> = ({
d.close >= d.open ? '#ef5350' : '#26a69a' d.close >= d.open ? '#ef5350' : '#26a69a'
); );
// 提取事件发生日期YYYY-MM-DD格式
let eventDateStr: string | null = null;
if (eventTime) {
try {
const eventDate = new Date(eventTime);
const year = eventDate.getFullYear();
const month = (eventDate.getMonth() + 1).toString().padStart(2, '0');
const day = eventDate.getDate().toString().padStart(2, '0');
eventDateStr = `${year}-${month}-${day}`;
console.log('[KLineChartModal] 事件发生日期:', eventDateStr);
} catch (e) {
console.error('[KLineChartModal] 解析事件日期失败:', e);
}
}
// 图表配置 // 图表配置
const option: echarts.EChartsOption = { const option: echarts.EChartsOption = {
backgroundColor: '#1a1a1a', backgroundColor: '#1a1a1a',
@@ -346,6 +361,34 @@ const KLineChartModal: React.FC<KLineChartModalProps> = ({
borderColor: '#ef5350', borderColor: '#ef5350',
borderColor0: '#26a69a', borderColor0: '#26a69a',
}, },
markLine: eventDateStr ? {
silent: false,
symbol: 'none',
label: {
show: true,
position: 'insideEndTop',
formatter: '事件发生',
color: '#ffd700',
fontSize: 12,
fontWeight: 'bold',
backgroundColor: 'rgba(0, 0, 0, 0.7)',
padding: [4, 8],
borderRadius: 4,
},
lineStyle: {
color: '#ffd700',
width: 2,
type: 'solid',
},
data: [
{
xAxis: eventDateStr,
label: {
formatter: '⚡ 事件发生',
},
},
],
} : undefined,
}, },
{ {
name: '成交量', name: '成交量',

View File

@@ -172,6 +172,20 @@ const TimelineChartModal: React.FC<TimelineChartModalProps> = ({
d.price >= basePrice ? '#ef5350' : '#26a69a' d.price >= basePrice ? '#ef5350' : '#26a69a'
); );
// 提取事件发生时间HH:MM格式
let eventTimeStr: string | null = null;
if (eventTime) {
try {
const eventDate = new Date(eventTime);
const hours = eventDate.getHours().toString().padStart(2, '0');
const minutes = eventDate.getMinutes().toString().padStart(2, '0');
eventTimeStr = `${hours}:${minutes}`;
console.log('[TimelineChartModal] 事件发生时间:', eventTimeStr);
} catch (e) {
console.error('[TimelineChartModal] 解析事件时间失败:', e);
}
}
// 图表配置 // 图表配置
const option: echarts.EChartsOption = { const option: echarts.EChartsOption = {
backgroundColor: '#1a1a1a', backgroundColor: '#1a1a1a',
@@ -341,6 +355,34 @@ const TimelineChartModal: React.FC<TimelineChartModalProps> = ({
{ offset: 1, color: 'rgba(33, 150, 243, 0.05)' }, { offset: 1, color: 'rgba(33, 150, 243, 0.05)' },
]), ]),
}, },
markLine: eventTimeStr ? {
silent: false,
symbol: 'none',
label: {
show: true,
position: 'insideEndTop',
formatter: '事件发生',
color: '#ffd700',
fontSize: 12,
fontWeight: 'bold',
backgroundColor: 'rgba(0, 0, 0, 0.7)',
padding: [4, 8],
borderRadius: 4,
},
lineStyle: {
color: '#ffd700',
width: 2,
type: 'solid',
},
data: [
{
xAxis: eventTimeStr,
label: {
formatter: '⚡ 事件发生',
},
},
],
} : undefined,
}, },
{ {
name: '均价', name: '均价',