Yansen 2 anni fa
parent
commit
f505aa5aa5
4 ha cambiato i file con 77 aggiunte e 29 eliminazioni
  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 Vedi File

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

+ 31
- 7
package.json Vedi File

27
     "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
27
     "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
28
     "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
28
     "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
29
     "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev",
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
     "test:e2e": "node ./tests/run-tests.js",
30
     "test:e2e": "node ./tests/run-tests.js",
33
     "tsc": "tsc --noEmit"
31
     "tsc": "tsc --noEmit"
34
   },
32
   },
45
   ],
43
   ],
46
   "dependencies": {
44
   "dependencies": {
47
     "@ant-design/icons": "^4.7.0",
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
     "antd": "^4.20.0",
48
     "antd": "^4.20.0",
52
     "classnames": "^2.3.0",
49
     "classnames": "^2.3.0",
53
     "lodash": "^4.17.0",
50
     "lodash": "^4.17.0",
66
     "@types/classnames": "^2.3.1",
63
     "@types/classnames": "^2.3.1",
67
     "@types/express": "^4.17.0",
64
     "@types/express": "^4.17.0",
68
     "@types/history": "^4.7.0",
65
     "@types/history": "^4.7.0",
69
-    "@types/jest": "^26.0.0",
70
     "@types/lodash": "^4.14.0",
66
     "@types/lodash": "^4.14.0",
71
     "@types/react": "^17.0.0",
67
     "@types/react": "^17.0.0",
72
     "@types/react-dom": "^17.0.0",
68
     "@types/react-dom": "^17.0.0",
80
     "eslint": "^7.32.0",
76
     "eslint": "^7.32.0",
81
     "gh-pages": "^3.2.0",
77
     "gh-pages": "^3.2.0",
82
     "husky": "^7.0.4",
78
     "husky": "^7.0.4",
83
-    "jsdom-global": "^3.0.0",
84
     "lint-staged": "^10.0.0",
79
     "lint-staged": "^10.0.0",
85
     "mockjs": "^1.1.0",
80
     "mockjs": "^1.1.0",
86
     "prettier": "^2.5.0",
81
     "prettier": "^2.5.0",
91
   },
86
   },
92
   "engines": {
87
   "engines": {
93
     "node": ">=12.0.0"
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 Vedi File

1
 import { requestConfig } from '@/utils/request';
1
 import { requestConfig } from '@/utils/request';
2
 import { history } from '@umijs/max';
2
 import { history } from '@umijs/max';
3
+import { SettingDrawer } from '@ant-design/pro-components';
3
 import defaultSettings from '../config/defaultSettings';
4
 import defaultSettings from '../config/defaultSettings';
4
 
5
 
5
 const isDev = process.env.NODE_ENV === 'development';
6
 const isDev = process.env.NODE_ENV === 'development';
36
 
37
 
37
 // ProLayout 支持的api https://procomponents.ant.design/components/layout
38
 // ProLayout 支持的api https://procomponents.ant.design/components/layout
38
 export const layout = ({ initialState, setInitialState }) => {
39
 export const layout = ({ initialState, setInitialState }) => {
39
-  return {
40
+  const cfg = {
40
     // rightContentRender: () => <RightContent />,
41
     // rightContentRender: () => <RightContent />,
41
     disableContentMargin: false,
42
     disableContentMargin: false,
42
     token: {
43
     token: {
43
       sider: {
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
     // waterMarkProps: {
53
     // waterMarkProps: {
75
     // 增加一个 loading 的状态
76
     // 增加一个 loading 的状态
76
     childrenRender: (children, props) => {
77
     childrenRender: (children, props) => {
77
       // if (initialState?.loading) return <PageLoading />;
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
 export const request = requestConfig;
107
 export const request = requestConfig;

+ 14
- 12
src/pages/package/index.jsx Vedi File

1
 import React, { useState } from 'react';
1
 import React, { useState } from 'react';
2
 import { PageContainer } from '@ant-design/pro-components';
2
 import { PageContainer } from '@ant-design/pro-components';
3
-import { Row, Col } from 'antd';
3
+import { Row, Col, Card } from 'antd';
4
 import List from './List';
4
 import List from './List';
5
 import BasicForm from './BasicForm';
5
 import BasicForm from './BasicForm';
6
 import DishList from './DishList';
6
 import DishList from './DishList';
12
 
12
 
13
   return (
13
   return (
14
     <PageContainer>
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
     </PageContainer>
28
     </PageContainer>
27
   )
29
   )
28
 }
30
 }