Просмотр исходного кода

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

许静 5 лет назад
Родитель
Сommit
d87cc5c91c

+ 28
- 2
config/config.js Просмотреть файл

@@ -299,7 +299,6 @@ export default {
299 299
                 },
300 300
               ],
301 301
             },
302
-
303 302
             {
304 303
               path: '/staff',
305 304
               name: '员工管理',
@@ -329,6 +328,33 @@ export default {
329 328
 
330 329
               ],
331 330
             },
331
+            {
332
+              path: '/carouselFigure',
333
+              name: '轮播图管理',
334
+              component: '../layouts/BlankLayout',
335
+              routes: [
336
+                {
337
+                  path: '/carouselFigure/carouselFigureList',
338
+                  name: '轮播图列表',
339
+                  component: './carouselFigure/carouselFigureList',
340
+                },
341
+                {
342
+                  path: '/carouselFigure/editCarousel',
343
+                  name: '',
344
+                  component: './carouselFigure/editCarousel',
345
+                },
346
+                {
347
+                  path: '/carouselFigure/advertisingList',
348
+                  name: '开屏广告',
349
+                  component: './carouselFigure/advertisingList',
350
+                },
351
+                {
352
+                  path: '/carouselFigure/editAdvertising',
353
+                  name: '',
354
+                  component: './carouselFigure/editAdvertising',
355
+                },
356
+              ],
357
+            },
332 358
             {
333 359
               component: './404',
334 360
             },
@@ -392,7 +418,7 @@ export default {
392 418
 
393 419
   proxy: {
394 420
     '/api/': {
395
-      target: 'http://192.168.0.11:8080/',
421
+      target: 'http://127.0.0.1:8080/',
396 422
       changeOrigin: true,
397 423
       // pathRewrite: { '^/server': '' },
398 424
     },

+ 1
- 0
src/components/Wangedit/Wangedit.jsx Просмотреть файл

@@ -32,6 +32,7 @@ class Wangedit extends React.Component {
32 32
         this.props.onChange(html)
33 33
       }
34 34
     }
35
+    this.editor.customConfig.zIndex = 100
35 36
     this.editor.create()
36 37
     this.editor.txt.html(this.props.value)
37 38
   }

+ 230
- 0
src/pages/carouselFigure/advertisingList.jsx Просмотреть файл

