李志伟 3 lat temu
rodzic
commit
6161529a2b

+ 14
- 31
config/routes.js Wyświetl plik

@@ -47,14 +47,7 @@ export default [
47 47
     name: '数据大屏',
48 48
     icon: 'DesktopOutlined',
49 49
     component: './MonitoringScreen',
50
-    routes: [
51
-      {
52
-        path: '/MonitoringScreen/detail.jsx',
53
-        name: '农机轨迹',
54
-        component: './MonitoringScreen/detail.jsx',
55
-        hideInMenu: true,
56
-      },
57
-    ],
50
+    access: 'screen',
58 51
   },
59 52
   {
60 53
     path: '/ContentManagementSystem',
@@ -96,6 +89,17 @@ export default [
96 89
         component: './ContentManagementSystem/BannerClassification/BannerClassificationEdit',
97 90
         hideInMenu: true,
98 91
       },
92
+      {
93
+        path: '/ContentManagementSystem/Advertisement',
94
+        name: '广告位管理',
95
+        component: './ContentManagementSystem/Advertisement',
96
+      },
97
+      {
98
+        path: '/ContentManagementSystem/Advertisement/edit.jsx',
99
+        name: '广告位编辑',
100
+        component: './ContentManagementSystem/Advertisement/edit.jsx',
101
+        hideInMenu: true,
102
+      },
99 103
     ],
100 104
   },
101 105
   {
@@ -131,31 +135,10 @@ export default [
131 135
         component: './Machinery/Machinery/edit.jsx',
132 136
         hideInMenu: true,
133 137
       },
134
-    ],
135
-  },
136
-  {
137
-    path: '/MachineryStatistics',
138
-    name: '农机统计',
139
-    icon: 'CompassOutlined',
140
-    component: '../layouts/BasicLayout',
141
-    routes: [
142
-      {
143
-        path: '/MachineryStatistics',
144
-        name: '农机统计',
145
-        component: './MachineryStatistics',
146
-      },
147
-    ],
148
-  },
149
-  {
150
-    path: '/MachineryGIS',
151
-    name: '农机GIS',
152
-    icon: 'InsertRowLeftOutlined',
153
-    component: '../layouts/BasicLayout',
154
-    routes: [
155 138
       {
156
-        path: '/MachineryGIS/index.jsx',
139
+        path: '/Machinery/GIS',
157 140
         name: '农机GIS',
158
-        component: './MachineryGIS',
141
+        component: './Machinery/GIS',
159 142
       },
160 143
     ],
161 144
   },

+ 73
- 0
src/pages/ContentManagementSystem/Advertisement/edit.jsx Wyświetl plik

@@ -0,0 +1,73 @@
1
+import { Input, Card, Select, Button, message, Upload, Modal } from 'antd';
2
+import { useEffect, useState } from 'react';
3
+import { Form } from 'antd';
4
+import { history } from 'umi';
5
+import ProCard from '@ant-design/pro-card';
6
+import { UploadImage } from '@/components/Upload';
7
+import ExtendContent from '@/components/ExtendContent';
8
+
9
+const { Option } = Select;
10
+const goBack = () => {
11
+  history.goBack();
12
+};
13
+const FormItem = Form.Item;
14
+export default (props) => {
15
+  const [form] = Form.useForm();
16
+  const [loading, setLoading] = useState(false);
17
+  const [image, setImage] = useState();
18
+
19
+  const formItemLayout = {
20
+    //布局
21
+    labelCol: { span: 6 },
22
+    wrapperCol: { span: 14 },
23
+  };
24
+
25
+  const Submit = (values) => {
26
+    message.success(`成功成功成功`);
27
+    console.log('🚀 ~ file: index.jsx ~ line 21 ~ values', values);
28
+  };
29
+
30
+  return (
31
+    <Card>
32
+      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}>
33
+        <ProCard.TabPane key={1} tab="资讯管理">
34
+          <Form {...formItemLayout} onFinish={Submit} form={form}>
35
+            <FormItem label="名称" name="title" rules={[{ required: true, message: '请输入' }]}>
36
+              <Input placeholder="请输入" style={{ width: '350px' }} />
37
+            </FormItem>
38
+            <FormItem label="图片" name="thumb" rules={[{ required: true, message: '请选择' }]}>
39
+              <UploadImage value={image} onChange={setImage} />
40
+            </FormItem>
41
+            <FormItem label="位置" name="position" rules={[{ required: true, message: '请选择' }]}>
42
+              <Select>
43
+                <Option value="index">首次引导页</Option>
44
+                <Option value="index">app启动页</Option>
45
+                <Option value="banner">banner</Option>
46
+              </Select>
47
+            </FormItem>
48
+            <FormItem label="详细信息" colon={false}>
49
+              <ExtendContent
50
+                targetType="tourist"
51
+                targetId={'66'}
52
+                onCancel={() => history.goBack()}
53
+              />
54
+            </FormItem>
55
+            <FormItem label=" " colon={false}>
56
+              <Button type="default" onClick={() => goBack()}>
57
+                返回
58
+              </Button>
59
+              <Button
60
+                type="primary"
61
+                loading={loading}
62
+                htmlType="Submit"
63
+                style={{ marginLeft: '4em' }}
64
+              >
65
+                保存
66
+              </Button>
67
+            </FormItem>
68
+          </Form>
69
+        </ProCard.TabPane>
70
+      </ProCard>
71
+    </Card>
72
+  );
73
+};

