diff --git a/.gitignore b/.gitignore index 6ea2fb4..804638b 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ yarn.lock pnpm-lock.yaml package-lock.json .env +public/video/banner.mp4 diff --git a/src/App.tsx b/src/App.tsx index c08dba7..78ad697 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ // App.js -import { BrowserRouter as Router, useRoutes } from 'react-router-dom'; +import { BrowserRouter as Router, RouterProvider, useRoutes } from 'react-router-dom'; import "./App.css" import routes from "@/Routes"; import { useCallback, useEffect, useState } from "react"; @@ -8,9 +8,9 @@ import { useStore } from "@/store"; import { parsePageConfig } from "@/utils/parsePageConfig"; import type { I18nData, SupportLocale } from "@/type"; -function AppRoutes() { - return useRoutes(routes); -} +// function AppRoutes() { +// return useRoutes(routes); +// } function App() { const [init, setInit] = useState(false); @@ -87,9 +87,7 @@ function App() { return ( <>
- - - +
); diff --git a/src/Routes.tsx b/src/Routes.tsx index a4d7a68..866bb6a 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -1,7 +1,16 @@ import Home from "@/pages/Home/index"; import MainLayout from "@/layouts/MainLayout"; -import { Navigate, type RouteObject } from "react-router-dom"; +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"; +import AuditReport from "@/pages/Others/AuditReport"; +import SiteMap from "@/pages/Others/SiteMap"; +import Search from "@/pages/Others/Search"; +import NavigateReplace from "@/utils/NavigateReplace"; import About from "@/pages/About/overview"; import AboutHistory from "@/pages/About/History"; import AboutFounder from "@/pages/About/Founder"; @@ -20,57 +29,255 @@ import JoinCulture from "@/pages/Join/Culture"; import JoinCampus from "@/pages/Join/Campus"; import JoinCampusDetail from "@/pages/Join/CampusDetail"; import PropertyService from "@/pages/PropertyService/index"; -import TermsOfUse from "@/pages/Others/TermsOfUse"; -import PrivacyPolicy from "@/pages/Others/PrivacyPolicy"; -import AuditReport from "@/pages/Others/AuditReport"; -import SiteMap from "@/pages/Others/SiteMap"; -import Search from "@/pages/Others/Search"; -import NavigateReplace from "@/utils/NavigateReplace"; - -const routes: RouteObject[] = [ +const routes = createBrowserRouter([ { path: "/", element: , children: [ - { index: true, element: }, + { index: true, element: }, // 关于银泰 - { path: "about", element: }, - { path: "about/overview", element: }, //集团概览 - { path: "about/history", element: }, - { path: "about/founder", element: }, + { + path: "about", + element: ( + + + + ), + }, + { + path: "about/overview", + element: ( + + + + + + ), + }, + { + path: "about/history", + element: ( + + + + + + ), + }, + { + path: "about/founder", + element: ( + + + + + + ), + }, // 集团业务 - { path: "business", element: }, - { path: "business/commercial-group", element: }, - { path: "business/commercial-group/:detailType", element: }, - { path: "business/base-group", element: }, - { path: "business/realty-group", element: }, - { path: "business/invest-group", element: }, - { path: "business/ruijing-group", element: }, + { + path: "business", + element: ( + + + + + + ), + }, + { + path: "business/commercial-group", + element: ( + + + + + + ), + }, + { + path: "business/commercial-group/:detailType", + element: ( + + + + + + ), + }, + { + path: "business/base-group", + element: ( + + + + + + ), + }, + { + path: "business/realty-group", + element: ( + + + + + + ), + }, + { + path: "business/invest-group", + element: ( + + + + + + ), + }, + { + path: "business/ruijing-group", + element: ( + + + + + + ), + }, // 社会责任 - { path: "social", element: }, - { path: "social/sustainability", element: }, - { path: "social/foundation", element: }, + { + path: "social", + element: ( + + + + + + ), + }, + { + path: "social/sustainability", + element: ( + + + + + + ), + }, + { + path: "social/foundation", + element: ( + + + + + + ), + }, // 新闻中心 - { path: "news", element: }, - { path: "news/public", element: }, - { path: "news/media", element: }, - { path: "news/detail/:id", element: }, + { + path: "news", + element: ( + + + + + + ), + }, + { + path: "news/public", + element: ( + + + + + + ), + }, + { + path: "news/media", + element: ( + + + + + + ), + }, + { + path: "news/detail/:id", + element: ( + + + + + + ), + }, // 加入银泰 - { path: "join", element: }, - { path: "join/culture", element: }, - { path: "join/campus", element: }, - { path: "join/campus/detail/:id", element: }, + { + path: "join", + element: ( + + + + + + ), + }, + { + path: "join/culture", + element: ( + + + + + + ), + }, + { + path: "join/campus", + element: ( + + + + + + ), + }, + { + path: "join/campus/detail/:id", + element: ( + + + + + + ), + }, // 其它 // 物业服务 - { path: "/property-service", element: }, + { + path: "/property-service", + element: ( + + + + + + ), + }, // 搜索 - { path: "/search", element: }, + { path: "/search", element: }, // 使用条款 隐私保护 审计举报 网站地图 - { path: "/terms-of-use", element: }, - { path: "/privacy-policy", element: }, - { path: "/audit-report", element: }, - { path: "/site-map", element: }, + { path: "/terms-of-use", element: }, + { path: "/privacy-policy", element: }, + { path: "/audit-report", element: }, + { path: "/site-map", element: }, { path: "/contact-us", element: }, ], }, @@ -78,6 +285,6 @@ const routes: RouteObject[] = [ path: '*', element:
404 Not Found
} -]; +]) export default routes; diff --git a/src/components/Banner.module.css b/src/components/Banner.module.css index a40c22d..c9806e4 100644 --- a/src/components/Banner.module.css +++ b/src/components/Banner.module.css @@ -31,6 +31,16 @@ background-position: center; } +/* 视频铺满:等价于背景图 cover,需配合父级有明确宽高(.hero / .bgSwiper 已占满) */ +.bgVideo { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + object-fit: cover; + object-position: center; +} + .heroOverlay { position: absolute; inset: 0; diff --git a/src/components/banner.tsx b/src/components/banner.tsx index 0b32bd4..3ed6436 100644 --- a/src/components/banner.tsx +++ b/src/components/banner.tsx @@ -100,6 +100,8 @@ export default function Banner({ ); + + const videoExtension = ["mp4", "webm", "ogg"]; return (
{images.map((img, i) => ( -
+ {/* 图片后缀 */} + {videoExtension.includes(img.split(".").pop() ?? "") ? ( +