@@ -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 toEdit = (contentId) => () => {
38
+    router.push({
39
+      pathname: '/carouselFigure/editAdvertising',
40
+      query: {
41
+        contentId
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={toEdit(row.contentId)}>编辑<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={toEdit()}>新增</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 Просмотреть файл

@@ -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 toEditCarouse = (contentId) => () => {
38
+    router.push({
39
+      pathname: '/carouselFigure/editCarousel',
40
+      query: {
41
+        contentId
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={toEditCarouse(row.contentId)}>编辑<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={toEditCarouse()}>新增</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

+ 155
- 0
src/pages/carouselFigure/editAdvertising.jsx Просмотреть файл

@@ -0,0 +1,155 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import XForm, { FieldTypes } from '../../components/XForm';
9
+import Wangedit from '../../components/Wangedit/Wangedit'
10
+import request from '../../utils/request'
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+/**
14
+ *
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+ const Edit = (props) => {
20
+  const [ tab, changeTab ] = useState('basic')
21
+  const contentId = props.location.query.contentId
22
+  const [ data, setData ] = useState({})
23
+  if(contentId){
24
+    useEffect(() => {
25
+      getDetail(contentId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getDetail = (contentId) => {
30
+    request({
31
+        url: '/api/admin/extendContent/' + contentId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/carouselFigure/advertisingList',
43
+    });
44
+  }
45
+ 
46
+    const fields = [
47
+      {
48
+        label: '所属项目',
49
+        name: 'buildingId',
50
+        render: <BuildSelect />,
51
+        value: data.buildingId,
52
+      },
53
+      {
54
+        label: '商品图片',
55
+        name: 'image',
56
+        type: FieldTypes.ImageUploader,
57
+        value: data.image,
58
+      },
59
+      {
60
+        label: '标题',
61
+        name: 'title',
62
+        type: FieldTypes.Text,
63
+        value: data.title,
64
+      },
65
+      // {
66
+      //   label: '发布位置',
67
+      //   name: 'showPosition',
68
+      //   type: FieldTypes.Select,
69
+      //   dict: [{
70
+      //     label: '首页',
71
+      //     value: 'index'
72
+      //   },
73
+      //   {
74
+      //     label: '商城',
75
+      //     value: 'mall'
76
+      //   }],
77
+      //   value: data.showPosition,
78
+      // },
79
+      {
80
+        label: '类型',
81
+        name: 'contentType',
82
+        type: FieldTypes.Select,
83
+        dict: [{
84
+          label: '活动',
85
+          value: 'activity'
86
+        },
87
+        {
88
+          label: '项目',
89
+          value: 'project'
90
+        },
91
+        {
92
+          label: '资讯',
93
+          value: 'news'
94
+        },
95
+        {
96
+          label: '其他',
97
+          value: 'other'
98
+        }],
99
+        value: data.contentType,
100
+      },
101
+      // {
102
+      //   label: '发布内容',
103
+      //   name: 'content',
104
+      //   render: <Wangedit />,
105
+      //   value: data.content,
106
+      // },
107
+      {
108
+        label: '状态',
109
+        name: 'status',
110
+        type: FieldTypes.Select,
111
+        dict: [{
112
+          label: "启用",
113
+          value: 1
114
+        },
115
+        {
116
+          label: "停用",
117
+          value: 0
118
+        },],
119
+        value: data.status != null ? data.status : 1,
120
+      },
121
+    ]
122
+  
123
+    const handleSubmit = val => { 
124
+      val.showType = 'screen'
125
+      if(contentId){
126
+        request({
127
+          url: '/api/admin/extendContent/'+contentId,
128
+          method: 'PUT',
129
+          data: val,
130
+        }).then((data) => {
131
+          cancelPage()
132
+        }).catch((err) => {
133
+          message.info(err.msg || err.message)
134
+        })
135
+      }else{
136
+        request({
137
+          url: '/api/admin/extendContent',
138
+          method: 'POST',
139
+          data: val,
140
+        }).then((data) => {
141
+          cancelPage()
142
+        }).catch((err) => {
143
+          message.info(err.msg || err.message)
144
+        })
145
+      }
146
+    }
147
+
148
+  return (
149
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
150
+  );
151
+ }
152
+
153
+
154
+
155
+export default Edit

+ 155
- 0
src/pages/carouselFigure/editCarousel.jsx Просмотреть файл

@@ -0,0 +1,155 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import XForm, { FieldTypes } from '../../components/XForm';
9
+import Wangedit from '../../components/Wangedit/Wangedit'
10
+import request from '../../utils/request'
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+/**
14
+ *
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+ const Edit = (props) => {
20
+  const [ tab, changeTab ] = useState('basic')
21
+  const contentId = props.location.query.contentId
22
+  const [ data, setData ] = useState({})
23
+  if(contentId){
24
+    useEffect(() => {
25
+      getDetail(contentId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getDetail = (contentId) => {
30
+    request({
31
+        url: '/api/admin/extendContent/' + contentId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/carouselFigure/carouselFigureList',
43
+    });
44
+  }
45
+ 
46
+    const fields = [
47
+      {
48
+        label: '所属项目',
49
+        name: 'buildingId',
50
+        render: <BuildSelect />,
51
+        value: data.buildingId,
52
+      },
53
+      {
54
+        label: '商品图片',
55
+        name: 'image',
56
+        type: FieldTypes.ImageUploader,
57
+        value: data.image,
58
+      },
59
+      {
60
+        label: '标题',
61
+        name: 'title',
62
+        type: FieldTypes.Text,
63
+        value: data.title,
64
+      },
65
+      {
66
+        label: '发布位置',
67
+        name: 'showPosition',
68
+        type: FieldTypes.Select,
69
+        dict: [{
70
+          label: '首页',
71
+          value: 'index'
72
+        },
73
+        {
74
+          label: '商城',
75
+          value: 'mall'
76
+        }],
77
+        value: data.showPosition,
78
+      },
79
+      {
80
+        label: '类型',
81
+        name: 'contentType',
82
+        type: FieldTypes.Select,
83
+        dict: [{
84
+          label: '活动',
85
+          value: 'activity'
86
+        },
87
+        {
88
+          label: '项目',
89
+          value: 'project'
90
+        },
91
+        {
92
+          label: '资讯',
93
+          value: 'news'
94
+        },
95
+        {
96
+          label: '其他',
97
+          value: 'other'
98
+        }],
99
+        value: data.contentType,
100
+      },
101
+      {
102
+        label: '发布内容',
103
+        name: 'content',
104
+        render: <Wangedit />,
105
+        value: data.content,
106
+      },
107
+      {
108
+        label: '状态',
109
+        name: 'status',
110
+        type: FieldTypes.Select,
111
+        dict: [{
112
+          label: "启用",
113
+          value: 1
114
+        },
115
+        {
116
+          label: "停用",
117
+          value: 0
118
+        },],
119
+        value: data.status != null ? data.status : 1,
120
+      },
121
+    ]
122
+  
123
+    const handleSubmit = val => { 
124
+      val.showType = 'banner'
125
+      if(contentId){
126
+        request({
127
+          url: '/api/admin/extendContent/'+contentId,
128
+          method: 'PUT',
129
+          data: val,
130
+        }).then((data) => {
131
+          cancelPage()
132
+        }).catch((err) => {
133
+          message.info(err.msg || err.message)
134
+        })
135
+      }else{
136
+        request({
137
+          url: '/api/admin/extendContent',
138
+          method: 'POST',
139
+          data: val,
140
+        }).then((data) => {
141
+          cancelPage()
142
+        }).catch((err) => {
143
+          message.info(err.msg || err.message)
144
+        })
145
+      }
146
+    }
147
+
148
+  return (
149
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
150
+  );
151
+ }
152
+
153
+
154
+
155
+export default Edit

+ 34
- 4
src/pages/news/list/NewsList.jsx Просмотреть файл

@@ -21,7 +21,7 @@ const tempDate = [{ code: 's101' }]
21 21
  */
22 22
 function CartBody(props) {
23 23
   const { data } = props
24
-
24
+  console.log(data);
25 25
   const cancelPage = () =>{
26 26
     router.push({
27 27
       pathname: '/news/list/NewsList',
@@ -66,6 +66,29 @@ function CartBody(props) {
66 66
         newsId
67 67
       },
68 68
     });
69
+  } 
70
+
71
+  function cancelRelease (newsId, newsStatus, buildingId,newsTypeId) {
72
+    console.log("newsId" + newsId + "status" + newsStatus);
73
+    Modal.confirm({
74
+      title: '确认发布或取消该资讯?',
75
+      okText: '确认',
76
+      cancelText: '取消',
77
+      onOk () {
78
+        request({
79
+          url: '/api/admin/taNews/' + newsId,
80
+          method: 'PUT',
81
+          data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
82
+        }).then((data) => {
83
+          message.info('操作成功!')
84
+          getList({ pageNum: 1, pageSize: 10 });
85
+        })
86
+      },
87
+      onCancel () {
88
+        console.log('Cancel');
89
+      },
90
+    });
91
+  
69 92
   }
70 93
 
71 94
   return (
@@ -108,10 +131,17 @@ function CartBody(props) {
108 131
               <span >:{ data.createDate }</span>
109 132
             </p>
110 133
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
111
-              <span style={{ color: '#1990FF' }}>
112
-                取消发布
113
-                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
134
+              {data.newsStatus === 0 ? 
135
+              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
136
+              取消发布
137
+              <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
138
+              </span>:
139
+              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
140
+              发布
141
+              <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
114 142
               </span>
143
+              }
144
+              
115 145
               <span style={{
116 146
                 color: '#FF4A4A', position: 'absolute', right: '0',
117 147
               }} onClick={changeNewsListStatus(data.newsId)}>

+ 3
- 3
src/pages/news/list/editNewsList.jsx Просмотреть файл

@@ -90,10 +90,10 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
90 90
   
91 91
     const handleSubmit = val => { 
92 92
       let {...submitValue} = val
93
-      if(dynamicId){
94
-        submitValue.dynamicId = dynamicId
93
+      if(newsId){
94
+        submitValue.newsId = newsId
95 95
         request({
96
-          url: '/api/admin/buildingDynamic/update',
96
+          url: '/api/admin/taNews/' + newsId,
97 97
           method: 'PUT',
98 98
           data: submitValue,
99 99
         }).then((data) => {