feat: 去除不相关逻辑

This commit is contained in:
zdl
2025-11-05 17:02:49 +08:00
parent cb44c18e57
commit ff7b8abe9d

View File

@@ -55,6 +55,7 @@ let dynamicNewsCardRenderCount = 0;
const DynamicNewsCard = forwardRef(({
allCachedEvents = [],
loading,
error,
total = 0,
cachedCount = 0,
filters = {},
@@ -178,20 +179,6 @@ const DynamicNewsCard = forwardRef(({
const selectedEventInCurrentPage = currentPageEvents.find(
e => e.id === selectedEvent?.id
);
if (selectedEvent && !selectedEventInCurrentPage) {
console.log('%c📄 [翻页] 选中的事件不在当前页', 'color: #F59E0B; font-weight: bold;');
// 单排/双排/纵向模式:自动选中当前页第一个事件(保持详情显示)
// 四排模式:清空选中状态(不需要底部详情)
if (mode === 'carousel' || mode === 'grid' || mode === 'vertical') {
console.log('%c📄 [翻页] 自动选中当前页第一个事件', 'color: #10B981; font-weight: bold;');
setSelectedEvent(currentPageEvents[0]);
} else {
console.log('%c📄 [翻页] 清空选中状态(四排模式)', 'color: #F59E0B; font-weight: bold;');
setSelectedEvent(null);
}
}
}
}, [currentPageEvents, selectedEvent?.id, mode]);
@@ -255,6 +242,7 @@ const DynamicNewsCard = forwardRef(({
onPageChange={handlePageChange}
loading={loadingPage !== null}
loadingPage={loadingPage}
error={error}
mode={mode}
onModeChange={handleModeToggle}
eventFollowStatus={eventFollowStatus}
@@ -277,14 +265,6 @@ const DynamicNewsCard = forwardRef(({
</VStack>
</Center>
)}
{/* 详情面板 - 仅在单排/双排模式下显示(四排模式不显示,纵向模式已在右侧显示) */}
{currentPageEvents && currentPageEvents.length > 0 && selectedEvent &&
(mode === 'carousel' || mode === 'grid') && (
<Box mt={6}>
<DynamicNewsDetailPanel event={selectedEvent} />
</Box>
)}
</CardBody>
{/* 四排模式详情弹窗 - 未打开时不渲染 */}