feat: 去除不相关逻辑
This commit is contained in:
@@ -55,6 +55,7 @@ let dynamicNewsCardRenderCount = 0;
|
|||||||
const DynamicNewsCard = forwardRef(({
|
const DynamicNewsCard = forwardRef(({
|
||||||
allCachedEvents = [],
|
allCachedEvents = [],
|
||||||
loading,
|
loading,
|
||||||
|
error,
|
||||||
total = 0,
|
total = 0,
|
||||||
cachedCount = 0,
|
cachedCount = 0,
|
||||||
filters = {},
|
filters = {},
|
||||||
@@ -178,20 +179,6 @@ const DynamicNewsCard = forwardRef(({
|
|||||||
const selectedEventInCurrentPage = currentPageEvents.find(
|
const selectedEventInCurrentPage = currentPageEvents.find(
|
||||||
e => e.id === selectedEvent?.id
|
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]);
|
}, [currentPageEvents, selectedEvent?.id, mode]);
|
||||||
|
|
||||||
@@ -255,6 +242,7 @@ const DynamicNewsCard = forwardRef(({
|
|||||||
onPageChange={handlePageChange}
|
onPageChange={handlePageChange}
|
||||||
loading={loadingPage !== null}
|
loading={loadingPage !== null}
|
||||||
loadingPage={loadingPage}
|
loadingPage={loadingPage}
|
||||||
|
error={error}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
onModeChange={handleModeToggle}
|
onModeChange={handleModeToggle}
|
||||||
eventFollowStatus={eventFollowStatus}
|
eventFollowStatus={eventFollowStatus}
|
||||||
@@ -277,14 +265,6 @@ const DynamicNewsCard = forwardRef(({
|
|||||||
</VStack>
|
</VStack>
|
||||||
</Center>
|
</Center>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 详情面板 - 仅在单排/双排模式下显示(四排模式不显示,纵向模式已在右侧显示) */}
|
|
||||||
{currentPageEvents && currentPageEvents.length > 0 && selectedEvent &&
|
|
||||||
(mode === 'carousel' || mode === 'grid') && (
|
|
||||||
<Box mt={6}>
|
|
||||||
<DynamicNewsDetailPanel event={selectedEvent} />
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|
||||||
{/* 四排模式详情弹窗 - 未打开时不渲染 */}
|
{/* 四排模式详情弹窗 - 未打开时不渲染 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user