dingxin 5 yıl önce
ebeveyn
işleme
56d5d04223

+ 45
- 4
config/config.js Dosyayı Görüntüle

@@ -122,6 +122,11 @@ export default {
122 122
                   name: '项目列表',
123 123
                   component: './building/list/index',
124 124
                 },
125
+                {
126
+                  path: '/building/list/add',
127
+                  name: '', // 项目添加
128
+                  component: './building/list/add/index',
129
+                },
125 130
                 {
126 131
                   path: '/building/type',
127 132
                   name: '项目类型',
@@ -144,6 +149,11 @@ export default {
144 149
                   name: '客户列表',
145 150
                   component: './customer/customerlist/index',
146 151
                 },
152
+                {
153
+                  path: '/customer/customerlist/customerDetail',
154
+                  name: '',
155
+                  component: './customer/customerlist/customerDetail',
156
+                },
147 157
                 {
148 158
                   path: '/customer/drift/list',
149 159
                   name: '游客列表',
@@ -265,6 +275,11 @@ export default {
265 275
                   name: '资讯列表',
266 276
                   component: './news/list/NewsList',
267 277
                 },
278
+                {
279
+                  path: '/news/list/editNewsList',
280
+                  name: '',
281
+                  component: './news/list/editNewsList',
282
+                },
268 283
               ],
269 284
             },
270 285
             {
@@ -289,7 +304,6 @@ export default {
289 304
                 },
290 305
               ],
291 306
             },
292
-
293 307
             {
294 308
               path: '/staff',
295 309
               name: '员工管理',
@@ -305,7 +319,7 @@ export default {
305 319
                   name: '',
306 320
                   component: './staff/list/editStaff',
307 321
                 },
308
-             
322
+
309 323
                 {
310 324
                   path: '/staff/RoleList',
311 325
                   name: '角色管理',
@@ -316,7 +330,34 @@ export default {
316 330
                   name: '',
317 331
                   component: './staff/list/editRole',
318 332
                 },
319
-             
333
+
334
+              ],
335
+            },
336
+            {
337
+              path: '/carouselFigure',
338
+              name: '轮播图管理',
339
+              component: '../layouts/BlankLayout',
340
+              routes: [
341
+                {
342
+                  path: '/carouselFigure/carouselFigureList',
343
+                  name: '轮播图列表',
344
+                  component: './carouselFigure/carouselFigureList',
345
+                },
346
+                {
347
+                  path: '/carouselFigure/editCarousel',
348
+                  name: '',
349
+                  component: './carouselFigure/editCarousel',
350
+                },
351
+                {
352
+                  path: '/carouselFigure/advertisingList',
353
+                  name: '开屏广告',
354
+                  component: './carouselFigure/advertisingList',
355
+                },
356
+                {
357
+                  path: '/carouselFigure/editAdvertising',
358
+                  name: '',
359
+                  component: './carouselFigure/editAdvertising',
360
+                },
320 361
               ],
321 362
             },
