diff --git a/src/pages/home/index.module.less b/src/pages/layouts/with-header-without-footer/index.module.less similarity index 100% rename from src/pages/home/index.module.less rename to src/pages/layouts/with-header-without-footer/index.module.less diff --git a/src/pages/home/index.tsx b/src/pages/layouts/with-header-without-footer/index.tsx similarity index 63% rename from src/pages/home/index.tsx rename to src/pages/layouts/with-header-without-footer/index.tsx index aba2ef7..dc2510f 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/layouts/with-header-without-footer/index.tsx @@ -1,7 +1,9 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import styles from "./index.module.less"; import { Outlet } from "react-router-dom"; -import { Header, LeftMenu } from "../../compenents"; +import { Header, LeftMenu } from "../../../compenents"; +import { Suspense } from "react"; +import LoadingPage from "../../loading"; const HomePage = () => { useEffect(() => {}, []); @@ -17,8 +19,10 @@ const HomePage = () => {
- {/* 二级路由出口 */} - + }> + {/* 二级路由出口 */} + {" "} +
diff --git a/src/pages/layouts/without-header-without-footer/index.module.less b/src/pages/layouts/without-header-without-footer/index.module.less new file mode 100644 index 0000000..d41ce28 --- /dev/null +++ b/src/pages/layouts/without-header-without-footer/index.module.less @@ -0,0 +1,8 @@ +.layout-wrap { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; +} diff --git a/src/pages/layouts/without-header-without-footer/index.tsx b/src/pages/layouts/without-header-without-footer/index.tsx new file mode 100644 index 0000000..31cd2a7 --- /dev/null +++ b/src/pages/layouts/without-header-without-footer/index.tsx @@ -0,0 +1,16 @@ +import { Suspense } from "react"; +import styles from "./index.module.less"; +import { Outlet } from "react-router-dom"; +import LoadingPage from "../../loading"; + +const WithoutHeaderWithoutFooter = () => { + return ( +
+ }> + + +
+ ); +}; + +export default WithoutHeaderWithoutFooter; diff --git a/src/pages/loading/index.module.less b/src/pages/loading/index.module.less index 0ada21a..ca9d22e 100644 --- a/src/pages/loading/index.module.less +++ b/src/pages/loading/index.module.less @@ -1,6 +1,6 @@ -.loading-parent-box { - width: 100vd; - height: 100vh; - text-align: center; +.loading-box { + width: 100vw; line-height: 100vh; + text-align: center; } + diff --git a/src/pages/loading/index.tsx b/src/pages/loading/index.tsx index 58a90d9..2e51159 100644 --- a/src/pages/loading/index.tsx +++ b/src/pages/loading/index.tsx @@ -1,11 +1,20 @@ import { Spin } from "antd"; import styles from "./index.module.less"; -const LoadingPage = () => { +interface PropsInterface { + height?: string; +} + +const LoadingPage = (props: PropsInterface) => { return ( -
- -
+ <> +
+ +
+ ); }; diff --git a/src/routes/index.tsx b/src/routes/index.tsx index f44e6f8..742dcaf 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -7,7 +7,9 @@ import KeepAlive from "../compenents/keep-alive"; // 页面加载 import InitPage from "../pages/init"; import LoginPage from "../pages/login"; -import HomePage from "../pages/home"; +import WithHeaderWithoutFooter from "../pages/layouts/with-header-without-footer"; +import WithoutHeaderWithoutFooter from "../pages/layouts/without-header-without-footer"; + //首页 const DashboardPage = lazy(() => import("../pages/dashboard")); //修改密码页面 @@ -77,7 +79,7 @@ const routes: RouteObject[] = [ children: [ { path: "/", - element: } />, + element: } />, children: [ { path: "/", @@ -150,16 +152,22 @@ const routes: RouteObject[] = [ ], }, { - path: "/login", - element: , - }, - { - path: "/test", - element: , - }, - { - path: "*", - element: , + path: "/", + element: , + children: [ + { + path: "/login", + element: , + }, + { + path: "/test", + element: , + }, + { + path: "*", + element: , + }, + ], }, ], },