From 0ffc6aa49348b9285a49b46643bcfa929ece86e0 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 27 Oct 2025 00:11:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=88=E6=9E=9C=EF=BC=9A=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=E2=94=82=20=E2=94=82=20=E2=94=82=20=E2=94=82=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=E2=94=82=20=E2=94=82=20=E2=94=82=20?= =?UTF-8?q?=E2=94=82=201.=20=E7=94=A8=E6=88=B7=E8=BF=9B=E5=85=A5=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E9=A1=B5=E9=9D=A2=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=E2=94=82=20=E2=94=82=20=E2=94=82=20=E2=94=82=202.=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=AD=A3=E5=B8=B8=E6=B8=B2=E6=9F=93=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=E2=94=82?= =?UTF-8?q?=20=E2=94=82=20=E2=94=82=203.=201=E7=A7=92=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B9=B3=E6=BB=91=E6=BB=9A=E5=8A=A8=E5=88=B0?= =?UTF-8?q?"=E5=AE=9E=E6=97=B6=E4=BA=8B=E4=BB=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BD=B4"=E6=A0=87=E9=A2=98=E4=BD=8D=E7=BD=AE=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=E2=94=82=20=E2=94=82=20=E2=94=82=204.=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=AF=E4=BB=A5=E7=9B=B4=E6=8E=A5=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A1=86=E5=92=8C=E4=BA=8B=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Community/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/views/Community/index.js b/src/views/Community/index.js index 206c67b2..3af69b9c 100644 --- a/src/views/Community/index.js +++ b/src/views/Community/index.js @@ -36,6 +36,7 @@ const Community = () => { // Ref:用于滚动到实时事件时间轴 const eventTimelineRef = useRef(null); + const hasScrolledRef = useRef(false); // 标记是否已滚动 // ⚡ 通知权限引导 const { showCommunityGuide } = useNotification(); @@ -71,6 +72,26 @@ const Community = () => { } }, [showCommunityGuide]); // 只在组件挂载时执行一次 + // ⚡ 页面渲染完成后1秒,自动滚动到实时事件时间轴 + useEffect(() => { + // 只在第一次数据加载完成后滚动 + if (!loading && !hasScrolledRef.current && eventTimelineRef.current) { + const timer = setTimeout(() => { + if (eventTimelineRef.current) { + eventTimelineRef.current.scrollIntoView({ + behavior: 'smooth', // 平滑滚动动画 + block: 'start', // 元素顶部对齐视口顶部,标题正好可见 + inline: 'nearest' // 水平方向最小滚动 + }); + hasScrolledRef.current = true; // 标记已滚动 + logger.debug('Community', '页面渲染完成,自动滚动到实时事件时间轴(顶部对齐)'); + } + }, 1000); // 渲染完成后延迟1秒 + + return () => clearTimeout(timer); + } + }, [loading]); // 监听 loading 状态变化 + return ( {/* 导航栏已由 MainLayout 提供 */}