张涛 1 year ago
parent
commit
3c3f692cfe
2 changed files with 27 additions and 27 deletions
  1. 1
    1
      src/layouts/AuthLayout/components/Menus.jsx
  2. 26
    26
      src/layouts/AuthLayout/index.jsx

+ 1
- 1
src/layouts/AuthLayout/components/Menus.jsx View File

@@ -19,7 +19,7 @@ export default (props) => {
19 19
   // }, [location.pathname]);
20 20
   const selectedKeys = [location.pathname];
21 21
 
22
-
22
+console.log(theme)
23 23
   return (
24 24
     <Menu
25 25
       mode="inline"

+ 26
- 26
src/layouts/AuthLayout/index.jsx View File

@@ -1,36 +1,36 @@
1
-import React from 'react'
2
-import { Spin, Layout } from 'antd'
3
-import HtmlTitle from './components/HtmlTitle'
1
+import React from "react";
2
+import { Spin, Layout } from "antd";
3
+import HtmlTitle from "./components/HtmlTitle";
4 4
 // import Main from './Main';
5
-import { useLocation, useNavigate } from 'react-router-dom'
6
-import { useModel } from '@/store'
5
+import { useLocation, useNavigate } from "react-router-dom";
6
+import { useModel } from "@/store";
7 7
 
8
-import SiderBar from './components/SiderBar'
9
-import Header from './components/Header'
10
-import Container from './components/Container'
11
-import { authRoutes } from '@/routes/routes'
12
-import { getMenuItems } from '@/routes/menus'
13
-import RequireLogin from './RequireLogin'
14
-import './style.less'
8
+import SiderBar from "./components/SiderBar";
9
+import Header from "./components/Header";
10
+import Container from "./components/Container";
11
+import { authRoutes } from "@/routes/routes";
12
+import { getMenuItems } from "@/routes/menus";
13
+import RequireLogin from "./RequireLogin";
14
+import "./style.less";
15 15
 
16 16
 const Spinner = () => (
17 17
   <div
18 18
     style={{
19
-      width: '100%',
20
-      height: '100%',
21
-      display: 'grid',
22
-      placeItems: 'center',
19
+      width: "100%",
20
+      height: "100%",
21
+      display: "grid",
22
+      placeItems: "center",
23 23
     }}
24 24
   >
25 25
     <Spin />
26 26
   </div>
27
-)
27
+);
28 28
 
29 29
 export default (props) => {
30
-  const { theme } = useModel('system')
31
-  const { user, menus } = useModel('user')
32
-  const navigate = useNavigate()
33
-  const location = useLocation()
30
+  const { theme } = useModel("system");
31
+  const { user, menus } = useModel("user");
32
+  const navigate = useNavigate();
33
+  const location = useLocation();
34 34
   // const menus = getMenuItems(authRoutes);
35 35
   // const RequireLogin = React.lazy(() => {
36 36
   //   return withLogin(import("./Main"));
@@ -42,15 +42,15 @@ export default (props) => {
42 42
       <HtmlTitle />
43 43
       {/* <React.Suspense fallback={<Spinner />}> */}
44 44
       <RequireLogin>
45
-        <Layout className={theme} style={{ height: '100vh' }}>
45
+        <Layout className={theme} style={{ height: "100vh" }}>
46 46
           <Header theme={theme} user={user} />
47
-          <Layout  style={{ height: 'calc(100vh - var(--header-height))' }}>
48
-            <SiderBar theme="light" menus={menus} location={location} />
47
+          <Layout style={{ height: "calc(100vh - var(--header-height))" }}>
48
+            <SiderBar theme={theme} menus={menus} location={location} />
49 49
             <Container location={location} />
50 50
           </Layout>
51 51
         </Layout>
52 52
       </RequireLogin>
53 53
       {/* </React.Suspense> */}
54 54
     </Spin>
55
-  )
56
-}
55
+  );
56
+};