dingxin 5 years ago
parent
commit
15257edf3d

+ 15
- 0
config/config.js View File

@@ -375,6 +375,21 @@ export default {
375 375
                   name: '报表数据',
376 376
                   component: './system/report',
377 377
                 },
378
+                {
379
+                  path: '/system/intention',
380
+                  name: '意向值',
381
+                  component: './system/intention',
382
+                },
383
+                {
384
+                  path: '/system/housingPolicy',
385
+                  name: '购房政策维护',
386
+                  component: './system/housingPolicy',
387
+                },
388
+                {
389
+                  path: '/system/editPolicy',
390
+                  name: '',
391
+                  component: './system/editPolicy',
392
+                },
378 393
               ],
379 394
             },
380 395
             {

BIN
src/assets/bottom.png View File


BIN
src/assets/yinhao.png View File


+ 111
- 39
src/pages/activity/editActivity.jsx View File

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import moment from 'moment';
@@ -8,37 +8,42 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
8 8
 import XForm, { FieldTypes } from '../../components/XForm';
9 9
 import Wangedit from '../../components/Wangedit/Wangedit'
10 10
 import request from '../../utils/request'
11
+import PosterBottom from '../../assets/bottom.png'
12
+import yinhao from '../../assets/yinhao.png'
13
+import ImageUploader from '../../components/XForm/ImageUpload';
14
+import logo from '../../assets/logo.png';
11 15
 
12 16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17
+
13 18
 /**
14 19
  *
15 20
  *
16 21
  * @param {*} props
17 22
  * @returns
18 23
  */
19
- const Edit = (props) => {
20
-  const [ tab, changeTab ] = useState('basic')
24
+const Edit = (props) => {
25
+  const [tab, changeTab] = useState('basic')
21 26
   const dynamicId = props.location.query.dynamicId
22
-  const [ dynamicData, setDynamicData ] = useState({})
23
-  if(dynamicId){
27
+  const [dynamicData, setDynamicData] = useState({})
28
+  if (dynamicId) {
24 29
     useEffect(() => {
25 30
       getDynamicData(dynamicId);
26
-    },[])
31
+    }, [])
27 32
 
28
-  // 查询列表
29
-  const getDynamicData = (dynamicId) => {
30
-    request({
33
+    // 查询列表
34
+    const getDynamicData = (dynamicId) => {
35
+      request({
31 36
         url: '/api/admin/buildingDynamic/Details',
32 37
         method: 'GET',
33 38
         params: { dynamicId },
34
-    }).then((data) => {
39
+      }).then((data) => {
35 40
         console.log(data)
36 41
         setDynamicData(data)
37
-    })
38
-  }
42
+      })
43
+    }
39 44
   }
40 45
 
41
-  const cancelPage = () =>{
46
+  const cancelPage = () => {
42 47
     router.push({
43 48
       pathname: '/activity/ActivityList',
44 49
     });
@@ -52,7 +57,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
52 57
         render: <BuildSelect />,
53 58
         value: dynamicData.buildingId,
54 59
         rules: [
55
-          {required: true, message: '请选择所属项目'},
60
+          { required: true, message: '请选择所属项目' },
56 61
         ]
57 62
       },
58 63
       {
@@ -67,16 +72,16 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
67 72
         type: FieldTypes.Text,
68 73
         value: dynamicData.title,
69 74
         rules: [
70
-          {required: true, message: '请输入活动标题'},
75
+          { required: true, message: '请输入活动标题' },
71 76
         ]
72 77
       },
73 78
       {
74 79
         label: '活动时间',
75 80
         name: 'activityTime',
76 81
         type: FieldTypes.RangePicker,
77
-        value: dynamicData.startDate != null ?  [moment(dynamicData.startDate,'YYYY-MM-DD'),moment(dynamicData.endDate,'YYYY-MM-DD')] : null,
82
+        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD'), moment(dynamicData.endDate, 'YYYY-MM-DD')] : null,
78 83
         rules: [
79
-          {required: true, message: '请选择活动时间'},
84
+          { required: true, message: '请选择活动时间' },
80 85
         ]
81 86
       },
82 87
       {
@@ -85,7 +90,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
85 90
         type: FieldTypes.Text,
86 91
         value: dynamicData.address,
87 92
         rules: [
88
-          {required: true, message: '请输入活动地点'},
93
+          { required: true, message: '请输入活动地点' },
89 94
         ]
90 95
       },
91 96
       {
@@ -94,7 +99,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
94 99
         type: FieldTypes.Text,
95 100
         value: dynamicData.enlistNum,
96 101
         rules: [
97
-          {required: true, message: '请输入活动人数'},
102
+          { required: true, message: '请输入活动人数' },
98 103
         ]
99 104
       },
100 105
       {
@@ -107,24 +112,24 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
107 112
         label: '是否需要报名',
108 113
         name: 'isEnlist',
109 114
         render: <Radio.Group name="radiogroup">
110
-                  <Radio value={1}>是</Radio>
111
-                  <Radio value={0}>否</Radio>
112
-                </Radio.Group>,
113
-        value: dynamicData.isEnlist != null ? dynamicData.isEnlist-0 : 1,
115
+          <Radio value={1}>是</Radio>
116
+          <Radio value={0}>否</Radio>
117
+        </Radio.Group>,
118
+        value: dynamicData.isEnlist != null ? dynamicData.isEnlist - 0 : 1,
114 119
       },
115 120
       {
116 121
         label: '报名时间',
117 122
         name: 'signupTime',
118 123
         type: FieldTypes.RangePicker,
119
-        value: dynamicData.enlistStart != null ?  [moment(dynamicData.enlistStart,'YYYY-MM-DD'),moment(dynamicData.enlistEnd,'YYYY-MM-DD')] : null,
124
+        value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD')] : null,
120 125
         rules: [
121
-          {required: true, message: '请选择报名时间'},
126
+          { required: true, message: '请选择报名时间' },
122 127
         ]
123 128
       },
124 129
     ]
125
-  
126
-    const handleSubmit = val => { 
127
-      let {activityTime,signupTime, ...submitValue} = val
130
+
131
+    const handleSubmit = val => {
132
+      let { activityTime, signupTime, ...submitValue } = val
128 133
       const [startDate, endDate] = activityTime
129 134
       submitValue.startDate = moment(startDate).format('YYYY-MM-DD');
130 135
       submitValue.endDate = moment(endDate).format('YYYY-MM-DD');
@@ -132,7 +137,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
132 137
       submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD');
133 138
       submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD');
134 139
       console.log('submit data --->', submitValue)
135
-      if(dynamicId){
140
+      if (dynamicId) {
136 141
         submitValue.dynamicId = dynamicId
137 142
         request({
138 143
           url: '/api/admin/buildingDynamic/update',
@@ -143,7 +148,7 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
143 148
         }).catch((err) => {
144 149
           message.info(err.msg || err.message)
145 150
         })
146
-      }else{
151
+      } else {
147 152
         request({
148 153
           url: '/api/admin/buildingDynamic/add',
149 154
           method: 'POST',
@@ -155,16 +160,83 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
155 160
         })
156 161
       }
157 162
     }
158
-    
163
+
159 164
     return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
160 165
   }
161
-  
166
+
162 167
   const Poster = (props) => {
163
-   return <div>Poster</div>
168
+
169
+    return <div style={{ display: 'flex' }}>
170
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
171
+        <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
172
+
173
+          <img style={{ width: '100%', height: '300px' }} src="http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg" alt="" />
174
+
175
+          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
176
+            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src="http://img0.imgtn.bdimg.com/it/u=3463541938,2540701974&fm=26&gp=0.jpg" alt="" />
177
+            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
178
+            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
179
+            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
180
+          </div>
181
+          <p style={{
182
+            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
183
+            display: '-webkit-box', lineClamp: '3', height: '60px',
184
+            WebkitLineClamp: '2',
185
+            WebkitBoxOrient: 'vertical',
186
+            overflow: 'hidden',
187
+            textOverflow: 'ellipsis'
188
+          }}>破晓·内容生态下半场的版权到企业高峰论坛会议破晓·内容生态下半场的版权到企业高峰论坛活动</p>
189
+
190
+          <img src={yinhao} style={{ width: '30px', marginLeft: '10px' }} alt="" />
191
+          <p style={{
192
+            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
193
+            display: '-webkit-box', lineClamp: '3', height: '76px',
194
+            WebkitLineClamp: '3',
195
+            WebkitBoxOrient: 'vertical',
196
+            overflow: 'hidden',
197
+            textOverflow: 'ellipsis'
198
+          }}>活动描述:破晓·内容生态下半场的版权到企业高峰论坛活动破晓·内容生态下半场的版权到企业高峰论坛活动破晓·内容生态下半场的版权到企业高峰论坛活动</p>
199
+          <img src={PosterBottom} style={{ width: '100%' }} alt="" />
200
+        </div>
201
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
202
+      </div>
203
+      <div></div>
204
+    </div>
164 205
   }
165
- 
206
+
166 207
   const Share = (props) => {
167
-    return <div>Share</div>
208
+    const fields = [
209
+      {
210
+        label: '分享模板',
211
+        name: 'buildingId',
212
+        render: () => <div style={{ margin: ' 10px 20px' }}>
213
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
214
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>置业V客厅 精准获客平台</p>
215
+          <img style={{ width: '200px', height: '140px' }} src="http://house.china.com.cn/nanjing/UserFiles/20171124/11070256.jpg" alt="" />
216
+        </div>,
217
+      },
218
+      {
219
+        label: '海报标题',
220
+        name: 'newsTypeName',
221
+        type: FieldTypes.Text,
222
+        value: '',
223
+        rules: [
224
+          { required: true, message: '请输入咨询名称' },
225
+        ]
226
+      },
227
+      {
228
+        label: '类型图',
229
+        name: 'newsTypeImg',
230
+        type: FieldTypes.ImageUploader,
231
+        value: 'newsTypeImg',
232
+      },
233
+    ]
234
+    const handleSubmit = (values) => {
235
+
236
+    }
237
+    return <div>
238
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
239
+    </div>
168 240
   }
169 241
 
170 242
   return (
@@ -177,13 +249,13 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
177 249
         </Radio.Group>
178 250
       </div>
179 251
       <div>
180
-        { tab === 'basic' && <Basic /> }
181
-        { tab === 'poster' && <Poster /> }
182
-        { tab === 'share' && <Share /> }
252
+        {tab === 'basic' && <Basic />}
253
+        {tab === 'poster' && <Poster />}
254
+        {tab === 'share' && <Share />}
183 255
       </div>
184 256
     </div>
185 257
   );
186
- }
258
+}
187 259
 
188 260
 
189 261
 

+ 39
- 5
src/pages/building/list/add/components/imageSet.jsx View File

@@ -5,6 +5,7 @@ import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
6 6
 import Styles from '../style.less';
7 7
 import { router } from 'umi';
8
+import ModalImage from './modalImage';
8 9
 
9 10
 
10 11
 const saleType = [
@@ -32,6 +33,9 @@ function imageSet(props) {
32 33
   // eslint-disable-next-line react-hooks/rules-of-hooks
33 34
   const [data, setData] = useState([])
34 35
 
36
+  // eslint-disable-next-line react-hooks/rules-of-hooks
37
+  const [visibleData, setVisibleData] = useState({ visible: false, apartmentId: '', buildingId: '' })
38
+
35 39
   // eslint-disable-next-line react-hooks/rules-of-hooks
36 40
   useEffect(() => {
37 41
     getList()
@@ -46,7 +50,6 @@ function imageSet(props) {
46 50
   }
47 51
 
48 52
   function getList(params) {
49
-    console.log(props)
50 53
     // 网路请求
51 54
     const { url, method } = apis.building.buildingApartment
52 55
     const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(props.building.buildingId)
@@ -54,7 +57,34 @@ function imageSet(props) {
54 57
     request({ url: tempUrl, method, params: { ...params } }).then(res => {
55 58
       setData(res)
56 59
     }).catch(err => {
57
-      openNotificationWithIcon('error', err)
60
+      openNotificationWithIcon('error', err.message)
61
+    })
62
+  }
63
+
64
+  /**
65
+   *打开编辑页
66
+   *
67
+   * @param {*} record
68
+   */
69
+  function showEdi(record) {
70
+    setVisibleData({ visible: true, apartmentId: record === undefined ? '' : record.apartmentId, buildingId: props.building.buildingId })
71
+  }
72
+
73
+  /**
74
+   * 删除
75
+   *
76
+   * @param {*} record
77
+   */
78
+  function deleteApartment(record) {
79
+    // 网路请求
80
+    const { url, method } = apis.building.buildingApartmentDelete
81
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(record.apartmentId)
82
+
83
+    request({ url: tempUrl, method }).then(res => {
84
+      getList()
85
+      openNotificationWithIcon('error', '操作成功')
86
+    }).catch(err => {
87
+      openNotificationWithIcon('error', err.message)
58 88
     })
59 89
   }
60 90
 
@@ -94,8 +124,8 @@ function imageSet(props) {
94 124
       key: 'apartmentId',
95 125
       render: (_, record) => (
96 126
         <>
97
-          <Button type="link" style={{ color: 'red' }}>编辑</Button>
98
-          <Button type="link" style={{ color: 'red' }}>删除</Button>
127
+          <Button type="link" style={{ color: 'red' }} onClick={() => showEdi(record)}>编辑</Button>
128
+          <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
99 129
         </>
100 130
       ),
101 131
     },
@@ -103,8 +133,12 @@ function imageSet(props) {
103 133
 
104 134
   return (
105 135
     <>
106
-      <Button type="primary">新增图片库</Button>
136
+      <Button type="primary" onClick={() => showEdi()}>新增图片库</Button>
107 137
       <Table dataSource={data} columns={columns} pagination={false} />
138
+
139
+      {/* 编辑页 */}
140
+      {/*  onSuccess是子组件传递事件信息  */}
141
+      <ModalImage visibleData={visibleData} key={visibleData.apartmentId} onSuccess={getList}/>
108 142
     </>
109 143
   )
110 144
 }

+ 223
- 0
src/pages/building/list/add/components/modalImage.jsx View File

@@ -0,0 +1,223 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, 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 ImageUpload from '../../../../../components/XForm/ImageUpload'
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+
10
+
11
+const { Option } = Select;
12
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+const { Meta } = Card;
14
+
15
+const { TextArea } = Input;
16
+
17
+
18
+const formItemLayout = {
19
+  labelCol: {
20
+    xs: { span: 24 },
21
+    sm: { span: 2 },
22
+  },
23
+  wrapperCol: {
24
+    xs: { span: 24 },
25
+    sm: { span: 16 },
26
+  },
27
+};
28
+
29
+const saleType = [
30
+  {
31
+    id: 1,
32
+    name: '待定',
33
+  },
34
+  {
35
+    id: 2,
36
+    name: '售罄',
37
+  },
38
+  {
39
+    id: 3,
40
+    name: '在售',
41
+  },
42
+]
43
+
44
+/**
45
+ * 图片信息
46
+ *
47
+ * @param {*} props
48
+ * @returns
49
+ */
50
+class ModalImage extends React.Component {
51
+  constructor(props) {
52
+    super(props);
53
+    this.state = {
54
+       visibleData: { visible: false, apartmentId: '', buildingId: '' },
55
+    }
56
+  }
57
+
58
+  // 挂载之后
59
+  // componentDidMount() {
60
+  //
61
+  // }
62
+
63
+  componentDidUpdate(preProps, preState) {
64
+    console.log(this.props.visibleData)
65
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
66
+      this.getById()
67
+      this.setState({ visibleData: this.props.visibleData });
68
+    }
69
+  }
70
+
71
+  // 弹框确定按钮
72
+  // eslint-disable-next-line react/sort-comp
73
+  handleOk() {
74
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
75
+  }
76
+
77
+  // 弹框取消按钮
78
+  handleCancel() {
79
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
80
+  }
81
+
82
+  getById(params) {
83
+    const { apartmentId } = this.props.visibleData
84
+    if (apartmentId === '' || apartmentId === undefined) {
85
+      return
86
+    }
87
+
88
+    // 网路请求
89
+    const { url, method } = apis.building.buildingApartmentGetById
90
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(apartmentId)
91
+
92
+    request({ url: tempUrl, method , params: { ...params } }).then(res => {
93
+      // res.img = res.buildingImgList.map((item, _) => item.url)
94
+      res.img = res.buildingImgList[0].url
95
+      this.props.form.setFieldsValue(res)
96
+    }).catch(err => {
97
+     this.openNotificationWithIcon('error', err)
98
+    })
99
+  }
100
+
101
+  openNotificationWithIcon = (type, message) => {
102
+    notification[type]({
103
+      message,
104
+      description:
105
+        '',
106
+    });
107
+  };
108
+
109
+  // 提交
110
+  handleSubmit(e) {
111
+    e.preventDefault();
112
+    this.props.form.validateFields((err, values) => {
113
+      if (!err) {
114
+        this.submitData(values)
115
+      }
116
+    });
117
+  }
118
+
119
+  submitData(data) {
120
+    // TODO 这里应该是要支持多图,但是封装的控件没有
121
+    data.img = [{ imgType: 'aparment', url: data.img, orderNo: 1 }]
122
+    data.buildingId = this.props.visibleData.buildingId;
123
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
124
+
125
+    // 网路请求
126
+    request({ ...api, data: { ...data } }).then(() => {
127
+      // eslint-disable-next-line no-unused-expressions
128
+      this.openNotificationWithIcon('success', '操作成功')
129
+
130
+      // 传递父组件事件
131
+      // onSuccess() 是自定义
132
+      this.props.onSuccess()
133
+
134
+      this.handleCancel()
135
+    }).catch(err => {
136
+      // eslint-disable-next-line no-unused-expressions
137
+      this.openNotificationWithIcon('error', err)
138
+    })
139
+  }
140
+
141
+  /**
142
+   * 取消按钮
143
+   *
144
+   * @memberof ModalImage
145
+   */
146
+  closeModal() {
147
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
148
+  }
149
+
150
+  render() {
151
+    const { getFieldDecorator } = this.props.form;
152
+    return (
153
+      <>
154
+        <Modal
155
+            title="图片信息"
156
+            width={1100}
157
+            destroyOnClose="true"
158
+            footer={null}
159
+            visible={this.state.visibleData.visible}
160
+            onOk={() => this.handleOk()}
161
+            onCancel={e => this.handleCancel(e)}
162
+          >
163
+            <Form {...formItemLayout} onSubmit={e => this.handleSubmit(e)}>
164
+              <Form.Item label="编号" style={{ display: 'none' }}>
165
+                  {getFieldDecorator('apartmentId')(<Input />)}
166
+              </Form.Item>
167
+              <Form.Item label="名称">
168
+                {getFieldDecorator('apartmentName')(<Input />)}
169
+              </Form.Item>
170
+              <Form.Item label="类型">
171
+                {getFieldDecorator('apartmentType')(
172
+                  <Select placeholder="类型">
173
+                    <Option value="apart">户型</Option>
174
+                    <Option value="photo">相册</Option>
175
+                  </Select>,
176
+                )}
177
+              </Form.Item>
178
+              <Form.Item label="销售状态">
179
+                {getFieldDecorator('marketStatus')(
180
+                  <Select placeholder="销售状态">
181
+                    {
182
+                      saleType.map((item, _) => <Option value={item.id}>{item.name}</Option>)
183
+                    }
184
+                  </Select>,
185
+                )}
186
+              </Form.Item>
187
+              <Form.Item label="图片">
188
+              {getFieldDecorator('img')(
189
+                <ImageUpload />,
190
+              )}
191
+              </Form.Item>
192
+              <Form.Item label="面积">
193
+                {getFieldDecorator('buildingArea')(<Input />)}
194
+              </Form.Item>
195
+              <Form.Item label="套内面积">
196
+                {getFieldDecorator('insideArea')(<Input />)}
197
+              </Form.Item>
198
+              <Form.Item label="户型总价">
199
+                {getFieldDecorator('apartmentPrice')(<Input />)}
200
+              </Form.Item>
201
+              <Form.Item label="户型简介">
202
+                {getFieldDecorator('apartmentDescription')(
203
+                  <Wangedit />,
204
+                )}
205
+              </Form.Item>
206
+              <Form.Item label="备注">
207
+                {getFieldDecorator('remark')(<TextArea rows={10} />)}
208
+              </Form.Item>
209
+              <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
210
+                <Button type="primary" htmlType="submit">保存</Button>
211
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
212
+                <Button onClick={() => this.closeModal()}>取消</Button>
213
+              </Form.Item>
214
+            </Form>
215
+        </Modal>
216
+      </>
217
+    );
218
+  }
219
+}
220
+
221
+const WrappedModalImageForm = Form.create({ name: 'modalImage' })(ModalImage);
222
+
223
+export default WrappedModalImageForm

+ 1
- 1
src/pages/building/list/add/components/tags.jsx View File

@@ -45,7 +45,7 @@ class EditableTagGroup extends React.Component {
45 45
         {tags.map((tag, index) => {
46 46
           const isLongTag = tag.length > 20;
47 47
           const tagElem = (
48
-            <Tag key={tag} closable={index !== 0} onClose={() => this.handleClose(tag)}>
48
+            <Tag key={tag} closable onClose={() => this.handleClose(tag)}>
49 49
               {isLongTag ? `${tag.slice(0, 20)}...` : tag}
50 50
             </Tag>
51 51
           );

+ 2
- 2
src/pages/building/list/index.jsx View File

@@ -201,12 +201,12 @@ function body(props) {
201 201
           )}
202 202
         </Form.Item>
203 203
         <Form.Item>
204
-          <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
204
+          <Button type="primary" htmlType="submit">
205 205
             搜索
206 206
           </Button>
207 207
         </Form.Item>
208 208
       </Form>
209
-      <Button type="primary" className={Styles.addButton} onClick={() => toAdd()}>
209
+      <Button type="danger" className={Styles.addButton} onClick={() => toAdd()}>
210 210
         新增楼盘
211 211
       </Button>
212 212
 

+ 0
- 1
src/pages/building/list/style.css View File

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 0
- 1
src/pages/building/list/style.less View File

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 0
- 1
src/pages/building/list/style.wxss View File

@@ -10,7 +10,6 @@
10 10
   border: 1px solid #dbdbdb;
11 11
 }
12 12
 .addButton {
13
-  background: #50be00;
14 13
   border-radius: 4px;
15 14
   border: 0px;
16 15
   margin: 10px 0px;

+ 115
- 0
src/pages/system/editPolicy.jsx View File

@@ -0,0 +1,115 @@
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 SelectCity from '../../components/SelectButton/CitySelect'
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 policyId = props.location.query.policyId
22
+  const [ policyData, setPolicyData ] = useState({})
23
+  if(policyId){
24
+    useEffect(() => {
25
+      getPolicyData(policyId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getPolicyData = (policyId) => {
30
+    request({
31
+        url: '/api/admin/taPolicy/' + policyId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setPolicyData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/system/housingPolicy',
43
+    });
44
+  }
45
+    const fields = [
46
+      {
47
+        label: '城市',
48
+        name: 'cityId',
49
+        render: <SelectCity />,
50
+        value: policyData.cityId,
51
+      },
52
+      {
53
+        label: '政策图片',
54
+        name: 'policyImg',
55
+        type: FieldTypes.ImageUploader,
56
+        value: policyData.policyImg,
57
+      },
58
+      {
59
+        label: '政策标题',
60
+        name: 'title',
61
+        type: FieldTypes.Text,
62
+        value: policyData.title,
63
+      },
64
+      {
65
+        label: '政策详情',
66
+        name: 'body',
67
+        render: <Wangedit />,
68
+        value: policyData.body,
69
+      },
70
+      {
71
+        label: '状态',
72
+        name: 'publishStatus',
73
+        type: FieldTypes.Select,
74
+        dict: [{label:"未发布",value:0},{label:"已发布",value:1}],
75
+        value: policyData.publishStatus != null ? policyData.publishStatus : 1,
76
+      },
77
+    ]
78
+  
79
+    const handleSubmit = val => { 
80
+      console.log('submit data --->', val)
81
+      if(policyId){
82
+        val.policyId = policyId
83
+        request({
84
+          url: '/api/admin/taPolicy/'+policyId,
85
+          method: 'PUT',
86
+          data: val,
87
+        }).then((data) => {
88
+          message.info("保存成功")
89
+          cancelPage()
90
+        }).catch((err) => {
91
+          message.info(err.msg || err.message)
92
+        })
93
+      }else{
94
+        request({
95
+          url: '/api/admin/taPolicy',
96
+          method: 'POST',
97
+          data: val,
98
+        }).then((data) => {
99
+          message.info("保存成功")
100
+          cancelPage()
101
+        }).catch((err) => {
102
+          message.info(err.msg || err.message)
103
+        })
104
+      }
105
+    }
106
+     
107
+
108
+  return (
109
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
110
+  );
111
+ }
112
+
113
+
114
+
115
+export default Edit

+ 202
- 0
src/pages/system/housingPolicy.jsx View File

@@ -0,0 +1,202 @@
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
+
18
+  useEffect(() => {
19
+    getList({ pageNum: 1, pageSize: 10,cityId: '' });
20
+  },[])
21
+
22
+  // 查询列表
23
+  const getList = (params) => {
24
+    request({
25
+        url: '/api/admin/taPolicy',
26
+        method: 'GET',
27
+        params: { ...params },
28
+    }).then((data) => {
29
+        console.log(data)
30
+        setData(data)
31
+    })
32
+  }
33
+
34
+  
35
+// 跳转到编辑商品
36
+const toEditPolicy = (policyId) => () => {
37
+    router.push({
38
+      pathname: '/system/editPolicy',
39
+      query: {
40
+        policyId
41
+      },
42
+    });
43
+  }
44
+  
45
+  /**
46
+   *
47
+   *
48
+   * @param {*} props
49
+   * @returns
50
+   */
51
+  
52
+  const columns = [
53
+    {
54
+      title: '购房政策主图',
55
+      dataIndex: 'policyImg',
56
+      key: 'policyImg',
57
+      align: 'center',
58
+      render: (policyImg) => <img src={policyImg} className={styles.touxiang} />,
59
+    },
60
+    {
61
+      title: '标题',
62
+      dataIndex: 'title',
63
+      key: 'title',
64
+      align: 'center',
65
+    },
66
+    {
67
+      title: '城市',
68
+      dataIndex: 'cityName',
69
+      key: 'cityName',
70
+      align: 'center',
71
+    },
72
+    {
73
+      title: '创建时间',
74
+      dataIndex: 'createDate',
75
+      key: 'createDate',
76
+      align: 'center',
77
+      render: (createDate) => <><span>{moment(createDate).format('YYYY-MM-DD')}</span></>
78
+    },
79
+    {
80
+      title: '状态',
81
+      dataIndex: 'publishStatus',
82
+      key: 'publishStatus',
83
+      align: 'center',
84
+      render: (publishStatus)=> <><span>{publishStatus === 1 ? '已发布' : '未发布' }</span></>
85
+    },
86
+    {
87
+      title: '操作',
88
+      dataIndex: 'handle',
89
+      key: 'handle',
90
+      align: 'center',
91
+      render: (x,row) => <>
92
+                           <span style={{ color: '#1990FF' }} onClick={publicOrNoPublic(row)}>{ row.publishStatus === 0 ? '发布' : '取消发布' }<Icon type="close-circle" className={styles.edit} /></span>
93
+                           <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topPolicy(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
94
+                           <span style={{ color: '#FF925C' }} onClick={toEditPolicy(row.policyId)}>编辑<Icon type="form" className={styles.edit} /></span>
95
+                           <span style={{ color: '#FF925C' }} onClick={deletePolicy(row.policyId)}>删除<Icon type="form" className={styles.edit} /></span>
96
+                         </>
97
+    },
98
+  ];
99
+  
100
+  // 删除
101
+const deletePolicy = (policyId) => () => {
102
+  Modal.confirm({
103
+    title: '是否继续删除此政策?',
104
+    okText: '确定',
105
+    cancelText: '取消',
106
+    onOk() {
107
+        request({
108
+            url: '/api/admin/taPolicy/'+policyId,
109
+            method: 'DELETE',
110
+        }).then((data) => {
111
+            message.info('操作成功!')
112
+            getList({ pageNum: 1, pageSize: 10,cityId: '' });
113
+        }).catch((err) => {
114
+            console.log(err)
115
+            message.info(err.msg || err.message)
116
+        })
117
+    },
118
+  });
119
+}
120
+
121
+
122
+//   置顶
123
+  const topPolicy = (row) => () => {
124
+      const weight = Math.abs(row.weight - 1)
125
+      row.weight = weight
126
+      request({
127
+          url: '/api/admin/taPolicy/'+row.policyId,
128
+          method: 'PUT',
129
+          data: row,
130
+      }).then((data) => {
131
+          console.log(data)
132
+          message.info('操作成功!')
133
+          getList({ pageNum: 1, pageSize: 10,cityId: '' });
134
+      }).catch((err) => {
135
+          console.log(err)
136
+          message.info(err.msg || err.message)
137
+      })
138
+  }
139
+  
140
+  const publicOrNoPublic = (row) => () => {
141
+      if (row.publishStatus === 1) {
142
+        row.publishStatus = 0
143
+      } else {
144
+        row.publishStatus = 1
145
+      }
146
+
147
+      request({
148
+        url: '/api/admin/taPolicy/'+row.policyId,
149
+        method: 'PUT',
150
+        data: row,
151
+      }).then((data) => {
152
+          console.log(data)
153
+          message.info('操作成功!')
154
+          getList({ pageNum: 1, pageSize: 10,cityId: '' });
155
+      }).catch((err) => {
156
+          console.log(err)
157
+          message.info(err.msg || err.message)
158
+      })
159
+  }
160
+  
161
+  const changePageNum = (pageNumber) => {
162
+      getList({ pageNum: pageNumber, pageSize: 10 })
163
+  }
164
+
165
+  // 提交事件
166
+const handleSubmit = (e, props) => {
167
+    e.preventDefault();
168
+    props.form.validateFields((err, values) => {
169
+      if (!err) {
170
+        console.log('提交数据: ', values)
171
+        getList({ pageNum: 1, pageSize: 10, ...values })
172
+      }
173
+    });
174
+  }
175
+
176
+  const { getFieldDecorator } = props.form
177
+  return (
178
+
179
+    <>
180
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
181
+        <Form.Item>
182
+          {getFieldDecorator('cityId')(
183
+            <SelectCity />,
184
+          )}
185
+        </Form.Item>
186
+        <Form.Item>
187
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
188
+            搜索
189
+          </Button>
190
+        </Form.Item>
191
+      </Form>
192
+      <Button type="primary" className={styles.addBtn} onClick={toEditPolicy()}>新增</Button>
193
+      <Table dataSource={data.records} columns={columns} pagination={false}/>
194
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
195
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
196
+      </div>
197
+    </>
198
+  )
199
+}
200
+const WrappedHeader = Form.create({ name: 'header' })(header);
201
+
202
+export default WrappedHeader

+ 69
- 0
src/pages/system/intention.jsx View File

@@ -0,0 +1,69 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message,Checkbox,Row, Col } 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
+import SelectCity from '../../components/SelectButton/CitySelect'
12
+
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+/**
15
+ *
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+ const Edit = (props) => {
21
+  const [ data, setData ] = useState([])
22
+
23
+  const changBuilding = (buildingId) => {
24
+    request({
25
+      url: '/api/admin/tdBizEventIntention',
26
+      method: 'GET',
27
+      params: {pageNum: 1, pageSize: 999,buildingId}
28
+    }).then((data) => {
29
+      console.log(data)
30
+      setData(data.records)
31
+    })
32
+  }
33
+
34
+  return (
35
+    <>
36
+    <Row>
37
+      <Col span={12}>
38
+        <BuildSelect onChange={changBuilding}/>
39
+      </Col>
40
+    </Row>
41
+    <Row>
42
+      <Col span={6} offset={6}>
43
+        用户操作
44
+      </Col>
45
+      <Col span={6} offset={6}>
46
+        意向值
47
+      </Col>
48
+    </Row>
49
+    {data.map((x) => {
50
+      console.log(x)
51
+      return <Row>
52
+                <Col span={6} offset={6}>
53
+                {x.eventName}
54
+                </Col>
55
+                <Col span={6} offset={6}>
56
+                  {x.intention}
57
+                </Col>
58
+              </Row>
59
+    })}
60
+    <Row>
61
+      <Button type="primary" className={styles.searchBtn} >确定</Button>
62
+    </Row>
63
+    </>
64
+  );
65
+ }
66
+
67
+
68
+
69
+export default Edit

+ 16
- 0
src/services/apis.js View File

@@ -26,6 +26,22 @@ export default {
26 26
       method: 'GET',
27 27
       url: `${prefix}/buildingApartment/buildingId/id`,
28 28
     },
29
+    buildingApartmentGetById: {
30
+      method: 'GET',
31
+      url: `${prefix}/buildingApartment/id`,
32
+    },
33
+    buildingApartmentUpdate: {
34
+      method: 'PUT',
35
+      url: `${prefix}/buildingApartment/update`,
36
+    },
37
+    buildingApartmentAdd: {
38
+      method: 'POST',
39
+      url: `${prefix}/buildingApartment/add`,
40
+    },
41
+    buildingApartmentDelete: {
42
+      method: 'DELETE',
43
+      url: `${prefix}/apartment/deleted/id`,
44
+    },
29 45
   },
30 46
   buildingType: {
31 47
     getList: {