This commit is contained in:
zhangjianjun 2026-03-26 09:46:59 +08:00
parent a71b1089f5
commit 11b4dd75b2
3 changed files with 32 additions and 147 deletions

View File

@ -45,6 +45,8 @@
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",
"keepalive-for-react": "^5.0.7",
"keepalive-for-react-router": "^5.0.7",
"lenis": "^1.3.19",
"mime": "^4.0.7",
"mini-css-extract-plugin": "^2.4.5",
@ -57,7 +59,6 @@
"postcss-preset-env": "^7.0.1",
"prompts": "^2.4.2",
"react": "^19.1.0",
"react-activation": "^0.13.4",
"react-app-polyfill": "^3.0.0",
"react-countup": "^6.5.3",
"react-dev-utils": "^12.0.1",

View File

@ -1,9 +1,6 @@
import Home from "@/pages/Home/index";
import MainLayout from "@/layouts/MainLayout";
import { Navigate, createBrowserRouter } from "react-router-dom";
import { lazy, Suspense } from "react";
import { KeepAlive } from "react-activation";
import TermsOfUse from "@/pages/Others/TermsOfUse";
import PrivacyPolicy from "@/pages/Others/PrivacyPolicy";
@ -35,7 +32,7 @@ const routes = createBrowserRouter([
path: "/",
element: <MainLayout></MainLayout>,
children: [
{ index: true, element: <KeepAlive id="home"><Home /></KeepAlive> },
{ index: true, element: <Home /> },
// 关于银泰
{
path: "about",
@ -47,207 +44,103 @@ const routes = createBrowserRouter([
},
{
path: "about/overview",
element: (
<KeepAlive id="about-overview">
<Suspense fallback={null}>
<About />
</Suspense>
</KeepAlive>
),
element: <About />,
},
{
path: "about/history",
element: (
<KeepAlive id="about-history">
<Suspense fallback={null}>
<AboutHistory />
</Suspense>
</KeepAlive>
),
element: <AboutHistory />,
},
{
path: "about/founder",
element: (
<KeepAlive id="about-founder">
<Suspense fallback={null}>
<AboutFounder />
</Suspense>
</KeepAlive>
),
element: <AboutFounder />,
},
// 集团业务
{
path: "business",
element: (
<NavigateReplace path="/business/commercial-group">
<Suspense fallback={null}>
<BusinessCommercialGroup />
</Suspense>
</NavigateReplace>
),
},
{
path: "business/commercial-group",
element: (
<KeepAlive id="business-commercial-group">
<Suspense fallback={null}>
<BusinessCommercialGroup />
</Suspense>
</KeepAlive>
),
element: <BusinessCommercialGroup />,
},
{
path: "business/commercial-group/:detailType",
element: (
<KeepAlive id="business-commercial-group-detail">
<Suspense fallback={null}>
<BusinessCommercialGroupDetail />
</Suspense>
</KeepAlive>
),
element: <BusinessCommercialGroupDetail />,
},
{
path: "business/base-group",
element: (
<KeepAlive id="business-base-group">
<Suspense fallback={null}>
<BusinessBaseGroup />
</Suspense>
</KeepAlive>
),
element: <BusinessBaseGroup />,
},
{
path: "business/realty-group",
element: (
<KeepAlive id="business-realty-group">
<Suspense fallback={null}>
<BusinessRealtyGroup />
</Suspense>
</KeepAlive>
),
element: <BusinessRealtyGroup />,
},
{
path: "business/invest-group",
element: (
<KeepAlive id="business-invest-group">
<Suspense fallback={null}>
<BusinessInvestGroup />
</Suspense>
</KeepAlive>
),
element: <BusinessInvestGroup />,
},
{
path: "business/ruijing-group",
element: (
<KeepAlive id="business-ruijing-group">
<Suspense fallback={null}>
<BusinessRujingGroup />
</Suspense>
</KeepAlive>
),
element: <BusinessRujingGroup />,
},
// 社会责任
{
path: "social",
element: (
<NavigateReplace path="/social/sustainability">
<Suspense fallback={null}>
<SocialSustainability />
</Suspense>
</NavigateReplace>
),
},
{
path: "social/sustainability",
element: (
<KeepAlive id="social-sustainability">
<Suspense fallback={null}>
<SocialSustainability />
</Suspense>
</KeepAlive>
),
element: <SocialSustainability />,
},
{
path: "social/foundation",
element: (
<KeepAlive id="social-foundation">
<Suspense fallback={null}>
<SocialFoundation />
</Suspense>
</KeepAlive>
),
element: <SocialFoundation />,
},
// 新闻中心
{
path: "news",
element: (
<NavigateReplace path="/news/public">
<Suspense fallback={null}>
<NewsPublic />
</Suspense>
</NavigateReplace>
),
},
{
path: "news/public",
element: (
<KeepAlive id="news-public">
<Suspense fallback={null}>
<NewsPublic />
</Suspense>
</KeepAlive>
),
element: <NewsPublic />,
},
{
path: "news/media",
element: (
<KeepAlive id="news-media">
<Suspense fallback={null}>
<NewsMedia />
</Suspense>
</KeepAlive>
),
element: <NewsMedia />,
},
{
path: "news/detail/:id",
element: (
<KeepAlive id="news-detail">
<Suspense fallback={null}>
<NewsDetail />
</Suspense>
</KeepAlive>
),
element: <NewsDetail />,
},
// 加入银泰
{
path: "join",
element: (
<NavigateReplace path="/join/culture">
<Suspense fallback={null}>
<JoinCulture />
</Suspense>
</NavigateReplace>
),
},
{
path: "join/culture",
element: (
<KeepAlive id="join-culture">
<Suspense fallback={null}>
<JoinCulture />
</Suspense>
</KeepAlive>
),
element: <JoinCulture />,
},
{
path: "join/campus",
element: (
<KeepAlive id="join-campus">
<Suspense fallback={null}>
<JoinCampus />
</Suspense>
</KeepAlive>
),
element: <JoinCampus />,
},
{
path: "join/campus/detail/:id",
@ -259,21 +152,15 @@ const routes = createBrowserRouter([
// 物业服务
{
path: "/property-service",
element: (
<KeepAlive id="property-service">
<Suspense fallback={null}>
<PropertyService />
</Suspense>
</KeepAlive>
),
element: <PropertyService />,
},
// 搜索
{ path: "/search", element: <KeepAlive id="search"><Search /></KeepAlive> },
{ path: "/search", element: <Search /> },
// 使用条款 隐私保护 审计举报 网站地图
{ path: "/terms-of-use", element: <KeepAlive id="terms-of-use"><TermsOfUse /></KeepAlive> },
{ path: "/privacy-policy", element: <KeepAlive id="privacy-policy"><PrivacyPolicy /></KeepAlive> },
{ path: "/audit-report", element: <KeepAlive id="audit-report"><AuditReport /></KeepAlive> },
{ path: "/site-map", element: <KeepAlive id="site-map"><SiteMap /></KeepAlive> },
{ path: "/terms-of-use", element: <TermsOfUse /> },
{ path: "/privacy-policy", element: <PrivacyPolicy /> },
{ path: "/audit-report", element: <AuditReport /> },
{ path: "/site-map", element: <SiteMap /> },
{ path: "/contact-us", element: <Navigate to="/news/media"></Navigate> },
],
},

View File

@ -1,8 +1,7 @@
import { Outlet } from "react-router-dom";
import Header from "./Header";
import Footer from "./Footer";
import useHashScroll from "@/hooks/useHashScroll";
import { AliveScope } from "react-activation";
import KeepAliveRouteOutlet from "keepalive-for-react-router";
export default function MainLayout() {
useHashScroll()
@ -11,9 +10,7 @@ export default function MainLayout() {
<div className="layout">
<Header />
<main className="container">
<AliveScope>
<Outlet />
</AliveScope>
<KeepAliveRouteOutlet />
</main>
<Footer />
</div>