Merge branch 'feature' of https://git.valuefrontier.cn/vf/vf_react into feature
This commit is contained in:
@@ -180,30 +180,45 @@ const EventList = ({ events, pagination, onPageChange, onEventClick, onViewDetai
|
||||
importance: 'all',
|
||||
enabled: true,
|
||||
onNewEvent: (event) => {
|
||||
console.log('\n[EventList DEBUG] ========== EventList 收到新事件 ==========');
|
||||
console.log('[EventList DEBUG] 事件数据:', event);
|
||||
console.log('[EventList DEBUG] 事件 ID:', event?.id);
|
||||
console.log('[EventList DEBUG] 事件标题:', event?.title);
|
||||
logger.info('EventList', '收到新事件推送', event);
|
||||
|
||||
// 显示 Toast 通知
|
||||
toast({
|
||||
title: '新事件发布',
|
||||
console.log('[EventList DEBUG] 准备显示 Toast 通知');
|
||||
// 显示 Toast 通知 - 更明显的配置
|
||||
const toastId = toast({
|
||||
title: '🔔 新事件发布',
|
||||
description: event.title,
|
||||
status: 'info',
|
||||
duration: 5000,
|
||||
status: 'success', // 改为 success,更醒目
|
||||
duration: 8000, // 延长显示时间到 8 秒
|
||||
isClosable: true,
|
||||
position: 'top-right',
|
||||
variant: 'left-accent',
|
||||
position: 'top', // 改为顶部居中,更显眼
|
||||
variant: 'solid', // 改为 solid,背景更明显
|
||||
});
|
||||
console.log('[EventList DEBUG] ✓ Toast 通知已调用,ID:', toastId);
|
||||
|
||||
console.log('[EventList DEBUG] 准备更新事件列表');
|
||||
// 将新事件添加到列表顶部(防止重复)
|
||||
setLocalEvents((prevEvents) => {
|
||||
console.log('[EventList DEBUG] 当前事件列表数量:', prevEvents.length);
|
||||
const exists = prevEvents.some(e => e.id === event.id);
|
||||
console.log('[EventList DEBUG] 事件是否已存在:', exists);
|
||||
if (exists) {
|
||||
logger.debug('EventList', '事件已存在,跳过添加', { eventId: event.id });
|
||||
console.log('[EventList DEBUG] ⚠️ 事件已存在,跳过添加');
|
||||
return prevEvents;
|
||||
}
|
||||
logger.info('EventList', '新事件添加到列表顶部', { eventId: event.id });
|
||||
console.log('[EventList DEBUG] ✓ 新事件添加到列表顶部');
|
||||
// 添加到顶部,最多保留 100 个
|
||||
return [event, ...prevEvents].slice(0, 100);
|
||||
const updatedEvents = [event, ...prevEvents].slice(0, 100);
|
||||
console.log('[EventList DEBUG] 更新后事件列表数量:', updatedEvents.length);
|
||||
return updatedEvents;
|
||||
});
|
||||
console.log('[EventList DEBUG] ✓ 事件列表更新完成');
|
||||
console.log('[EventList DEBUG] ========== EventList 处理完成 ==========\n');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user