傅行帆 hace 5 años
padre
commit
d32d2de828

+ 18
- 2
config/config.js Ver fichero

@@ -289,7 +289,6 @@ export default {
289 289
                 },
290 290
               ],
291 291
             },
292
-
293 292
             {
294 293
               path: '/staff',
295 294
               name: '员工管理',
@@ -319,6 +318,23 @@ export default {
319 318
              
320 319
               ],
321 320
             },
321
+            {
322
+              path: '/carouselFigure',
323
+              name: '轮播图管理',
324
+              component: '../layouts/BlankLayout',
325
+              routes: [
326
+                {
327
+                  path: '/carouselFigure/carouselFigureList',
328
+                  name: '轮播图列表',
329
+                  component: './carouselFigure/carouselFigureList',
330
+                },
331
+                {
332
+                  path: '/carouselFigure/advertisingList',
333
+                  name: '开屏广告',
334
+                  component: './carouselFigure/advertisingList',
335
+                },
336
+              ],
337
+            },
322 338
             {
323 339
               component: './404',
324 340
             },
@@ -382,7 +398,7 @@ export default {
382 398
 
383 399
   proxy: {
384 400
     '/api/': {
385
-      target: 'http://192.168.0.11:8080/',
401
+      target: 'http://127.0.0.1:8080/',
386 402
       changeOrigin: true,
387 403
       // pathRewrite: { '^/server': '' },
388 404
     },

+ 230
- 0
src/pages/carouselFigure/advertisingList.jsx Ver fichero

@@ -0,0 +1,230 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+
10
+import request from '../../utils/request'
11
+
12
+const { Option } = Select;
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+//   const [page, changePage] = useState({})
18
+
19
+  useEffect(() => {
20
+    getList({ pageNum: 1, pageSize: 10, showType: 'screen' });
21
+  },[])
22
+
23
+  // 查询列表
24
+  const getList = (params) => {
25
+    request({
26
+        url: '/api/admin/extendContent',
27
+        method: 'GET',
28
+        params: { ...params },
29
+    }).then((data) => {
30
+        console.log(data)
31
+        setData(data)
32
+    })
33
+  }
34
+
35
+  
36
+// 跳转到编辑商品
37
+const toEditGoods = (dynamicId) => () => {
38
+    router.push({
39
+      pathname: '/activity/editActivity',
40
+      query: {
41
+        dynamicId
42
+      },
43
+    });
44
+  }
45
+  
46
+  const columns = [
47
+    {
48
+      title: '主图',
49
+      dataIndex: 'image',
50
+      key: 'image',
51
+      align: 'center',
52
+      render: (image) => <img src={image} className={styles.touxiang} />,
53
+    },
54
+    {
55
+      title: '类型',
56
+      dataIndex: 'contentType',
57
+      key: 'contentType',
58
+      align: 'center',
59
+      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : '' }</span>
60
+    },
61
+    {
62
+      title: '发布位置',
63
+      dataIndex: 'showPosition',
64
+      key: 'showPosition',
65
+      align: 'center',
66
+      render: (showPosition) => <span>{ showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : '' }</span>
67
+    },
68
+    {
69
+      title: '发布时间',
70
+      dataIndex: 'createDate',
71
+      key: 'createDate',
72
+      align: 'center',
73
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
74
+    },
75
+    {
76
+      title: '状态',
77
+      dataIndex: 'status',
78
+      key: 'status',
79
+      align: 'center',
80
+      render: (status)=> <><span>{status == 1 ? '启用' : '停用'}</span></>
81
+    },
82
+    {
83
+      title: '操作',
84
+      dataIndex: 'handle',
85
+      key: 'handle',
86
+      align: 'center',
87
+      render: (x,row) => <>
88
+                           <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={changeStatus(row)}>{ row.status === 1 ? '禁用' : '启用' }<Icon type="vertical-align-top" className={styles.edit} /></span>
89
+                           <span style={{ color: '#FF925C' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>
90
+                         </>
91
+    },
92
+  ];
93
+  
94
+  const finishDynamic = (row) => {
95
+      Modal.confirm({
96
+          title: '结束以后将无法编辑, 是否继续?',
97
+          okText: '确定',
98
+          cancelText: '取消',
99
+          onOk() {
100
+              request({
101
+                  url: '/api/admin/buildingDynamic/finish',
102
+                  method: 'PUT',
103
+                  data: {dynamicId: row.dynamicId, top: ""},
104
+              }).then((data) => {
105
+                  console.log(data)
106
+                  message.info('操作成功!')
107
+                  getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
108
+              }).catch((err) => {
109
+                  console.log(err)
110
+                  message.info(err.msg || err.message)
111
+              })
112
+          },
113
+        });
114
+  }
115
+  
116
+//   停用启用
117
+  const changeStatus = (row) => () => {
118
+      console.log(row)
119
+      if(row.status === 0) {
120
+        row.status = 1
121
+        Modal.confirm({
122
+          title: '确认发布此数据?',
123
+          okText: '确定',
124
+          cancelText: '取消',
125
+          onOk() {
126
+              request({
127
+                  url: '/api/admin/extendContent/'+row.contentId,
128
+                  method: 'PUT',
129
+                  data: row,
130
+              }).then((data) => {
131
+                  message.info('操作成功!')
132
+                  getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
133
+              }).catch((err) => {
134
+                  console.log(err)
135
+                  message.info(err.msg || err.message)
136
+              })
137
+          },
138
+        });
139
+      }else if(row.status === 1){
140
+        row.status = 0
141
+        Modal.confirm({
142
+          title: '确认停用此轮播图?',
143
+          okText: '确定',
144
+          cancelText: '取消',
145
+          onOk() {
146
+              request({
147
+                  url: '/api/admin/extendContent/'+row.contentId,
148
+                  method: 'PUT',
149
+                  data: row,
150
+              }).then((data) => {
151
+                  message.info('操作成功!')
152
+                  getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
153
+              }).catch((err) => {
154
+                  console.log(err)
155
+                  message.info(err.msg || err.message)
156
+              })
157
+          },
158
+        });
159
+      }
160
+
161
+  }
162
+  
163
+  const changePageNum = (pageNumber) => {
164
+      getList({ pageNum: pageNumber, pageSize: 10, showType: 'screen' })
165
+  }
166
+
167
+  // 提交事件
168
+const handleSubmit = (e, props) => {
169
+    e.preventDefault();
170
+    props.form.validateFields((err, values) => {
171
+      if (!err) {
172
+        console.log('提交数据: ', values)
173
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'screen' })
174
+      }
175
+    });
176
+  }
177
+
178
+  const { getFieldDecorator } = props.form
179
+  return (
180
+
181
+    <>
182
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
183
+        <Form.Item>
184
+          {getFieldDecorator('buildingId')(
185
+            <BuildSelect />,
186
+          )}
187
+        </Form.Item>
188
+        <Form.Item>
189
+          {getFieldDecorator('contentType')(
190
+            <Select style={{ width: '180px' }} placeholder="类型">
191
+              <Option value="activity">活动</Option>
192
+              <Option value="project">项目</Option>
193
+              <Option value="news">资讯</Option>
194
+              <Option value="other">其他</Option>
195
+            </Select>,
196
+          )}
197
+        </Form.Item>
198
+        <Form.Item>
199
+          {getFieldDecorator('showPosition')(
200
+            <Select style={{ width: '180px' }} placeholder="发布位置">
201
+              <Option value="mall">商城</Option>
202
+              <Option value="index">首页</Option>
203
+            </Select>,
204
+          )}
205
+        </Form.Item>
206
+        <Form.Item>
207
+          {getFieldDecorator('status')(
208
+            <Select style={{ width: '180px' }} placeholder="状态">
209
+              <Option value="1">启用</Option>
210
+              <Option value="0">停用</Option>
211
+            </Select>,
212
+          )}
213
+        </Form.Item>
214
+        <Form.Item>
215
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
216
+            搜索
217
+          </Button>
218
+        </Form.Item>
219
+      </Form>
220
+      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
221
+      <Table dataSource={data.records} columns={columns} pagination={false}/>
222
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
224
+      </div>
225
+    </>
226
+  )
227
+}
228
+const WrappedHeader = Form.create({ name: 'header' })(header);
229
+
230
+export default WrappedHeader

