diff --git a/app/components/news/body/ImageGridSection.tsx b/app/components/news/body/ImageGridSection.tsx index 04058be..f95fa1f 100644 --- a/app/components/news/body/ImageGridSection.tsx +++ b/app/components/news/body/ImageGridSection.tsx @@ -100,12 +100,14 @@ const LearnPage = () => { -
+
+
烽火动态
+
); }; diff --git a/app/components/news/body/Integrated.tsx b/app/components/news/body/Integrated.tsx index 1d292ca..80feb58 100644 --- a/app/components/news/body/Integrated.tsx +++ b/app/components/news/body/Integrated.tsx @@ -54,7 +54,9 @@ export default function Integrated() { {/* 装饰性蓝色竖条 */}
{/* 标题文字:深蓝色,加粗,4xl字号 */} -

综合服务

+
+

综合服务

+
{/* 服务项容器:使用flex布局排列三列,列间距45px,设置内边距 */} diff --git a/app/components/news/header/TopNav.tsx b/app/components/news/header/TopNav.tsx index 16ddd42..97015ab 100644 --- a/app/components/news/header/TopNav.tsx +++ b/app/components/news/header/TopNav.tsx @@ -4,6 +4,7 @@ import { Button } from '@/ui/button'; interface MenuItem { label: string; key: string; + sectionId:string; } interface TopNavProps { @@ -15,12 +16,12 @@ interface TopNavProps { export function TopNav({ menuItems = [ - { label: '首页', key: 'home' }, - { label: '烽火动态', key: 'news' }, - { label: '烽火铸魂', key: 'soul' }, - { label: '烽火训练', key: 'training' }, - { label: '联系热线', key: 'hotline' }, - { label: '综合服务', key: 'service' }, + { label: '首页', key: 'home', sectionId:'home' }, + { label: '烽火动态', key: 'news', sectionId:'fireNews' }, + { label: '烽火铸魂', key: 'soul', sectionId:'soul' }, + { label: '烽火训练', key: 'training', sectionId:'training' }, + { label: '联系热线', key: 'hotline', sectionId:'hotline' }, + { label: '综合服务', key: 'service', sectionId:'service' }, ], activeKey: externalActiveKey, onSearch, @@ -34,12 +35,25 @@ export function TopNav({ const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); onSearch?.(searchKeyword); + }; const handleItemClick = (item: MenuItem) => { if (externalActiveKey === undefined) { setInternalActiveKey(item.key); } + + // 如果有对应的 sectionId,则滚动到该区域 + if (item.sectionId) { + const element = document.getElementById(item.sectionId); + if (element) { + element.scrollIntoView({ + behavior: 'smooth', // 平滑滚动 + block: 'start' // 滚动到顶部对齐 + }); + } + } + onItemClick?.(item.key); }; diff --git a/app/components/news/list/NewsList.tsx b/app/components/news/list/NewsList.tsx index 0031a89..3e6d082 100644 --- a/app/components/news/list/NewsList.tsx +++ b/app/components/news/list/NewsList.tsx @@ -32,7 +32,7 @@ const NewsList: React.FC = () => { {/* 使用 Flexbox 将两个列表放在一行 */}
{/* 科技新闻 */} -
+
{/* 标题栏:独立于列表之外 */}
@@ -57,7 +57,7 @@ const NewsList: React.FC = () => {
{/* 教育新闻 */} -
+
{/* 标题栏:独立于列表之外 */}