ソースを参照

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

李志伟 3 年 前
コミット
a6bbbf5acb

+ 1
- 0
config/config.dev.js ファイルの表示

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

+ 2
- 0
config/config.js ファイルの表示

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

+ 8
- 4
src/access.js ファイルの表示

@@ -2,8 +2,12 @@
2 2
  * @see https://umijs.org/zh-CN/plugins/plugin-access
3 3
  * */
4 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 ファイルの表示

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

+ 2
- 1
src/pages/ContentManagementSystem/BannerClassification/index.jsx ファイルの表示

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

+ 5
- 5
src/pages/ContentManagementSystem/InformationList/index.jsx ファイルの表示

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

+ 3
- 2
src/pages/Machinery/MachineryType/index.jsx ファイルの表示

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