+ 230
- 0
src/pages/carouselFigure/carouselFigureList.jsx Ver fichero

@@ -0,0 +1,230 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+
10
+import request from '../../utils/request'
11
+
12
+const { Option } = Select;
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+//   const [page, changePage] = useState({})
18
+
19
+  useEffect(() => {
20
+    getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
21
+  },[])
22
+
23
+  // 查询列表
24
+  const getList = (params) => {
25
+    request({
26
+        url: '/api/admin/extendContent',
27
+        method: 'GET',
28
+        params: { ...params },
29
+    }).then((data) => {
30
+        console.log(data)
31
+        setData(data)
32
+    })
33
+  }
34
+
35
+  
36
+// 跳转到编辑商品
37
+const toEditGoods = (dynamicId) => () => {
38
+    router.push({
39
+      pathname: '/activity/editActivity',
40
+      query: {
41
+        dynamicId
42
+      },
43
+    });
44
+  }
45
+  
46
+  const columns = [
47
+    {
48
+      title: '主图',
49
+      dataIndex: 'image',
50
+      key: 'image',
51
+      align: 'center',
52
+      render: (image) => <img src={image} className={styles.touxiang} />,
53
+    },
54
+    {
55
+      title: '类型',
56
+      dataIndex: 'contentType',
57
+      key: 'contentType',
58
+      align: 'center',
59
+      render: (contentType) => <span>{ contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' : '' }</span>
60
+    },
61
+    {
62
+      title: '发布位置',
63
+      dataIndex: 'showPosition',
64
+      key: 'showPosition',
65
+      align: 'center',
66
+      render: (showPosition) => <span>{ showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : '' }</span>
67
+    },
68
+    {
69
+      title: '发布时间',
70
+      dataIndex: 'createDate',
71
+      key: 'createDate',
72
+      align: 'center',
73
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
74
+    },
75
+    {
76
+      title: '状态',
77
+      dataIndex: 'status',
78
+      key: 'status',
79
+      align: 'center',
80
+      render: (status)=> <><span>{status == 1 ? '启用' : '停用'}</span></>
81
+    },
82
+    {
83
+      title: '操作',
84
+      dataIndex: 'handle',
85
+      key: 'handle',
86
+      align: 'center',
87
+      render: (x,row) => <>
88
+                           <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={changeStatus(row)}>{ row.status === 1 ? '禁用' : '启用' }<Icon type="vertical-align-top" className={styles.edit} /></span>
89
+                           <span style={{ color: '#FF925C' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>
90
+                         </>
91
+    },
92
+  ];
93
+  
94
+  const finishDynamic = (row) => {
95
+      Modal.confirm({
96
+          title: '结束以后将无法编辑, 是否继续?',
97
+          okText: '确定',
98
+          cancelText: '取消',
99
+          onOk() {
100
+              request({
101
+                  url: '/api/admin/buildingDynamic/finish',
102
+                  method: 'PUT',
103
+                  data: {dynamicId: row.dynamicId, top: ""},
104
+              }).then((data) => {
105
+                  console.log(data)
106
+                  message.info('操作成功!')
107
+                  getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
108
+              }).catch((err) => {
109
+                  console.log(err)
110
+                  message.info(err.msg || err.message)
111
+              })
112
+          },
113
+        });
114
+  }
115
+  
116
+//   停用启用
117
+  const changeStatus = (row) => () => {
118
+      console.log(row)
119
+      if(row.status === 0) {
120
+        row.status = 1
121
+        Modal.confirm({
122
+          title: '确认发布此数据?',
123
+          okText: '确定',
124
+          cancelText: '取消',
125
+          onOk() {
126
+              request({
127
+                  url: '/api/admin/extendContent/'+row.contentId,
128
+                  method: 'PUT',
129
+                  data: row,
130
+              }).then((data) => {
131
+                  message.info('操作成功!')
132
+                  getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
133
+              }).catch((err) => {
134
+                  console.log(err)
135
+                  message.info(err.msg || err.message)
136
+              })
137
+          },
138
+        });
139
+      }else if(row.status === 1){
140
+        row.status = 0
141
+        Modal.confirm({
142
+          title: '确认停用此轮播图?',
143
+          okText: '确定',
144
+          cancelText: '取消',
145
+          onOk() {
146
+              request({
147
+                  url: '/api/admin/extendContent/'+row.contentId,
148
+                  method: 'PUT',
149
+                  data: row,
150
+              }).then((data) => {
151
+                  message.info('操作成功!')
152
+                  getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
153
+              }).catch((err) => {
154
+                  console.log(err)
155
+                  message.info(err.msg || err.message)
156
+              })
157
+          },
158
+        });
159
+      }
160
+
161
+  }
162
+  
163
+  const changePageNum = (pageNumber) => {
164
+      getList({ pageNum: pageNumber, pageSize: 10, showType: 'banner' })
165
+  }
166
+
167
+  // 提交事件
168
+const handleSubmit = (e, props) => {
169
+    e.preventDefault();
170
+    props.form.validateFields((err, values) => {
171
+      if (!err) {
172
+        console.log('提交数据: ', values)
173
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' })
174
+      }
175
+    });
176
+  }
177
+
178
+  const { getFieldDecorator } = props.form
179
+  return (
180
+
181
+    <>
182
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
183
+        <Form.Item>
184
+          {getFieldDecorator('buildingId')(
185
+            <BuildSelect />,
186
+          )}
187
+        </Form.Item>
188
+        <Form.Item>
189
+          {getFieldDecorator('contentType')(
190
+            <Select style={{ width: '180px' }} placeholder="类型">
191
+              <Option value="activity">活动</Option>
192
+              <Option value="project">项目</Option>
193
+              <Option value="news">资讯</Option>
194
+              <Option value="other">其他</Option>
195
+            </Select>,
196
+          )}
197
+        </Form.Item>
198
+        <Form.Item>
199
+          {getFieldDecorator('showPosition')(
200
+            <Select style={{ width: '180px' }} placeholder="发布位置">
201
+              <Option value="mall">商城</Option>
202
+              <Option value="index">首页</Option>
203
+            </Select>,
204
+          )}
205
+        </Form.Item>
206
+        <Form.Item>
207
+          {getFieldDecorator('status')(
208
+            <Select style={{ width: '180px' }} placeholder="状态">
209
+              <Option value="1">启用</Option>
210
+              <Option value="0">停用</Option>
211
+            </Select>,
212
+          )}
213
+        </Form.Item>
214
+        <Form.Item>
215
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
216
+            搜索
217
+          </Button>
218
+        </Form.Item>
219
+      </Form>
220
+      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
221
+      <Table dataSource={data.records} columns={columns} pagination={false}/>
222
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
224
+      </div>
225
+    </>
226
+  )
227
+}
228
+const WrappedHeader = Form.create({ name: 'header' })(header);
229
+
230
+export default WrappedHeader