diff --git a/Touchkebao/src/pages/index.tsx b/Touchkebao/src/pages/index.tsx new file mode 100644 index 00000000..ed9c8153 --- /dev/null +++ b/Touchkebao/src/pages/index.tsx @@ -0,0 +1,34 @@ +import React, { useEffect } from "react"; +import { useNavigate } from "react-router-dom"; +import Layout from "@/components/Layout/Layout"; + +const IndexPage: React.FC = () => { + const navigate = useNavigate(); + + useEffect(() => { + // 检测是否为移动端 + const isMobile = () => { + const userAgent = navigator.userAgent; + const mobileRegex = + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i; + return mobileRegex.test(userAgent) || window.innerWidth <= 768; + }; + + // 如果是移动端,跳转到/pc/dashboard + if (isMobile()) { + navigate("/mobile/dashboard"); + } else { + navigate("/pc/dashboard"); + } + }, [navigate]); + + return ( + +
+

首页

+
+
+ ); +}; + +export default IndexPage; diff --git a/Touchkebao/src/router/module/common.tsx b/Touchkebao/src/router/module/common.tsx index f3f6e677..d7062d05 100644 --- a/Touchkebao/src/router/module/common.tsx +++ b/Touchkebao/src/router/module/common.tsx @@ -1,8 +1,13 @@ import Login from "@/pages/login/Login"; import Guide from "@/pages/guide"; import Init from "@/pages/iframe/init"; - +import Index from "@/pages/index"; const authRoutes = [ + { + path: "/", + element: , + auth: false, // 需要登录 + }, { path: "/init", element: , diff --git a/Touchkebao/src/router/module/pc.tsx b/Touchkebao/src/router/module/pc.tsx index 1fbb8b61..0464f090 100644 --- a/Touchkebao/src/router/module/pc.tsx +++ b/Touchkebao/src/router/module/pc.tsx @@ -4,14 +4,10 @@ import Dashboard from "@/pages/pc/ckbox/dashboard"; const ckboxRoutes = [ { - path: "/ckbox", + path: "/pc", element: , auth: true, children: [ - { - path: "", - element: , - }, { path: "dashboard", element: ,