更新Company页面的UI为FUI风格

This commit is contained in:
2025-12-21 19:29:42 +08:00
parent d74162b7ce
commit b61f7a5048
10 changed files with 736 additions and 23 deletions

View File

@@ -113,9 +113,9 @@ const [currentMode, setCurrentMode] = useState('vertical');
// 根据模式选择数据源(使用 useMemo 缓存,避免重复计算)
// 纵向模式data 是页码映射 { 1: [...], 2: [...] }
// 平铺模式data 是数组 [...]
// 平铺模式 / 主线模式data 是数组 [...] (共用 fourRowData
const modeData = useMemo(
() => currentMode === 'four-row' ? fourRowData : verticalData,
() => (currentMode === 'four-row' || currentMode === 'mainline') ? fourRowData : verticalData,
[currentMode, fourRowData, verticalData]
);
const {
@@ -134,7 +134,7 @@ const [currentMode, setCurrentMode] = useState('vertical');
[currentMode, data]
);
const allCachedEvents = useMemo(
() => currentMode === 'four-row' ? data : undefined,
() => (currentMode === 'four-row' || currentMode === 'mainline') ? data : undefined,
[currentMode, data]
);
@@ -249,14 +249,14 @@ const [currentMode, setCurrentMode] = useState('vertical');
} else {
console.log(`[DynamicNewsCard] 纵向模式 + 第${state.currentPage}页 → 不刷新(避免打断用户)`);
}
} else if (mode === 'four-row') {
// ========== 平铺模式 ==========
} else if (mode === 'four-row' || mode === 'mainline') {
// ========== 平铺模式 / 主线模式 ==========
// 检查滚动位置,只有在顶部时才刷新
const scrollPos = virtualizedGridRef.current?.getScrollPosition();
if (scrollPos?.isNearTop) {
// 用户在顶部 10% 区域,安全刷新
console.log('[DynamicNewsCard] 平铺模式 + 滚动在顶部 → 刷新列表');
console.log(`[DynamicNewsCard] ${mode === 'mainline' ? '主线' : '平铺'}模式 + 滚动在顶部 → 刷新列表`);
handlePageChange(1); // 清空并刷新
toast({
title: '检测到新事件,已刷新',
@@ -266,7 +266,7 @@ const [currentMode, setCurrentMode] = useState('vertical');
});
} else {
// 用户不在顶部,显示提示但不自动刷新
console.log('[DynamicNewsCard] 平铺模式 + 滚动不在顶部 → 仅提示,不刷新');
console.log(`[DynamicNewsCard] ${mode === 'mainline' ? '主线' : '平铺'}模式 + 滚动不在顶部 → 仅提示,不刷新`);
toast({
title: '有新事件发布',
description: '滚动到顶部查看',