feb646efe5
feat: 为主导航菜单和页面区块添加ARIA属性 fix: 解决工作时间信息获取问题 perf: 优化页面滚动功能实现 fix: 修正联系页面标题显示问题 test: 运行完整测试套件验证修复效果 docs: 添加修复完成报告
86 lines
2.1 KiB
TypeScript
86 lines
2.1 KiB
TypeScript
"use client";
|
|
|
|
import { Suspense, useEffect } from 'react';
|
|
import { useSearchParams } from 'next/navigation';
|
|
import dynamic from 'next/dynamic';
|
|
import { HeroSection } from "@/components/sections/hero-section";
|
|
import { SectionSkeleton } from "@/components/ui/loading-skeleton";
|
|
|
|
const ServicesSection = dynamic(
|
|
() => import('@/components/sections/services-section').then(mod => ({ default: mod.ServicesSection })),
|
|
{
|
|
loading: () => <SectionSkeleton />,
|
|
ssr: false
|
|
}
|
|
);
|
|
|
|
const ProductsSection = dynamic(
|
|
() => import('@/components/sections/products-section').then(mod => ({ default: mod.ProductsSection })),
|
|
{
|
|
loading: () => <SectionSkeleton />,
|
|
ssr: false
|
|
}
|
|
);
|
|
|
|
const CasesSection = dynamic(
|
|
() => import('@/components/sections/cases-section').then(mod => ({ default: mod.CasesSection })),
|
|
{
|
|
loading: () => <SectionSkeleton />,
|
|
ssr: false
|
|
}
|
|
);
|
|
|
|
const AboutSection = dynamic(
|
|
() => import('@/components/sections/about-section').then(mod => ({ default: mod.AboutSection })),
|
|
{
|
|
loading: () => <SectionSkeleton />,
|
|
ssr: false
|
|
}
|
|
);
|
|
|
|
const NewsSection = dynamic(
|
|
() => import('@/components/sections/news-section').then(mod => ({ default: mod.NewsSection })),
|
|
{
|
|
loading: () => <SectionSkeleton />,
|
|
ssr: false
|
|
}
|
|
);
|
|
|
|
function HomeContent() {
|
|
const searchParams = useSearchParams();
|
|
|
|
useEffect(() => {
|
|
const section = searchParams.get('section');
|
|
if (section) {
|
|
const timer = setTimeout(() => {
|
|
const targetElement = document.getElementById(section);
|
|
if (targetElement) {
|
|
targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
}
|
|
}, 100);
|
|
|
|
return () => clearTimeout(timer);
|
|
}
|
|
return undefined;
|
|
}, [searchParams]);
|
|
|
|
return (
|
|
<main className="min-h-screen bg-white dark:bg-(--color-bg-primary)">
|
|
<HeroSection />
|
|
<ServicesSection />
|
|
<ProductsSection />
|
|
<CasesSection />
|
|
<AboutSection />
|
|
<NewsSection />
|
|
</main>
|
|
);
|
|
}
|
|
|
|
export default function HomePage() {
|
|
return (
|
|
<Suspense fallback={<SectionSkeleton />}>
|
|
<HomeContent />
|
|
</Suspense>
|
|
);
|
|
}
|