Yansen 2 gadus atpakaļ
vecāks
revīzija
f505aa5aa5
4 mainītis faili ar 77 papildinājumiem un 29 dzēšanām
  1. 1
    1
      config/config.js
  2. 31
    7
      package.json
  3. 31
    9
      src/app.jsx
  4. 14
    12
      src/pages/package/index.jsx

+ 1
- 1
config/config.js Parādīt failu

@@ -44,7 +44,7 @@ export default defineConfig({
44 44
     // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
45 45
     // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
46 46
     // https://ant.design/docs/react/customize-theme-variable-cn
47
-    'root-entry-name': 'default' // 'variable',
47
+    'root-entry-name': 'variable',
48 48
   },
49 49
   ignoreMomentLocale: true,
50 50
   proxy: proxy[REACT_APP_ENV || 'dev'],

+ 31
- 7
package.json Parādīt failu

@@ -27,8 +27,6 @@
27 27
     "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
28 28
     "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
29 29
     "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev",
30
-    "test": "max test",
31
-    "test:component": "max test ./src/components",
32 30
     "test:e2e": "node ./tests/run-tests.js",
33 31
     "tsc": "tsc --noEmit"
34 32
   },
@@ -45,9 +43,8 @@
45 43
   ],
46 44
   "dependencies": {
47 45
     "@ant-design/icons": "^4.7.0",
48
-    "@ant-design/pro-components": "1.1.1",
49
-    "@ant-design/pro-layout": "^6.38.13",
50
-    "@umijs/route-utils": "^2.0.0",
46
+    "@ant-design/pro-components": "^2.0.0",
47
+    "@umijs/route-utils": "^2.1.3",
51 48
     "antd": "^4.20.0",
52 49
     "classnames": "^2.3.0",
53 50
     "lodash": "^4.17.0",
@@ -66,7 +63,6 @@
66 63
     "@types/classnames": "^2.3.1",
67 64
     "@types/express": "^4.17.0",
68 65
     "@types/history": "^4.7.0",
69
-    "@types/jest": "^26.0.0",
70 66
     "@types/lodash": "^4.14.0",
71 67
     "@types/react": "^17.0.0",
72 68
     "@types/react-dom": "^17.0.0",
@@ -80,7 +76,6 @@
80 76
     "eslint": "^7.32.0",
81 77
     "gh-pages": "^3.2.0",
82 78
     "husky": "^7.0.4",
83
-    "jsdom-global": "^3.0.0",
84 79
     "lint-staged": "^10.0.0",
85 80
     "mockjs": "^1.1.0",
86 81
     "prettier": "^2.5.0",
@@ -91,5 +86,34 @@
91 86
   },
92 87
   "engines": {
93 88
     "node": ">=12.0.0"
89
+  },
90
+  "create-umi": {
91
+    "ignoreScript": [
92
+      "docker*",
93
+      "functions*",
94
+      "site",
95
+      "generateMock"
96
+    ],
97
+    "ignoreDependencies": [
98
+      "netlify*",
99
+      "serverless"
100
+    ],
101
+    "ignore": [
102
+      ".dockerignore",
103
+      ".git",
104
+      ".github",
105
+      ".gitpod.yml",
106
+      "CODE_OF_CONDUCT.md",
107
+      "Dockerfile",
108
+      "Dockerfile.*",
109
+      "lambda",
110
+      "LICENSE",
111
+      "netlify.toml",
112
+      "README.*.md",
113
+      "azure-pipelines.yml",
114
+      "docker",
115
+      "CNAME",
116
+      "create-umi"
117
+    ]
94 118
   }
95 119
 }

+ 31
- 9
src/app.jsx Parādīt failu

@@ -1,5 +1,6 @@
1 1
 import { requestConfig } from '@/utils/request';
2 2
 import { history } from '@umijs/max';
3
+import { SettingDrawer } from '@ant-design/pro-components';
3 4
 import defaultSettings from '../config/defaultSettings';