+ 141
- 0
src/pages/ContentManagementSystem/Advertisement/index.jsx Wyświetl plik

@@ -0,0 +1,141 @@
1
+import { history, Link } from 'umi';
2
+import { useRef } from 'react';
3
+import { Button, Modal, message, Popconfirm, Tooltip } from 'antd';
4
+import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
5
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
+import ProTable, { TableDropdown } from '@ant-design/pro-table';
7
+
8
+export default (props) => {
9
+  const dataSource = [
10
+    {
11
+      id: 9,
12
+      key: '1',
13
+      name: '胡彦斌',
14
+      age: 32,
15
+      zz: '西湖区湖底公园1号',
16
+      status: 1,
17
+    },
18
+  ];
19
+
20
+  // 测试内容👆-------------------------
21
+
22
+  const actionRef = useRef();
23
+  const gotoDetail = (id) => {
24
+    history.push(`Advertisement/edit.jsx`);
25
+  };
26
+
27
+  const handleDelete = (e) => {
28
+    deleteNote(e.noteId).then((res) => {
29
+      message.success('删除成功');
30
+      actionRef.current.reload();
31
+    });
32
+  };
33
+
34
+  const handleOK = (record, data) => {
35
+    const titleCourse = record.status
36
+      ? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!'
37
+      : '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
38
+    Modal.confirm({
39
+      title: titleCourse,
40
+      okText: '确认',
41
+      cancelText: '取消',
42
+      onOk() {
43
+        publishNote(record.noteId, record.status ? 'off' : 'on').then((res) => {
44
+          message.success('操作成功');
45
+          actionRef.current.reload();
46
+        });
47
+      },
48
+    });
49
+  };
50
+  const actions = () => [
51
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
52
+      新增
53
+    </Button>,
54
+  ];
55
+  const columns = [
56
+    {
57
+      title: '名称',
58
+      key: 'title',
59
+      dataIndex: 'title',
60
+      search: false,
61
+    },
62
+    {
63
+      title: '图片',
64
+      key: 'thumb',
65
+      dataIndex: 'thumb',
66
+      search: false,
67
+      render: (t) => <img width={110} src={t} alt="" />,
68
+    },
69
+    {
70
+      title: '位置',
71
+      key: 'position',
72
+      dataIndex: 'position',
73
+      search: false,
74
+    },
75
+    {
76
+      title: '状态',
77
+      dataIndex: 'status',
78
+      // initialValue: 'all',
79
+      key: 'status',
80
+      valueEnum: {
81
+        0: { text: '已发布', status: 'Success' },
82
+        1: { text: '未发布', status: 'Error' },
83
+      },
84
+    },
85
+
86
+    {
87
+      title: (
88
+        <>
89
+          创建时间
90
+          <Tooltip placement="top">
91
+            <QuestionCircleOutlined style={{ marginLeft: 4 }} />
92
+          </Tooltip>
93
+        </>
94
+      ),
95
+      // hideInTable: true,
96
+      search: false,
97
+
98
+      key: 'createdAt',
99
+      dataIndex: 'createdAt',
100
+      valueType: 'date',
101
+      // render: (t) => formatterTime(t),
102
+      sorter: (a, b) => a.createdAt - b.createdAt, //时间排序
103
+    },
104
+    {
105
+      title: '操作',
106
+      valueType: 'option',
107
+      key: 'option',
108
+      ellipsis: true,
109
+      width: 200,
110
+      render: (_, record) => [
111
+        <Link key={2} to={`Advertisement/edit.jsx`}>
112
+          编辑
113
+        </Link>,
114
+        <Popconfirm
115
+          key={3}
116
+          title="您是否确认删除 ?"
117
+          onConfirm={() => handleDelete(record)}
118
+          okText="确定"
119
+          cancelText="取消"
120
+        >
121
+          <a href="#">删除</a>
122
+        </Popconfirm>,
123
+      ],
124
+    },
125
+  ];
126
+
127
+  return (
128
+    <PageHeaderWrapper>
129
+      <ProTable
130
+        dataSource={dataSource}
131
+        columns={columns}
132
+        // request={getNoteList} 请求
133
+        // rowKey="noteId"
134
+        search={false}
135
+        options={false}
136
+        toolBarRender={actions}
137
+        actionRef={actionRef}
138
+      />
139
+    </PageHeaderWrapper>
140
+  );
141
+};

+ 3
- 2
src/pages/ContentManagementSystem/BannerClassification/BannerClassificationEdit/index.jsx Wyświetl plik

@@ -40,8 +40,9 @@ export default (props) => {
40 40
             </FormItem>
41 41
             <FormItem label="位置" name="position" rules={[{ required: true, message: '请选择' }]}>
42 42
               <Select>
43
-                <Option value="index">首屏</Option>
44
-                <Option value="banner">banner页面</Option>
43
+                <Option value="index">首次引导页</Option>
44
+                <Option value="index">app启动页</Option>
45
+                <Option value="banner">banner</Option>
45 46
               </Select>
46 47
             </FormItem>
47 48
             <FormItem label="详细信息" colon={false}>

src/pages/MachineryGIS/index.jsx → src/pages/Machinery/GIS/index.jsx Wyświetl plik


+ 0
- 3
src/pages/MachineryStatistics/index.jsx Wyświetl plik

@@ -1,3 +0,0 @@
1
-export default (props) => {
2
-  return <div>农机统计</div>;
3
-};