Sfoglia il codice sorgente

Merge branch 'master' of http://git.ycjcjy.com/nanyang/machinery-admin

李志伟 3 anni fa
parent
commit
a6bbbf5acb

+ 1
- 0
config/config.dev.js Vedi File

1
 // https://umijs.org/config/
1
 // https://umijs.org/config/
2
 import { defineConfig } from 'umi';
2
 import { defineConfig } from 'umi';
3
 export default defineConfig({
3
 export default defineConfig({
4
+  //
4
   plugins: [
5
   plugins: [
5
     // https://github.com/zthxxx/react-dev-inspector
6
     // https://github.com/zthxxx/react-dev-inspector
6
     'react-dev-inspector/plugins/umi/react-inspector',
7
     'react-dev-inspector/plugins/umi/react-inspector',

+ 2
- 0
config/config.js Vedi File

5
 import proxy from './proxy';
5
 import proxy from './proxy';
6
 import routes from './routes';
6
 import routes from './routes';
7
 const { REACT_APP_ENV } = process.env;
7
 const { REACT_APP_ENV } = process.env;
8
+
8
 export default defineConfig({
9
 export default defineConfig({
10
+  // 以下是 umi 参数
9
   hash: true,
11
   hash: true,
10
   antd: {},
12
   antd: {},
11
   dva: {
13
   dva: {

+ 8
- 4
src/access.js Vedi File

2
  * @see https://umijs.org/zh-CN/plugins/plugin-access
2
  * @see https://umijs.org/zh-CN/plugins/plugin-access
3
  * */
3
  * */
4
 export default function access(initialState) {
4
 export default function access(initialState) {
5
-  const { currentUser } = initialState || {};
6
-  return {
7
-    canAdmin: currentUser && currentUser.access === 'admin',
8
-  };
5
+  const { menuAccess } = initialState || {};
6
+  return (menuAccess || []).reduce((acc, item) => {
7
+    const { permission: canAccess } = item;
8
+    return {
9
+      ...acc,
10
+      [permission]: canAccess,
11
+    };
12
+  }, {});
9
 }
13
 }

+ 4
- 4
src/app.jsx Vedi File

18
 export async function getInitialState() {
18
 export async function getInitialState() {
19
   const fetchUserInfo = async () => {
19
   const fetchUserInfo = async () => {
20
     try {
20
     try {
21
-      const { user } = await queryCurrentUser();
22
-      return user;
21
+      return await queryCurrentUser();
23
     } catch (error) {
22
     } catch (error) {
24
       history.push(loginPath);
23
       history.push(loginPath);
25
     }
24
     }
28
   }; // 如果是登录页面,不执行
27
   }; // 如果是登录页面,不执行
29
 
28
 
30
   if (history.location.pathname !== loginPath) {
29
   if (history.location.pathname !== loginPath) {
31
-    const currentUser = await fetchUserInfo();
30
+    const res = await fetchUserInfo();
32
     return {
31
     return {
33
       fetchUserInfo,
32
       fetchUserInfo,
34
-      currentUser,
33
+      currentUser: res.user,
34
+      menuAccess: res.menu,
35
       settings: {},
35
       settings: {},
36
     };
36
     };
37
   }
37
   }

+ 2
- 1
src/pages/ContentManagementSystem/BannerClassification/index.jsx Vedi File

13
       name: '胡彦斌',
13
       name: '胡彦斌',
14
       age: 32,
14
       age: 32,
15
       zz: '西湖区湖底公园1号',
15
       zz: '西湖区湖底公园1号',
16
+      status: 1
16
     },
17
     },
17
   ];
18
   ];
18
 
19
 
38
       title: titleCourse,
39
       title: titleCourse,
39
       okText: '确认',
40
       okText: '确认',
40
       cancelText: '取消',
41
       cancelText: '取消',
41
-      onOk() {
42
+      onOk () {
42
         publishNote(record.noteId, record.status ? 'off' : 'on').then((res) => {
43
         publishNote(record.noteId, record.status ? 'off' : 'on').then((res) => {
43
           message.success('操作成功');
44
           message.success('操作成功');
44
           actionRef.current.reload();
45
           actionRef.current.reload();

+ 5
- 5
src/pages/ContentManagementSystem/InformationList/index.jsx Vedi File

8
 export default (props) => {
8
 export default (props) => {
9
   const dataSource = [
9
   const dataSource = [
10
     {
10
     {
11
-      id: 9,
11
+      status: 0,
12
       key: '1',
12
       key: '1',
13
       name: '胡彦斌',
13
       name: '胡彦斌',
14
       age: 32,
14
       age: 32,
39
   const columns = [
39
   const columns = [
40
     {
40
     {
41
       title: '分类名',
41
       title: '分类名',
42
-      key: 'typeName',
43
-      dataIndex: 'typeName',
42
+      key: 'name',
43
+      dataIndex: 'name',
44
       search: false,
44
       search: false,
45
     },
45
     },
46
     {
46
     {
47
       title: '资讯标题',
47
       title: '资讯标题',
48
-      dataIndex: 'title',
49
-      key: 'title',
48
+      dataIndex: 'zz',
49
+      key: 'zz',
50
       search: false,
50
       search: false,
51
     },
51
     },
52
     {
52
     {

+ 3
- 2
src/pages/Machinery/MachineryType/index.jsx Vedi File

65
       search: false,
65
       search: false,
66
     },
66
     },
67
   ];
67
   ];
68
-  const handleDelete = () => {};
68
+  const handleDelete = () => { };
69
 
69
 
70
   const Submit = () => {
70
   const Submit = () => {
71
     setLoading(true);
71
     setLoading(true);
84
     form.resetFields();
84
     form.resetFields();
85
     setSelectModal(false);
85
     setSelectModal(false);
86
   };
86
   };
87
+
87
   useEffect(() => {
88
   useEffect(() => {
88
     form.setFieldsValue({ targetName: '' });
89
     form.setFieldsValue({ targetName: '' });
89
     // setPackageList();
90
     // setPackageList();
94
   return (
95
   return (
95
     <PageHeaderWrapper>
96
     <PageHeaderWrapper>
96
       <Modal
97
       <Modal
97
-        title="套餐权重修改"
98
+        title="修改"
98
         visible={selectModal}
99
         visible={selectModal}
99
         onCancel={onCancel}
100
         onCancel={onCancel}
100
         destroyOnClose={true}
101
         destroyOnClose={true}