4 5
 
5 6
 const isDev = process.env.NODE_ENV === 'development';
@@ -36,17 +37,17 @@ export async function getInitialState() {
36 37
 
37 38
 // ProLayout 支持的api https://procomponents.ant.design/components/layout
38 39
 export const layout = ({ initialState, setInitialState }) => {
39
-  return {
40
+  const cfg = {
40 41
     // rightContentRender: () => <RightContent />,
41 42
     disableContentMargin: false,
42 43
     token: {
43 44
       sider: {
44
-        menuBackgroundColor: '#001529',
45
-        menuTitleTextColor: '#fff',
46
-        menuTextColor: 'hsla(0,0%,100%,.65);',
47
-        menuSubArrowColor: '#fff',
48
-        menuItemSelectedBgColor: '#1890ff',
49
-        menuSelectedTextColor: '#fff',
45
+        colorMenuBackground: '#001529',
46
+        colorTextMenuTitle: '#fff',
47
+        colorTextMenu: 'hsla(0,0%,100%,.65);',
48
+        colorBgMenuItemHover: '#fff',
49
+        colorBgMenuItemSelected: '#1890ff',
50
+        colorTextMenuSelected: '#fff',
50 51
       },
51 52
     },
52 53
     // waterMarkProps: {
@@ -75,11 +76,32 @@ export const layout = ({ initialState, setInitialState }) => {
75 76
     // 增加一个 loading 的状态
76 77
     childrenRender: (children, props) => {
77 78
       // if (initialState?.loading) return <PageLoading />;
78
-      return <>{children}</>;
79
+      return (
80
+        <>
81
+          {children}
82
+          {/* {!props.location?.pathname?.includes('/login') && (
83
+            <SettingDrawer
84
+              disableUrlParams
85
+              enableDarkTheme
86
+              settings={initialState?.settings}
87
+              onSettingChange={(settings) => {
88
+                setInitialState((preInitialState) => ({
89
+                  ...preInitialState,
90
+                  settings,
91
+                }));
92
+              }}
93
+            />
94
+          )} */}
95
+        </>
96
+      );
79 97
     },
80 98
 
81
-    ...initialState?.settings,
99
+    settings: initialState?.settings,
82 100
   };
101
+
102
+  console.log(cfg)
103
+
104
+  return cfg;
83 105
 };
84 106
 
85 107
 export const request = requestConfig;

+ 14
- 12
src/pages/package/index.jsx Parādīt failu

@@ -1,6 +1,6 @@
1 1
 import React, { useState } from 'react';
2 2
 import { PageContainer } from '@ant-design/pro-components';
3
-import { Row, Col } from 'antd';
3
+import { Row, Col, Card } from 'antd';
4 4
 import List from './List';
5 5
 import BasicForm from './BasicForm';
6 6
 import DishList from './DishList';
@@ -12,17 +12,19 @@ export default (props) => {
12 12
 
13 13
   return (
14 14
     <PageContainer>
15
-      <Row gutter={100}>
16
-        <Col span={8}>
17
-          <List current={current} setCurrent={setCurrent}/>
18
-        </Col>
19
-        <Col span={8}>
20
-          <BasicForm current={current} onChange={it => setCurrent(it)} />
21
-          <div style={{ marginTop: '100px' }}>
22
-            <DishList />
23
-          </div>
24
-        </Col>
25
-      </Row>
15
+      <Card>
16
+        <Row gutter={100}>
17
+          <Col span={8}>
18
+            <List current={current} setCurrent={setCurrent}/>
19
+          </Col>
20
+          <Col span={8}>
21
+            <BasicForm current={current} onChange={it => setCurrent(it)} />
22
+            <div style={{ marginTop: '100px' }}>
23
+              <DishList />
24
+            </div>
25
+          </Col>
26
+        </Row>
27
+      </Card>
26 28
     </PageContainer>
27 29
   )
28 30
 }