322 363
             {
@@ -382,7 +423,7 @@ export default {
382 423
 
383 424
   proxy: {
384 425
     '/api/': {
385
-      target: 'http://192.168.0.11:8080/',
426
+      target: 'http://127.0.0.1:8080/',
386 427
       changeOrigin: true,
387 428
       // pathRewrite: { '^/server': '' },
388 429
     },

+ 4
- 4
src/components/EchartsTest/index.jsx Dosyayı Görüntüle

@@ -3,15 +3,15 @@ import React, { Component } from 'react';
3 3
 // 引入 ECharts 主模块
4 4
 import echarts from 'echarts/lib/echarts';
5 5
 // 引入柱状图
6
-import  'echarts/lib/chart/bar';
6
+import 'echarts/lib/chart/bar';
7 7
 // 引入提示框和标题组件
8 8
 import 'echarts/lib/component/tooltip';
9 9
 import 'echarts/lib/component/title';
10 10
 class Chart extends Component {
11 11
 
12
-  render() { 
13
-    return ( <div></div> );
12
+  render() {
13
+    return (<div></div>);
14 14
   }
15 15
 }
16
- 
16
+
17 17
 export default Chart;

+ 40
- 0
src/components/SelectButton/NewTypeSelect.jsx Dosyayı Görüntüle

@@ -0,0 +1,40 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Select } from 'antd';
3
+
4
+import request from '../../utils/request'
5
+
6
+const { Option } = Select;
7
+
8
+/**
9
+ *
10
+ *
11
+ * @param {*} props
12
+ * @returns
13
+ */
14
+const NewsTypeSelect = (props) => {
15
+  const [ data, setData ] = useState([])
16
+
17
+  useEffect(() => {
18
+    getCityList();
19
+  },[])
20
+
21
+  const getCityList = (e) => {
22
+    request({
23
+        url: '/api/admin/taNewsType',
24
+        method: 'GET',
25
+        params: {pageNum: 1,pageSize: 999},
26
+    }).then((data) => {
27
+        setData(data.records)
28
+    })
29
+  }
30
+
31
+  return (
32
+      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择类型" onChange={props.onChange}>
33
+          {data.map(type => (
34
+            <Option key={type.newsTypeId}>{type.newsTypeName}</Option>
35
+          ))}
36
+      </Select>
37
+  )
38
+}
39
+export default NewsTypeSelect
40
+

+ 1
- 0
src/components/Wangedit/Wangedit.jsx Dosyayı Görüntüle

@@ -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
   }

+ 10
- 0
src/global.less Dosyayı Görüntüle

@@ -110,4 +110,14 @@ ol {
110 110
 }
111 111
 .ant-table{
112 112
   line-height: 3;
113
+}
114
+.ant-modal-header{
115
+  border-bottom: none;
116
+  .ant-modal-title{
117
+    font-size: 24px;
118
+    line-height: 50px;
119
+  }
120
+}
121
+.ant-modal-footer{
122
+  border-top:none;
113 123
 }

+ 217
- 0
src/pages/building/list/add/components/base.jsx Dosyayı Görüntüle

@@ -0,0 +1,217 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../../utils/request';
5
+import apis from '../../../../../services/apis';
6
+import Styles from '../style.less';
7
+import { router } from 'umi';
8
+import ImageUpload from '../../../../../components/XForm/ImageUpload'
9
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
+import TagGroup from './tags'
11
+
12
+const { Option } = Select
13
+const { TabPane } = Tabs;
14
+
15
+const formItemLayout = {
16
+  labelCol: {
17
+    xs: { span: 24 },
18
+    sm: { span: 2 },
19
+  },
20
+  wrapperCol: {
21
+    xs: { span: 24 },
22
+    sm: { span: 16 },
23
+  },
24
+};
25
+
26
+function AddBuilding(props) {
27
+  // eslint-disable-next-line react-hooks/rules-of-hooks
28
+  const [dataSource, setDataSource] = useState({ records: [] })
29
+
30
+  const [buildingAreaTags, setBuildingAreaTags] = useState({ tags: ['Unremovable', 'Tag 2', 'Tag 3'], inputVisible: false, inputValue: '' })
31
+
32
+
33
+  const { getFieldDecorator } = props.form;
34
+
35
+  function handleSubmit(e) {
36
+    e.preventDefault();
37
+    props.form.validateFieldsAndScroll((err, values) => {
38
+      if (!err) {
39
+        console.log('Received values of form: ', values);
40
+      }
41
+    });
42
+  }
43
+
44
+  return (
45
+        <Form {...formItemLayout} onSubmit={handleSubmit}>
46
+          <Form.Item label="楼盘编号">
47
+            {getFieldDecorator('code')(<Input />)}
48
+          </Form.Item>
49
+          <Form.Item label="楼盘名称" hasFeedback>
50
+            {getFieldDecorator('buildingName')(<Input />)}
51
+          </Form.Item>
52
+          <Form.Item label="别名" hasFeedback>
53
+            {getFieldDecorator('name')(<Input />)}
54
+          </Form.Item>
55
+          <Form.Item label="项目类型" hasFeedback>
56
+            {getFieldDecorator('name')(<Input />)}
57
+          </Form.Item>
58
+          <Form.Item label="均价" hasFeedback>
59
+            {getFieldDecorator('price')(<Input />)}
60
+          </Form.Item>
61
+          <Form.Item label="开盘时间" hasFeedback>
62
+            {getFieldDecorator('openingDate')(<DatePicker />)}
63
+          </Form.Item>
64
+          <Form.Item label="电话" hasFeedback>
65
+            {getFieldDecorator('tel')(<Input />)}
66
+          </Form.Item>
67
+          <Form.Item label="项目动态" hasFeedback>
68
+            {getFieldDecorator('dynamic')(<Input />)}
69
+          </Form.Item>
70
+          <Form.Item label="物业类型" hasFeedback>
71
+            {getFieldDecorator('buildingProperty')(
72
+              <Select mode="multiple" placeholder="物业类型" style={{ width: '1016px' }}>
73
+                <Option value="未知">未知</Option>
74
+              </Select>,
75
+            )}
76
+          </Form.Item>
77
+          <Form.Item label="销售状态" hasFeedback>
78
+            {getFieldDecorator('marketStatus')(<Input />)}
79
+          </Form.Item>
80
+          <Form.Item label="标签" hasFeedback>
81
+            {getFieldDecorator('tags')(
82
+              <Select mode="multiple" placeholder="标签" style={{ width: '1016px' }}>
83
+              <Option value="未知">未知</Option>
84
+              </Select>,
85
+            )}
86
+          </Form.Item>
87
+          <Form.Item label="项目主图" hasFeedback>
88
+            {getFieldDecorator('tags')(
89
+              <ImageUpload />,
90
+            )}
91
+          </Form.Item>
92
+          <Form.Item label="地址图片" hasFeedback>
93
+            {getFieldDecorator('tags')(
94
+              <ImageUpload />,
95
+            )}
96
+          </Form.Item>
97
+          <Form.Item label="海报底图" hasFeedback>
98
+            {getFieldDecorator('tags')(
99
+              <ImageUpload />,
100
+            )}
101
+          </Form.Item>
102
+          <Form.Item label="排序" hasFeedback>
103
+            {getFieldDecorator('orderNo')(<Input />)}
104
+          </Form.Item>
105
+          <Form.Item label="优惠信息" hasFeedback>
106
+            {getFieldDecorator('discount')(<Input />)}
107
+          </Form.Item>
108
+          <Form.Item label="首页推荐" hasFeedback>
109
+            {getFieldDecorator('isMain')(
110
+            <Radio.Group>
111
+              <Radio value={1}>是</Radio>
112
+              <Radio value={2}>否</Radio>
113
+            </Radio.Group>,
114
+            )}
115
+          </Form.Item>
116
+          <Form.Item label="所在城市" hasFeedback>
117
+            {getFieldDecorator('cityId')(
118
+              <Select placeholder="选择城市" style={{ width: '200px' }}>
119
+                <Option value="red">Red</Option>
120
+              </Select>,
121
+            )}
122
+          </Form.Item>
123
+          <Form.Item label="楼盘区域" hasFeedback>
124
+            {getFieldDecorator('buildingArea')(<Input />)}
125
+          </Form.Item>
126
+          <Form.Item label="项目地址" hasFeedback>
127
+            {getFieldDecorator('address')(<Input />)}
128
+          </Form.Item>
129
+          <Form.Item label="项目坐标" hasFeedback>
130
+            {getFieldDecorator('coordinate')(<Input disabled />)}
131
+          </Form.Item>
132
+          <Form.Item label="项目地址" hasFeedback>
133
+            {getFieldDecorator('coordinate')(<Input />)}
134
+          </Form.Item>
135
+          <Form.Item label="周边交通" hasFeedback>
136
+            {getFieldDecorator('buildingArea')(
137
+              <TagGroup />,
138
+            )}
139
+          </Form.Item>
140
+          <Form.Item label="周边交通" hasFeedback>
141
+            {getFieldDecorator('buildingMall')(
142
+              <TagGroup />,
143
+            )}
144
+          </Form.Item>
145
+          <Form.Item label="周边学校" hasFeedback>
146
+            {getFieldDecorator('buildingEdu')(
147
+              <TagGroup />,
148
+            )}
149
+          </Form.Item>
150
+          <Form.Item label="周边医院" hasFeedback>
151
+            {getFieldDecorator('buildingHospital')(
152
+              <TagGroup />,
153
+            )}
154
+          </Form.Item>
155
+          <Form.Item label="周边银行" hasFeedback>
156
+            {getFieldDecorator('buildingBank')(
157
+              <TagGroup />,
158
+            )}
159
+          </Form.Item>
160
+          <Form.Item label="周边餐饮" hasFeedback>
161
+            {getFieldDecorator('buildingRestaurant')(
162
+              <TagGroup />,
163
+            )}
164
+          </Form.Item>
165
+          <Form.Item label="绿化率" hasFeedback>
166
+            {getFieldDecorator('greeningRate')(<Input />)}
167
+          </Form.Item>
168
+          <Form.Item label="容积率" hasFeedback>
169
+            {getFieldDecorator('volumeRate')(<Input />)}
170
+          </Form.Item>
171
+          <Form.Item label="车位比" hasFeedback>
172
+            {getFieldDecorator('parkingRate')(<Input />)}
173
+          </Form.Item>
174
+          <Form.Item label="规划户数" hasFeedback>
175
+            {getFieldDecorator('familyNum')(<Input />)}
176
+          </Form.Item>
177
+          <Form.Item label="物业公司" hasFeedback>
178
+            {getFieldDecorator('serviceCompany')(<Input />)}
179
+          </Form.Item>
180
+          <Form.Item label="物业费" hasFeedback>
181
+            {getFieldDecorator('serviceFee')(<Input />)}
182
+          </Form.Item>
183
+          <Form.Item label="装修标准" hasFeedback>
184
+            {getFieldDecorator('decoration')(<Input />)}
185
+          </Form.Item>
186
+          <Form.Item label="交房时间" hasFeedback>
187
+            {getFieldDecorator('receivedDate')(<DatePicker />)}
188
+          </Form.Item>
189
+          <Form.Item label="产权年限" hasFeedback>
190
+            {getFieldDecorator('rightsYear')(<Input />)}
191
+          </Form.Item>
192
+          <Form.Item label="预售许可证" hasFeedback>
193
+            {getFieldDecorator('decoration')(
194
+              <ImageUpload />,
195
+            )}
196
+          </Form.Item>
197
+          <Form.Item label="项目备注" hasFeedback>
198
+            {getFieldDecorator('remark')(
199
+              <Wangedit />,
200
+            )}
201
+          </Form.Item>
202
+          <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
203
+            <Button type="primary" htmlType="submit">
204
+                确定
205
+            </Button>
206
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
207
+            <Button onClick={() => router.go(-1)}>
208
+                取消
209
+            </Button>
210
+          </Form.Item>
211
+        </Form>
212
+  )
213
+}
214
+
215
+const WrappedAddBuildingForm = Form.create({ name: 'addBuilding' })(AddBuilding);
216
+
217
+export default WrappedAddBuildingForm

+ 112
- 0
src/pages/building/list/add/components/imageSet.jsx Dosyayı Görüntüle

@@ -0,0 +1,112 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../../utils/request';
5
+import apis from '../../../../../services/apis';
6
+import Styles from '../style.less';
7
+import { router } from 'umi';
8
+
9
+
10
+const saleType = [
11
+  {
12
+    id: 1,
13
+    name: '待定',
14
+  },
15
+  {
16
+    id: 2,
17
+    name: '售罄',
18
+  },
19
+  {
20
+    id: 3,
21
+    name: '在售',
22
+  },
23
+]
24
+
25
+/**
26
+ *图片设置
27
+ *
28
+ * @param {*} props
29
+ * @returns
30
+ */
31
+function imageSet(props) {
32
+  // eslint-disable-next-line react-hooks/rules-of-hooks
33
+  const [data, setData] = useState([])
34
+
35
+  // eslint-disable-next-line react-hooks/rules-of-hooks
36
+  useEffect(() => {
37
+    getList()
38
+  }, [])
39
+
40
+  function openNotificationWithIcon(type, message) {
41
+    notification[type]({
42
+      message,
43
+      description:
44
+        '',
45
+    });
46
+  }
47
+
48
+  function getList(params) {
49
+    console.log(props)
50
+    // 网路请求
51
+    const { url, method } = apis.building.buildingApartment
52
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(props.building.buildingId)
53
+
54
+    request({ url: tempUrl, method, params: { ...params } }).then(res => {
55
+      setData(res)
56
+    }).catch(err => {
57
+      openNotificationWithIcon('error', err)
58
+    })
59
+  }
60
+
61
+
62
+  const columns = [
63
+    {
64
+      title: '名称',
65
+      dataIndex: 'apartmentName',
66
+      key: 'apartmentName',
67
+    },
68
+    {
69
+      title: '类型',
70
+      dataIndex: 'apartmentType',
71
+      key: 'apartmentType',
72
+      render: (_, record) => <span>{ record.apartmentType === 'apart' ? '户型' : '相册' }</span>,
73
+    },
74
+    {
75
+      title: '销售状态',
76
+      dataIndex: 'marketStatus',
77
+      key: 'marketStatus',
78
+      render: (_, record) => <span>{ (saleType.filter(x => x.id == record.marketStatus)[0] || {}).name }</span>,
79
+    },
80
+    {
81
+      title: '备注',
82
+      dataIndex: 'remark',
83
+      key: 'remark',
84
+    },
85
+    {
86
+      title: '创建时间',
87
+      dataIndex: 'createDate',
88
+      key: 'createDate',
89
+      render: (_, record) => <span>{ moment(record.createDate).format('YYYY-MM-DD') }</span>,
90
+    },
91
+    {
92
+      title: '操作',
93
+      dataIndex: 'apartmentId',
94
+      key: 'apartmentId',
95
+      render: (_, record) => (
96
+        <>
97
+          <Button type="link" style={{ color: 'red' }}>编辑</Button>
98
+          <Button type="link" style={{ color: 'red' }}>删除</Button>
99
+        </>
100
+      ),
101
+    },
102
+  ]
103
+
104
+  return (
105
+    <>
106
+      <Button type="primary">新增图片库</Button>
107
+      <Table dataSource={data} columns={columns} pagination={false} />
108
+    </>
109
+  )
110
+}
111
+
112
+export default imageSet

+ 82
- 0
src/pages/building/list/add/components/tags.jsx Dosyayı Görüntüle

@@ -0,0 +1,82 @@
1
+import React from 'react'
2
+import { Tag, Input, Tooltip, Icon } from 'antd';
3
+
4
+class EditableTagGroup extends React.Component {
5
+  state = {
6
+    tags: [],
7
+    inputVisible: false,
8
+    inputValue: '',
9
+  };
10
+
11
+  handleClose = removedTag => {
12
+    const tags = this.state.tags.filter(tag => tag !== removedTag);
13
+    console.log(tags);
14
+    this.setState({ tags });
15
+  };
16
+
17
+  showInput = () => {
18
+    this.setState({ inputVisible: true }, () => this.input.focus());
19
+  };
20
+
21
+  handleInputChange = e => {
22
+    this.setState({ inputValue: e.target.value });
23
+  };
24
+
25
+  handleInputConfirm = () => {
26
+    const { inputValue } = this.state;
27
+    let { tags } = this.state;
28
+    if (inputValue && tags.indexOf(inputValue) === -1) {
29
+      tags = [...tags, inputValue];
30
+    }
31
+    console.log(tags);
32
+    this.setState({
33
+      tags,
34
+      inputVisible: false,
35
+      inputValue: '',
36
+    });
37
+  };
38
+
39
+  saveInputRef = input => (this.input = input);
40
+
41
+  render() {
42
+    const { tags, inputVisible, inputValue } = this.state;
43
+    return (
44
+      <div>
45
+        {tags.map((tag, index) => {
46
+          const isLongTag = tag.length > 20;
47
+          const tagElem = (
48
+            <Tag key={tag} closable={index !== 0} onClose={() => this.handleClose(tag)}>
49
+              {isLongTag ? `${tag.slice(0, 20)}...` : tag}
50
+            </Tag>
51
+          );
52
+          return isLongTag ? (
53
+            <Tooltip title={tag} key={tag}>
54
+              {tagElem}
55
+            </Tooltip>
56
+          ) : (
57
+            tagElem
58
+          );
59
+        })}
60
+        {inputVisible && (
61
+          <Input
62
+            ref={this.saveInputRef}
63
+            type="text"
64
+            size="small"
65
+            style={{ width: 78 }}
66
+            value={inputValue}
67
+            onChange={this.handleInputChange}
68
+            onBlur={this.handleInputConfirm}
69
+            onPressEnter={this.handleInputConfirm}
70
+          />
71
+        )}
72
+        {!inputVisible && (
73
+          <Tag onClick={this.showInput} style={{ background: '#fff', borderStyle: 'dashed' }}>
74
+            <Icon type="plus" /> 新建
75
+          </Tag>
76
+        )}
77
+      </div>
78
+    );
79
+  }
80
+}
81
+
82
+export default EditableTagGroup

+ 67
- 0
src/pages/building/list/add/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,67 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from './style.less';
7
+import { router } from 'umi';
8
+
9
+
10
+import ImageUpload from '../../../../components/XForm/ImageUpload'
11
+import Wangedit from '../../../../components/Wangedit/Wangedit'
12
+import TagGroup from './components/tags'
13
+import Base from './components/base'
14
+import ImageSet from './components/imageSet'
15
+
16
+
17
+const { Option } = Select
18
+const { TabPane } = Tabs;
19
+
20
+const formItemLayout = {
21
+  labelCol: {
22
+    xs: { span: 24 },
23
+    sm: { span: 2 },
24
+  },
25
+  wrapperCol: {
26
+    xs: { span: 24 },
27
+    sm: { span: 16 },
28
+  },
29
+};
30
+
31
+function AddBuilding(props) {
32
+  // eslint-disable-next-line react-hooks/rules-of-hooks
33
+  const [dataSource, setDataSource] = useState({ records: [] })
34
+
35
+  const [buildingAreaTags, setBuildingAreaTags] = useState({ tags: ['Unremovable', 'Tag 2', 'Tag 3'], inputVisible: false, inputValue: '' })
36
+
37
+
38
+  const { getFieldDecorator } = props.form;
39
+
40
+  function handleSubmit(e) {
41
+    e.preventDefault();
42
+    props.form.validateFieldsAndScroll((err, values) => {
43
+      if (!err) {
44
+        console.log('Received values of form: ', values);
45
+      }
46
+    });
47
+  }
48
+
49
+  function tabsCallback(key) {
50
+    console.log(key);
51
+  }
52
+
53
+  return (
54
+    <Tabs defaultActiveKey="1" onChange={tabsCallback}>
55
+      <TabPane tab="基本信息" key="1">
56
+        <Base />
57
+      </TabPane>
58
+      <TabPane tab="图片" key="2">
59
+        <ImageSet building={{ buildingId: '159fd19bb973b6972c10fbebf07ddeb1' }} />
60
+      </TabPane>
61
+    </Tabs>
62
+  )
63
+}
64
+
65
+const WrappedAddBuildingForm = Form.create({ name: 'addBuilding' })(AddBuilding);
66
+
67
+export default WrappedAddBuildingForm

+ 0
- 0
src/pages/building/list/add/style.less Dosyayı Görüntüle


+ 7
- 1
src/pages/building/list/index.jsx Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7
+import { router } from 'umi';
7 8
 
8 9
 
9 10
 const { Option } = Select;
@@ -137,6 +138,11 @@ function body(props) {
137 138
     console.log(value, dateString)
138 139
   }
139 140
 
141
+
142
+  function toAdd() {
143
+    router.push({ pathname: '/building/list/add' })
144
+  }
145
+
140 146
   return (
141 147
     <>
142 148
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
@@ -200,7 +206,7 @@ function body(props) {
200 206
           </Button>
201 207
         </Form.Item>
202 208
       </Form>
203
-      <Button type="primary" className={Styles.addButton}>
209
+      <Button type="primary" className={Styles.addButton} onClick={() => toAdd()}>
204 210
         新增楼盘
205 211
       </Button>
206 212
 

+ 230
- 0
src/pages/carouselFigure/advertisingList.jsx Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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

+ 88
- 0
src/pages/customer/customerlist/customerDetail.jsx Dosyayı Görüntüle

@@ -0,0 +1,88 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Table } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from './style.less';
5
+
6
+import router from 'umi/router';
7
+
8
+
9
+function header(props) {
10
+
11
+  /**
12
+   * @param {*} props
13
+   * @returns
14
+   */
15
+  const [data, setData] = useState([{ records: [] }])
16
+
17
+  const columns = [
18
+    {
19
+      title: '访问事件',
20
+      dataIndex: 'event',
21
+      key: 'event',
22
+      align: 'center',
23
+    },
24
+    {
25
+      title: '访问时间',
26
+      dataIndex: 'time',
27
+      key: 'time',
28
+      align: 'center',
29
+
30
+    },
31
+    {
32
+      title: '停留时间',
33
+      dataIndex: 'stayTime',
34
+      key: 'stayTime',
35
+      align: 'center',
36
+    },
37
+  ]
38
+  return (
39
+    <>
40
+      <div className={styles.cardBox}>
41
+        <div className={styles.leftBox}>
42
+          <p className={styles.tit}>置业顾问信息</p>
43
+          <img className={styles.touxiang} src="http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg" />
44
+          <p className={styles.infoItem}>姓名:赵海伟</p>
45
+          <p className={styles.infoItem}>部门:营销部</p>
46
+          <p className={styles.infoItem}>岗位:营销经理</p>
47
+          <p className={styles.infoItem}>号码:13160056061 </p>
48
+          <p className={styles.infoItem}>公司:葛洲坝·南京中国府</p>
49
+          <p className={styles.infoItem}>所属项目:葛洲坝·南京中国府</p>
50
+        </div>
51
+        <div className={styles.rightBox}>
52
+          <p className={styles.tit}>客户信息</p>
53
+          <img className={styles.touxiang} src="http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg" />
54
+          <div className={styles.right}>
55
+            <p className={styles.rightItem}>用户名称:董浩业</p>
56
+            <p className={styles.rightItem}>手机号码:15050893674</p>
57
+            <p className={styles.rightItem}>来访渠道:活动分享</p>
58
+          </div>
59
+          <p className={styles.rightItem}>访问时长:0秒</p>
60
+          <p className={styles.rightItem}>访问次数:</p>
61
+          <p className={styles.rightItem}>预约人数:</p>
62
+          <p className={styles.rightItem}>首次访问时间:</p>
63
+          <p className={styles.rightItem}>预约到访时间:</p>
64
+          <div className={styles.rightInfo}>
65
+            <p className={styles.rightItem}>国家:</p>
66
+            <p className={styles.rightItem}>省份:</p>
67
+            <p className={styles.rightItem}>城市:</p>
68
+            <p className={styles.rightItem}>详细信息:</p>
69
+            <p className={styles.rightItem}>意向项目:</p>
70
+            <p className={styles.rightItem}>价格区间:</p>
71
+            <p className={styles.rightItem}>客户说明:</p>
72
+            <p className={styles.rightItem}>客户描述:</p>
73
+            <p className={styles.rightItem}>需求类型:</p>
74
+            <p className={styles.rightItem}>物业类型:</p>
75
+          </div>
76
+        </div>
77
+      </div>
78
+      <div className={styles.recordBox}>
79
+        <p className={styles.tableName}>访问记录</p>
80
+        <Table dataSource={data.records} columns={columns} pagination={false} />
81
+      </div>
82
+
83
+    </>
84
+  )
85
+}
86
+const WrappedHeader = Form.create({ name: 'header' })(header);
87
+
88
+export default WrappedHeader

+ 31
- 25
src/pages/customer/customerlist/index.jsx Dosyayı Görüntüle

@@ -4,6 +4,7 @@ import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7
+import router from 'umi/router';
7 8
 
8 9
 import Attribution from './components/attribution'
9 10
 import IntegralRecord from './components/integralRecord'
@@ -27,7 +28,7 @@ function body(props) {
27 28
   const [dataSource, setDataSource] = useState({ records: [] })
28 29
 
29 30
   // 默认私客
30
-    // eslint-disable-next-line react-hooks/rules-of-hooks
31
+  // eslint-disable-next-line react-hooks/rules-of-hooks
31 32
   const [customerType, setCustomerType] = useState('private')
32 33
 
33 34
   // 调整归属 ============  start
@@ -95,7 +96,7 @@ function body(props) {
95 96
   // 分页
96 97
   function onChange(pageNum) {
97 98
     // eslint-disable-next-line react-hooks/rules-of-hooks
98
-      getList({ pageNumber: pageNum, pageSize: 10, customerType })
99
+    getList({ pageNumber: pageNum, pageSize: 10, customerType })
99 100
   }
100 101
 
101 102
   // 私客/公客切换
@@ -127,20 +128,25 @@ function body(props) {
127 128
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
128 129
     setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
129 130
   }
131
+  function toCustomerDateil() {
132
+    router.push({
133
+      pathname: '/customer/customerlist/customerDetail',
134
+    });
135
+  }
130 136
 
131 137
   const columns = [
132 138
     {
133 139
       title: '头像',
134 140
       dataIndex: 'picture',
135 141
       key: 'picture',
136
-      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl } size={64} icon="user" />,
142
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
137 143
     },
138 144
     {
139 145
       title: '姓名',
140 146
       dataIndex: 'name',
141 147
       key: 'name',
142 148
       // eslint-disable-next-line no-nested-ternary
143
-      render: (_, record) => <><sapn>{ customerType === 'private' ? record.name : record.nickname }</sapn></>,
149
+      render: (_, record) => <><sapn>{customerType === 'private' ? record.name : record.nickname}</sapn></>,
144 150
     },
145 151
     {
146 152
       title: '电话',
@@ -152,7 +158,7 @@ function body(props) {
152 158
       dataIndex: 'sex',
153 159
       key: 'sex',
154 160
       // eslint-disable-next-line no-nested-ternary
155
-      render: (_, record) => <><sapn>{ record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知' }</sapn></>,
161
+      render: (_, record) => <><sapn>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</sapn></>,
156 162
     },
157 163
     {
158 164
       title: '置业顾问',
@@ -161,9 +167,9 @@ function body(props) {
161 167
       // eslint-disable-next-line no-nested-ternary
162 168
       render: (_, record) => (
163 169
         <>
164
-          <sapn>{ record.consultantName }</sapn>
165
-          <br/>
166
-          <sapn>{ record.consultTel }</sapn>
170
+          <sapn>{record.consultantName}</sapn>
171
+          <br />
172
+          <sapn>{record.consultTel}</sapn>
167 173
         </>
168 174
       ),
169 175
     },
@@ -171,8 +177,8 @@ function body(props) {
171 177
       title: '客户状态',
172 178
       dataIndex: 'reportRecommendStatus',
173 179
       key: 'reportRecommendStatus',
174
-       // eslint-disable-next-line no-nested-ternary
175
-       render: (_, record) => <><sapn>{ record.reportRecommendStatus === 0 ? '为报备' : record.reportRecommendStatus === 1 ? '报备' : record.reportRecommendStatus === 2 ? '推荐' : '' }</sapn></>,
180
+      // eslint-disable-next-line no-nested-ternary
181
+      render: (_, record) => <><sapn>{record.reportRecommendStatus === 0 ? '为报备' : record.reportRecommendStatus === 1 ? '报备' : record.reportRecommendStatus === 2 ? '推荐' : ''}</sapn></>,
176 182
     },
177 183
     {
178 184
       title: '操作',
@@ -181,13 +187,13 @@ function body(props) {
181 187
       // eslint-disable-next-line no-nested-ternary
182 188
       render: (_, record) => (
183 189
         <>
184
-          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showStatus(record)}>变更状态</Button>
190
+          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
185 191
           &nbsp;&nbsp;
186
-          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showGM(record)}>调整归属</Button>
187
-          <br/>
188
-          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link">查看详情</Button>
192
+          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
193
+          <br />
194
+          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={toCustomerDateil}>查看详情</Button>
189 195
           &nbsp;&nbsp;
190
-          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={ () => showRecord(record) }>积分记录</Button>
196
+          <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
191 197
         </>
192 198
       ),
193 199
     },
@@ -245,22 +251,22 @@ function body(props) {
245 251
         </Form.Item>
246 252
       </Form>
247 253
 
248
-       <div style={{ marginTop: '20px', marginBottom: '20px' }}>
254
+      <div style={{ marginTop: '20px', marginBottom: '20px' }}>
249 255
         <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
250
-            <Radio.Button value="private">私客</Radio.Button>
251
-            <Radio.Button value="public">公客</Radio.Button>
256
+          <Radio.Button value="private">私客</Radio.Button>
257
+          <Radio.Button value="public">公客</Radio.Button>
252 258
         </Radio.Group>
253
-       </div>
259
+      </div>
254 260
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
255 261
 
256
-        {/* 调整归属 */}
257
-        <Attribution visibleData={gVisibleData} />
262
+      {/* 调整归属 */}
263
+      <Attribution visibleData={gVisibleData} />
258 264
 
259
-        {/* 积分记录 */}
260
-        <IntegralRecord visibleData={recordVisibleData} />
265
+      {/* 积分记录 */}
266
+      <IntegralRecord visibleData={recordVisibleData} />
261 267
 
262
-        {/* 变更状态 */}
263
-        <ChangeStatus visibleData={statusVisibleData} />
268
+      {/* 变更状态 */}
269
+      <ChangeStatus visibleData={statusVisibleData} />
264 270
     </>
265 271
   );
266 272
 }

+ 78
- 0
src/pages/customer/customerlist/style.less Dosyayı Görüntüle

@@ -70,3 +70,81 @@
70 70
 .displayS {
71 71
   display: none;
72 72
 }
73
+
74
+
75
+// 客户详情样式
76
+.cardBox{
77
+  display: flex;
78
+  .leftBox{
79
+    width:342px;
80
+    min-width:342px;
81
+    height:511px;
82
+    background:rgba(255,255,255,1);
83
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
84
+    border-radius:8px;
85
+    display: inline-block;
86
+    margin-right: 30px;
87
+    padding: 30px;
88
+    overflow: hidden;
89
+  }
90
+  .rightBox{
91
+    width:-webkit-fill-available;
92
+    height:511px;
93
+    min-width: 800px;
94
+    background:rgba(255,255,255,1);
95
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
96
+    border-radius:8px;
97
+    display: inline-block;
98
+    padding: 30px;
99
+    overflow: hidden;
100
+    position: relative;
101
+  }
102
+  .tit{
103
+    font-size:24px;
104
+    font-weight:600;
105
+    color:#222;
106
+    margin: 10px 0 0 0;
107
+  }
108
+  .touxiang{
109
+    width: 120px;
110
+    width: 120px;
111
+    border-radius: 6px;
112
+    margin: 30px 0 20px 0;
113
+  }
114
+  .infoItem{
115
+    color:#666;
116
+    font-size: 19px;
117
+    margin: 0 0 10px 0;
118
+    
119
+  }
120
+  .rightItem{
121
+    color:#666;
122
+    font-size: 19px;
123
+    margin: 0 0 15px 0;
124
+  }
125
+  .right{
126
+    position: absolute;
127
+    top:108px;
128
+    left:170px;
129
+  }
130
+  .rightInfo{
131
+    position: absolute;
132
+    top:50px;
133
+    left:50%;
134
+  }
135
+  
136
+}
137
+.recordBox{
138
+  width:100%;
139
+  background:rgba(255,255,255,1);
140
+  box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
141
+  border-radius:8px;
142
+  margin-top: 30px;
143
+  padding: 30px;
144
+  .tableName{
145
+    font-size:24px;
146
+    font-weight:600;
147
+    color:#222;
148
+  }
149
+}
150
+

+ 11
- 10
src/pages/customer/independentList/index.jsx Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Modal } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, notification } from 'antd';
3 3
 import moment from 'moment';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
@@ -268,20 +268,21 @@ function body(props) {
268 268
     getList({ pageNumber: 1, pageSize: 10 })
269 269
   }, [])
270 270
 
271
+
272
+  function openNotificationWithIcon(type, message) {
273
+    notification[type]({
274
+      message,
275
+      description:
276
+        '',
277
+    });
278
+  }
279
+
271 280
   function getList(params) {
272 281
     // 网路请求
273 282
     request({ ...apis.customer.agents, params: { ...params } }).then(res => {
274 283
       setDataSource(res)
275 284
     }).catch(err => {
276
-      // eslint-disable-next-line no-unused-expressions
277
-      <Alert
278
-        style={{
279
-          marginBottom: 24,
280
-        }}
281
-        message={err}
282
-        type="error"
283
-        showIcon
284
-      />
285
+      openNotificationWithIcon('error', err)
285 286
     })
286 287
   }
287 288
 

+ 1
- 1
src/pages/customer/recommendCustomer/index.jsx Dosyayı Görüntüle

@@ -115,7 +115,7 @@ function body(props) {
115 115
       title: '推荐时间',
116 116
       dataIndex: 'createDate',
117 117
       key: 'createDate',
118
-      render: (_, record) => <><sapn>{ moment(record.createDate).format('YYYY-MM-DD') }</sapn></>,
118
+      render: (_, record) => <><sapn>{ record.createDate && moment(record.createDate).format('YYYY-MM-DD') }</sapn></>,
119 119
     },
120 120
     {
121 121
       title: '状态',

+ 74
- 9
src/pages/integralMall/writeOff.jsx Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Tabs, Row, Col, message } from 'antd';
2
+import { Form, Input, Button, Icon, Tabs, Row, Col, Modal, message } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
@@ -13,20 +13,67 @@ function callback(key) {
13 13
 }
14 14
 
15 15
 /**
16
- *
17
- *
18 16
  * @param {*} props
19 17
  * @returns
20 18
  */
19
+class Dialog extends React.Component {
20
+  state = {
21
+    visible: false,
22
+  };
23
+
24
+  showModal = () => {
25
+    this.setState({ visible: true, });
26
+  };
27
+
28
+  handleCancel = () => {
29
+    this.setState({ visible: false });
30
+  };
31
+
32
+  onKeyDown = (e) => {
33
+
34
+    if (e.keyCode == 13) {
35
+      this.setState({ visible: false });
36
+      this.props.onEnter();
37
+    }
38
+  }
39
+
40
+  render() {
41
+    const { visible, loading } = this.state;
42
+    return (
43
+      <div>
44
+        <Button type="primary" onClick={this.showModal} style={{ margin: '80px auto', display: 'block', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }}>立即核销</Button>
45
+        <Modal
46
+          style={{ marginTop: '20vh' }}
47
+          visible={visible}
48
+          title="核销数据"
49
+          onCancel={this.handleCancel}
50
+          footer={[]}
51
+        >
52
+          <p>扫描二维码数据</p>
53
+          <Input placeholder="请用扫描枪扫描二维码" onKeyDown={this.onKeyDown} onChange={this.props.onChange} />
54
+        </Modal>
55
+      </div>
56
+    );
57
+  }
58
+}
59
+
21 60
 
22 61
 function header(props) {
23 62
   const [telValue, setTelValue] = useState('')
63
+
24 64
   const changeTel = (e) => {
25 65
     setTelValue(e.target.value)
26 66
   }
27 67
 
28
-  const verifyTel = () =>{
29
-    if(telValue === ""){
68
+  const [codeValue, setCodeValue] = useState('')
69
+  const changeCode = (e) => {
70
+
71
+    setCodeValue(e.target.value)
72
+
73
+  }
74
+
75
+  const verifyTel = () => {
76
+    if (telValue === "") {
30 77
       message.error("请输入手机号");
31 78
       return;
32 79
     }
@@ -38,6 +85,22 @@ function header(props) {
38 85
     });
39 86
   }
40 87
 
88
+
89
+  const handleEnter = (e) => {
90
+    if (codeValue === "") {
91
+      message.error("无二维码数据");
92
+      return;
93
+    } else {
94
+
95
+      router.push({
96
+        pathname: '/integralMall/verifyList',
97
+        query: {
98
+          telValue:codeValue
99
+        },
100
+      });
101
+    }
102
+  }
103
+
41 104
   const { getFieldDecorator } = props.form
42 105
   return (
43 106
     <>
@@ -62,7 +125,7 @@ function header(props) {
62 125
               <p style={{ margin: '44px auto' }}>根据提示进行核销操作</p>
63 126
             </Col>
64 127
           </Row>
65
-          <Button type="primary" style={{ margin: '80px auto', display: 'block', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }}>立即核销</Button>
128
+          <Dialog onEnter={handleEnter} onChange={changeCode} />
66 129
         </TabPane>
67 130
         <TabPane tab="手机号核销" key="2">
68 131
           <Row>
@@ -77,15 +140,17 @@ function header(props) {
77 140
               <p>点击“立即核销”按钮</p>
78 141
             </Col>
79 142
           </Row>
80
-          <div style={{ margin: '110px auto', display: 'block',textAlign:'center' }}>
81
-            <Input placeholder="请输入手机号" style={{width:'200px'}} onChange={changeTel}/>
82
-            <Button type="primary" style={{marginLeft:'10px', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }} onClick={verifyTel}>立即核销</Button>
143
+          <div style={{ margin: '110px auto', display: 'block', textAlign: 'center' }}>
144
+            <Input placeholder="请输入手机号" style={{ width: '200px' }} onChange={changeTel} />
145
+            <Button type="primary" style={{ marginLeft: '10px', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }} onClick={verifyTel}>立即核销</Button>
83 146
           </div>
84 147
         </TabPane>
85 148
       </Tabs>,
86 149
     </>
87 150
   )
88 151
 }
152
+
89 153
 const WrappedHeader = Form.create({ name: 'header' })(header);
90 154
 
155
+
91 156
 export default WrappedHeader

+ 101
- 13
src/pages/news/list/NewsList.jsx Dosyayı Görüntüle

@@ -1,9 +1,11 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert } from 'antd';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Modal, message, Card, Row, Col, Pagination, Alert } from 'antd';
3 3
 import moment from 'moment';
4
+import router from 'umi/router';
4 5
 import request from '../../../utils/request';
5 6
 import apis from '../../../services/apis';
6 7
 import Styles from './style.less';
8
+import NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect'
7 9
 
8 10
 
9 11
 const { Option } = Select;
@@ -19,7 +21,76 @@ const tempDate = [{ code: 's101' }]
19 21
  */
20 22
 function CartBody(props) {
21 23
   const { data } = props
22
-  console.log(props);
24
+  console.log(data);
25
+  const cancelPage = () =>{
26
+    router.push({
27
+      pathname: '/news/list/NewsList',
28
+    });
29
+  }
30
+
31
+  // 查询列表
32
+  const getList = (params) => {
33
+    request({
34
+        url: '/api/admin/taNews',
35
+        method: 'GET',
36
+        params: { ...params },
37
+    }).then((data) => {
38
+        cancelPage();
39
+    })
40
+  }
41
+
42
+  //删除资讯
43
+  const changeNewsListStatus = (newsId) => () => {
44
+    Modal.confirm({
45
+      title: '确认删除该资讯?',
46
+      okText: '确认',
47
+      cancelText: '取消',
48
+      onOk() {
49
+        request({
50
+          url: '/api/admin/taNews/' + newsId,
51
+          method: 'DELETE',
52
+          // data: { ...row },
53
+        }).then((data) => {
54
+          message.info('操作成功!')
55
+          getList({ pageNum: 1, pageSize: 10 });
56
+        })
57
+      }
58
+    });
59
+  }
60
+
61
+  // 跳转到编辑资讯列表
62
+  const toEditList = (newsId) => ()  => {
63
+    router.push({
64
+      pathname: '/news/list/editNewsList',
65
+      query: {
66
+        newsId
67
+      },
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
+  
92
+  }
93
+
23 94
   return (
24 95
           <Card
25 96
             hoverable
@@ -30,14 +101,14 @@ function CartBody(props) {
30 101
             <p className={Styles.cardText}>
31 102
               <span className={Styles.title}>资讯类型</span>
32 103
               <span >:{ data.newsType.newsTypeName }</span>
33
-              <span className={Styles.ediText}>
104
+              <span className={Styles.ediText} onClick={toEditList(data.newsId)}>
34 105
                 编辑
35 106
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
36 107
               </span>
37 108
             </p>
38 109
             <p className={Styles.cardText}>
39 110
               <span className={Styles.title}>状态</span>
40
-              <span >:{ data.status == 0 ? "已发布" : "未发布" }</span>
111
+              <span >:{ data.newsStatus == 0 ? "已发布" : "未发布" }</span>
41 112
             </p>
42 113
             <p className={Styles.cardItem}>
43 114
               <span className={Styles.title}>阅读数量</span>
@@ -45,7 +116,7 @@ function CartBody(props) {
45 116
             </p>
46 117
             <p className={Styles.cardItem}>
47 118
               <span className={Styles.title}>转发数量</span>
48
-              <span className={ Styles.address }>:{ data.shareNum }</span>
119
+              <span>:{ data.shareNum }</span>
49 120
             </p>
50 121
             <p className={Styles.cardItem}>
51 122
               <span className={Styles.title}>点赞数量</span>     
@@ -60,13 +131,20 @@ function CartBody(props) {
60 131
               <span >:{ data.createDate }</span>
61 132
             </p>
62 133
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
63
-              <span style={{ color: '#1990FF' }}>
64
-                取消发布
65
-                <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' }} />
66 142
               </span>
143
+              }
144
+              
67 145
               <span style={{
68 146
                 color: '#FF4A4A', position: 'absolute', right: '0',
69
-              }} >
147
+              }} onClick={changeNewsListStatus(data.newsId)}>
70 148
                 删除
71 149
                 <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
72 150
               </span>
@@ -122,6 +200,17 @@ function body(props) {
122 200
     });
123 201
   }
124 202
 
203
+  // 跳转到编辑资讯列表
204
+  const toEditList = (id) => ()  => {
205
+    router.push({
206
+      pathname: '/news/list/editNewsList',
207
+      query: {
208
+        id
209
+      },
210
+    });
211
+  }
212
+
213
+
125 214
   // Change 事件
126 215
   function handleSelectChange(e) {
127 216
     // eslint-disable-next-line no-console
@@ -165,9 +254,8 @@ function body(props) {
165 254
           )}
166 255
         </Form.Item>
167 256
         <Form.Item>
168
-          {getFieldDecorator('type')(
169
-            <Select style={{ width: '180px' }} placeholder="咨询类型" onChange={handleSelectChange}>
170
-            </Select>,
257
+          {getFieldDecorator('buildingId')(
258
+            <NewsTypeSelect />,
171 259
           )}
172 260
         </Form.Item>       
173 261
         <Form.Item>
@@ -184,7 +272,7 @@ function body(props) {
184 272
           </Button>
185 273
         </Form.Item>
186 274
       </Form>
187
-      <Button type="primary" className={Styles.addButton}>
275
+      <Button type="primary" className={Styles.addButton} onClick={toEditList()}>
188 276
         新增
189 277
       </Button>
190 278
 

+ 148
- 0
src/pages/news/list/editNewsList.jsx Dosyayı Görüntüle

@@ -0,0 +1,148 @@
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 NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect'
9
+import XForm, { FieldTypes } from '../../../components/XForm';
10
+import Wangedit from '../../../components/Wangedit/Wangedit'
11
+import request from '../../../utils/request'
12
+
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+/**
15
+ *
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+ const Edit = (props) => {
21
+  const [ tab, changeTab ] = useState('basic')
22
+  const newsId = props.location.query.newsId
23
+  const [ dynamicData, setDynamicData ] = useState({})
24
+  if(newsId){
25
+    useEffect(() => {
26
+      getDynamicData(newsId);
27
+    },[])
28
+
29
+  // 查询列表
30
+  const getDynamicData = (newsId) => {
31
+    request({
32
+        url: '/api/admin/taNews/' + newsId,
33
+        method: 'GET',
34
+        params: { newsId },
35
+    }).then((data) => {
36
+        console.log(data)
37
+        setDynamicData(data)
38
+    })
39
+  }
40
+  }
41
+
42
+  const cancelPage = () =>{
43
+    router.push({
44
+      pathname: '/news/list/NewsList',
45
+    });
46
+  }
47
+
48
+  const Basic = (props) => {
49
+    const fields = [
50
+      {
51
+        label: '意向项目',
52
+        name: 'buildingId',
53
+        render: <BuildSelect />,
54
+        value: dynamicData.buildingId,
55
+        rules: [
56
+          {required: true, message: '请选择所属项目'},
57
+        ]
58
+      },
59
+      {
60
+        label: '资讯图片',
61
+        name: 'newsImg',
62
+        type: FieldTypes.ImageUploader,
63
+        value: dynamicData.newsImg,
64
+      },
65
+      {
66
+        label: '资讯标题',
67
+        name: 'newsName',
68
+        type: FieldTypes.Text,
69
+        value: dynamicData.newsName,
70
+        rules: [
71
+          {required: true, message: '请输入资讯标题'},
72
+        ]
73
+      },
74
+      {
75
+        label: '资讯类型',
76
+        name: 'newsTypeId',
77
+        render: <NewsTypeSelect />,
78
+        value: dynamicData.newsTypeId,
79
+        rules: [
80
+          {required: true, message: '请选择资讯类型'},
81
+        ]
82
+      },
83
+      {
84
+        label: '资讯详情',
85
+        name: 'desc',
86
+        render: <Wangedit />,
87
+        value: dynamicData.desc,
88
+      },
89
+    ]
90
+  
91
+    const handleSubmit = val => { 
92
+      let {...submitValue} = val
93
+      if(newsId){
94
+        submitValue.newsId = newsId
95
+        request({
96
+          url: '/api/admin/taNews/' + newsId,
97
+          method: 'PUT',
98
+          data: submitValue,
99
+        }).then((data) => {
100
+          cancelPage()
101
+        }).catch((err) => {
102
+          message.info(err.msg || err.message)
103
+        })
104
+      }else{
105
+        request({
106
+          url: '/api/admin/taNews',
107
+          method: 'POST',
108
+          data: submitValue,
109
+        }).then((data) => {
110
+          cancelPage()
111
+        }).catch((err) => {
112
+          message.info(err.msg || err.message)
113
+        })
114
+      }
115
+    }
116
+    
117
+    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
118
+  }
119
+  
120
+  const Poster = (props) => {
121
+   return <div>Poster</div>
122
+  }
123
+ 
124
+  const Share = (props) => {
125
+    return <div>Share</div>
126
+  }
127
+
128
+  return (
129
+    <div>
130
+      <div>
131
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
132
+          <Radio.Button value="basic">基本信息</Radio.Button>
133
+          <Radio.Button value="poster">海报图片</Radio.Button>
134
+          <Radio.Button value="share">分享设置</Radio.Button>
135
+        </Radio.Group>
136
+      </div>
137
+      <div>
138
+        { tab === 'basic' && <Basic /> }
139
+        { tab === 'poster' && <Poster /> }
140
+        { tab === 'share' && <Share /> }
141
+      </div>
142
+    </div>
143
+  );
144
+ }
145
+
146
+
147
+
148
+export default Edit

+ 1
- 1
src/pages/news/type/NewsType.jsx Dosyayı Görüntüle

@@ -45,7 +45,7 @@ function header(props) {
45 45
   }
46 46
 
47 47
 
48
-  // 跳转到编辑咨询
48
+  // 跳转到编辑资讯
49 49
   const toEditNews = (id) => () => {
50 50
     router.push({
51 51
       pathname: '/news/type/editNews',

+ 4
- 0
src/services/apis.js Dosyayı Görüntüle

@@ -22,6 +22,10 @@ export default {
22 22
       method: 'GET',
23 23
       url: `${prefix}/buildinglist`,
24 24
     },
25
+    buildingApartment: {
26
+      method: 'GET',
27
+      url: `${prefix}/buildingApartment/buildingId/id`,
28
+    },
25 29
   },
26 30
   buildingType: {
27 31
     getList: {