andrew 4 anos atrás
pai
commit
ba54172739
25 arquivos alterados com 5378 adições e 0 exclusões
  1. 647
    0
      estateagents-admin-manager/src/pages/building/list/add/components/base.jsx
  2. 290
    0
      estateagents-admin-manager/src/pages/building/list/add/components/buildingImage.jsx
  3. 305
    0
      estateagents-admin-manager/src/pages/building/list/add/components/buildingProjectType.jsx
  4. 197
    0
      estateagents-admin-manager/src/pages/building/list/add/components/imageSet.jsx
  5. 259
    0
      estateagents-admin-manager/src/pages/building/list/add/components/modalImage.jsx
  6. 250
    0
      estateagents-admin-manager/src/pages/building/list/add/components/modalPanoramaImage.jsx
  7. 184
    0
      estateagents-admin-manager/src/pages/building/list/add/components/panoramaImage.jsx
  8. 164
    0
      estateagents-admin-manager/src/pages/building/list/add/components/poster.jsx
  9. 96
    0
      estateagents-admin-manager/src/pages/building/list/add/components/share.jsx
  10. 107
    0
      estateagents-admin-manager/src/pages/building/list/add/components/tags.jsx
  11. 118
    0
      estateagents-admin-manager/src/pages/building/type/edi.jsx
  12. 125
    0
      estateagents-admin-manager/src/pages/building/type/index.jsx
  13. 48
    0
      estateagents-admin-manager/src/pages/building/type/style.css
  14. 49
    0
      estateagents-admin-manager/src/pages/building/type/style.less
  15. 47
    0
      estateagents-admin-manager/src/pages/building/type/style.wxss
  16. 124
    0
      estateagents-admin-manager/src/pages/carouselFigure/LiveGroup.jsx
  17. 110
    0
      estateagents-admin-manager/src/pages/carouselFigure/SalesBatchGroup.jsx
  18. 114
    0
      estateagents-admin-manager/src/pages/carouselFigure/SelectActivity.jsx
  19. 110
    0
      estateagents-admin-manager/src/pages/carouselFigure/SelectGroup.jsx
  20. 286
    0
      estateagents-admin-manager/src/pages/carouselFigure/advertisingList.jsx
  21. 284
    0
      estateagents-admin-manager/src/pages/carouselFigure/carouselFigureList.jsx
  22. 426
    0
      estateagents-admin-manager/src/pages/carouselFigure/editAdvertising.jsx
  23. 393
    0
      estateagents-admin-manager/src/pages/carouselFigure/editCarousel.jsx
  24. 361
    0
      estateagents-admin-manager/src/pages/carouselFigure/propaganda.jsx
  25. 284
    0
      estateagents-admin-manager/src/pages/carouselFigure/propagandaList.jsx

+ 647
- 0
estateagents-admin-manager/src/pages/building/list/add/components/base.jsx Ver arquivo

@@ -0,0 +1,647 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber, notification } from 'antd';
3
+import moment from 'moment';
4
+import { router } from 'umi';
5
+import { ifError } from 'assert';
6
+import request from '../../../../../utils/request';
7
+import apis from '../../../../../services/apis';
8
+import Styles from '../style.less';
9
+import ImageUpload from '../../../../../components/XForm/ImageUpload'
10
+import NewImageUpload from '../../../../../components/uploadImage/ImageUpload';
11
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
12
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
13
+import TagGroup from './tags'
14
+import Amap from './amap'
15
+import BudildingProjectType from './buildingProjectType'
16
+import DragableUploadImageList from '@/components/DragableUploadImageList'
17
+import SelectCity from '../../../../../components/SelectButton/CitySelect'
18
+import AreaSelect from '../../../../../components/SelectButton/AreaSelect'
19
+import FileUpload from '@/components/XForm/FileUpload';
20
+import { POI_TYPES_KETY, getAroundData, getPOIType, POI_TYPES } from './amapAroundData'
21
+
22
+const { Option } = Select
23
+const { TabPane } = Tabs;
24
+
25
+const formItemLayout = {
26
+  labelCol: {
27
+    xs: { span: 24 },
28
+    sm: { span: 2 },
29
+  },
30
+  wrapperCol: {
31
+    xs: { span: 24 },
32
+    sm: { span: 16 },
33
+  },
34
+};
35
+
36
+
37
+function openNotificationWithIcon(type, message) {
38
+  notification[type]({
39
+    message,
40
+    description:
41
+      '',
42
+  });
43
+}
44
+
45
+
46
+function AddBuilding(props) {
47
+  const { getFieldDecorator } = props.form;
48
+
49
+  const [poi, setPoi] = useState([])
50
+  const [videoImage, setVideoImage] = useState(false)
51
+  const [typeState, setTypeState] = useState("rich")
52
+  const [cityId, setCityId] = useState("")
53
+
54
+  // 存放所以 buildingData 基础信息
55
+  const [buildingData, setBuildingData] = useState({})
56
+
57
+  // console.log('props.building: ', props.building)
58
+  const { buildingId } = props.building
59
+     // eslint-disable-next-line react-hooks/rules-of-hooks
60
+  useEffect(() => {
61
+      if (buildingId && buildingId !== '') {
62
+        getById(buildingId)
63
+      }
64
+  }, [buildingId])
65
+
66
+  useEffect(() => {
67
+    setPoiTagValue()
68
+  }, [poi])
69
+
70
+
71
+  // 把地图设置在的数据设置在 tag控件上 上
72
+  function setPoiTagValue() {
73
+    if (poi) {
74
+      console.log('poi: ', poi)
75
+
76
+
77
+      poi.map(x => {
78
+        const ty = Object.prototype.toString
79
+        // console.log('x.data: ', JSON.parse(x.data))
80
+        // console.log('x.data: ', typeof x.data, x.data instanceof String, ty.call(x.data))
81
+        if (ty.call(x.data) === '[object String]') {
82
+          setFormMapScopeTagValue(x.key, { data: JSON.parse(x.data) })
83
+        }
84
+      })
85
+    }
86
+  }
87
+
88
+   // 获取详情信息
89
+   function getById(currentId) {
90
+    request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
91
+      // if (res.openingDate !== null) {
92
+      //   res.openingDate = moment(res.openingDate)
93
+      // }
94
+      setTypeState(res.highlightsType)
95
+      if (res.receivedDate !== null) {
96
+        res.receivedDate = moment(res.receivedDate)
97
+      }
98
+      if (res.buildingTag !== null) {
99
+        res.tag = res.buildingTag.map((item, _) => item.tagName)
100
+      }
101
+      if (res.buildingImg !== null) {
102
+        res.avatarImage = res.buildingImg.map(item => item.url)
103
+      }
104
+
105
+      if (res.buildingListImg) {
106
+        // res.listImage = res.buildingListImg.map(item => item.url)
107
+        res.listImage = res.buildingListImg.map(item => item.url)[0]
108
+      }
109
+      res.mapCoordinate = res.coordinate
110
+      if (res.videoUrl) {
111
+        res.videoUrl = [].concat(res.videoUrl)
112
+        setVideoImage(true)
113
+      }
114
+      if (res.videoImage) {
115
+        res.videoImage = res.videoImage[0].url
116
+      }
117
+
118
+      res.buildingTransport = stringHandleTag(res.buildingTransport)
119
+      res.buildingMall = stringHandleTag(res.buildingMall)
120
+      res.buildingEdu = stringHandleTag(res.buildingEdu)
121
+      res.buildingHospital = stringHandleTag(res.buildingHospital)
122
+      res.buildingBank = stringHandleTag(res.buildingBank)
123
+      res.buildingRestaurant = stringHandleTag(res.buildingRestaurant)
124
+
125
+      setBuildingData(res)
126
+
127
+      props.form.setFieldsValue(res)
128
+      // console.log('mapJson: ', JSON.parse(res.mapJson))
129
+      setPoi((res.mapJson && JSON.parse(res.mapJson)) || [])
130
+      props.onSuccess(res)
131
+    })
132
+  }
133
+
134
+  /**
135
+   * 把 xxx,xxx,xxx  这样的格式转换成 [{ tagName: xxx, delete: true, automatic: false }, { tagName: xxx, delete: true, automatic: false }]
136
+   * @param {*} str
137
+   * @return 如果返回 str 为空 或者 非 string,则返回 str 本身,否则返回转换成功的数组
138
+   */
139
+  function stringHandleTag(str) {
140
+    if (typeof str === 'string' && str !== '') {
141
+      const arr = str.split(',')
142
+      return arrayTransition(arr)
143
+    }
144
+
145
+    return str
146
+  }
147
+
148
+  /**
149
+   * 把 [xxx,xxx,xxx]  这样的格式转换成 [{ tagName: xxx, delete: true, automatic: false }, { tagName: xxx, delete: true, automatic: false }]
150
+   * @param {*} arr
151
+   */
152
+  function arrayTransition(arr) {
153
+    return arr.map(x => ({ tagName: x, delete: true, automatic: false }))
154
+  }
155
+
156
+  function handleSubmit(e) {
157
+    e.preventDefault();
158
+    props.form.validateFieldsAndScroll((err, values) => {
159
+      if (!err) {
160
+        addBuilding(values)
161
+      }
162
+    });
163
+  }
164
+
165
+  function addBuilding(data) {
166
+    // console.log('poi: ', poi)
167
+    if (poi.length !== 0) {
168
+      data.mapJson = poi
169
+    }
170
+
171
+    // data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
172
+    data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
173
+    // 项目主图
174
+    data.img = data.avatarImage && data.avatarImage.map((item, index) => ({ imgType: 'banner', url: item, orderNo: index + 1 }))
175
+    // 列表图
176
+    data.listImg = data.listImage && [{ imgType: 'list', url: data.listImage, orderNo: 1 }]
177
+    if (data.videoUrl) {
178
+      // console.log(data.videoUrl[0])
179
+      data.videoUrl = data.videoUrl[0]
180
+    }
181
+
182
+    if (data.tag) {
183
+      data.tag = data.tag.map((item, _) => ({ tagName: item }))
184
+    }
185
+
186
+    if (data.videoImage) {
187
+      data.videoImage = [{ imgType: 'videoImage', url: data.videoImage, orderNo: 1 }]
188
+    }
189
+
190
+    if (data.buildingTransport) {
191
+      data.buildingTransport = tagFilter(data.buildingTransport, 'Transport')
192
+    }
193
+    if (data.buildingMall) {
194
+      
195
+      data.buildingMall = tagFilter(data.buildingMall, 'Mall')
196
+    }
197
+    if (data.buildingEdu) {
198
+      data.buildingEdu = tagFilter(data.buildingEdu, 'Edu')
199
+    }
200
+    if (data.buildingHospital) {
201
+      data.buildingHospital = tagFilter(data.buildingHospital, 'Hospital')
202
+    }
203
+    if (data.buildingBank) {
204
+      data.buildingBank = tagFilter(data.buildingBank, 'Bank')
205
+    }
206
+    if (data.buildingRestaurant) {
207
+      data.buildingRestaurant = tagFilter(data.buildingRestaurant, 'Restaurant')
208
+    }
209
+  
210
+    // if(typeof(data.highlights) != "undefined" && (typeof(data.highlightsCover) == "undefined" || data.highlightsCover == null)){
211
+    //   openNotificationWithIcon('error', '请上传项目亮点封面')
212
+    //   return;
213
+    // }
214
+    console.log(data,"datadataddata")
215
+    if(typeof(data.highlights) == "undefined"){
216
+      data.highlights = null;
217
+    }
218
+    
219
+    const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
220
+    request({ ...api, data: { ...data } }).then(res => {
221
+      openNotificationWithIcon('success', '操作成功')
222
+      // router.go(-1)
223
+      getById(res.buildingId)
224
+    }).catch(err => {
225
+      // openNotificationWithIcon('error', err.message)
226
+    })
227
+  }
228
+
229
+  /**
230
+   * 过滤 tag
231
+   * @param {*} tags 
232
+   */
233
+  function tagFilter(tags, keyType) {
234
+    
235
+    console.log(tags)
236
+    if (!tags) {
237
+      return null
238
+    }
239
+
240
+    // 过滤 tag 更新 useState()
241
+
242
+    // 获取地图周边
243
+    const automaticTag = tags.filter(f => f.automatic === true).map(x => x.tagName)
244
+    const determineTag = poi.map(p => {
245
+      if (p.key === keyType) {
246
+        if (typeof p.data === 'string') {
247
+          p.data = JSON.parse(p.data).filter(f => automaticTag.includes(f.name))
248
+        } else {
249
+          p.data = p.data.filter(f => automaticTag.includes(f.name))
250
+        }
251
+      }
252
+      return p
253
+    })
254
+
255
+    setPoi(determineTag)
256
+
257
+    
258
+    return tags.filter(f => f.automatic === false).map(x => x.tagName).join(',')
259
+  }
260
+
261
+  // 视频文件上传前 回调
262
+  function fileUploadBeforeUpload(file, fileList) {
263
+    // console.log('视频文件上传前 回调: ', file, fileList)
264
+    return new Promise((resolve, reject) => {
265
+      if (file.type === 'video/mp4' || file.type === '.mp4') {
266
+          setVideoImage(true)
267
+          resolve(file)
268
+      } else {
269
+        openNotificationWithIcon('error', '项目视频,仅支持MP4格式')
270
+        reject()
271
+      }
272
+    })
273
+  }
274
+
275
+  // 周边设施 回调
276
+  function getMapScope(e) {
277
+    const coordinateValue = props.form.getFieldValue('coordinate')
278
+    if (!coordinateValue) {
279
+      openNotificationWithIcon('error', '请先选择项目坐标位置')
280
+      return
281
+    }
282
+    const coordinate = props.form.getFieldValue('coordinate').split(',')
283
+    const poiData = [].concat(POI_TYPES)
284
+    poiData.map(item => {
285
+      getAroundData({ types: item.key, location: `${coordinate[1]},${coordinate[0]}`, radius: e }).then(res => {
286
+        const { pois } = res
287
+        setFormMapScopeValue(item.key, pois)
288
+      }).catch(err => {
289
+        console.log(err.message)
290
+        openNotificationWithIcon('error', '周边数据获取失败')
291
+      })
292
+    })
293
+  }
294
+
295
+  function highlightsTypeChange(e) {
296
+    console.log(e.target.value,"ee")
297
+    setTypeState(e.target.value)
298
+  }
299
+
300
+  function setFormMapScopeValue(key, pois) {
301
+    const poiArray = pois.map(p => ({
302
+        address: p.address,
303
+        adname: p.adname,
304
+        cityname: p.cityname,
305
+        distance: p.distance,
306
+        id: p.id,
307
+        location: p.location,
308
+        name: p.name,
309
+        pname: p.pname,
310
+        shopinfo: p.shopinfo,
311
+        type: p.type,
312
+        typecode: p.typecode,
313
+      }))
314
+
315
+    // 设置表单值
316
+    setFormMapScopeTagValue(key, { data: poiArray })
317
+
318
+    const poiData = [].concat(POI_TYPES)
319
+    const newPoi = poiData.map(m => {
320
+      if (m.key === key) {
321
+        m.data = poiArray
322
+      }
323
+      return m
324
+    })
325
+
326
+    setPoi(newPoi)
327
+    return newPoi
328
+  }
329
+
330
+  function cityChange(e) {
331
+    setCityId(e)
332
+    if(buildingData.cityId === e){
333
+      setTimeout(()=>{
334
+        props.form.setFieldsValue({
335
+            'buildingArea': buildingData.buildingArea
336
+        })
337
+    },0)
338
+    }
339
+  }
340
+
341
+  function setFormMapScopeTagValue(keyType, item) {
342
+    const tag = item.data.map(t => ({ tagName: t.name, delete: true, automatic: true }))
343
+    switch (keyType) {
344
+      case POI_TYPES_KETY.Transport:
345
+        const buildingTransportValue = (stringHandleTag(buildingData.buildingTransport) || [])
346
+        props.form.setFieldsValue({ buildingTransport: tag.concat(buildingTransportValue) })
347
+        return 'buildingTransport';
348
+      case POI_TYPES_KETY.Bank:
349
+        const buildingBankValue = (stringHandleTag(buildingData.buildingBank) || [])
350
+        props.form.setFieldsValue({ buildingBank: tag.concat(buildingBankValue) })
351
+        return 'buildingBank';
352
+      case POI_TYPES_KETY.Edu:
353
+        const buildingEduValue = (stringHandleTag(buildingData.buildingEdu) || [])
354
+        props.form.setFieldsValue({ buildingEdu: tag.concat(buildingEduValue) })
355
+        return 'buildingEdu';
356
+      case POI_TYPES_KETY.Hospital:
357
+        const buildingHospitalValue = (stringHandleTag(buildingData.buildingHospital) || [])
358
+        props.form.setFieldsValue({ buildingHospital: tag.concat(buildingHospitalValue) })
359
+        return 'buildingHospital';
360
+      case POI_TYPES_KETY.Restaurant:
361
+        const buildingRestaurantValue = (stringHandleTag(buildingData.buildingRestaurant) || [])
362
+        props.form.setFieldsValue({ buildingRestaurant: tag.concat(buildingRestaurantValue) })
363
+        return 'buildingRestaurant';
364
+      case POI_TYPES_KETY.Mall:
365
+        const buildingMallValue = (stringHandleTag(buildingData.buildingMall) || [])
366
+        props.form.setFieldsValue({ buildingMall: tag.concat(buildingMallValue) })
367
+        return 'buildingMall';
368
+      default:
369
+        return ''
370
+    }
371
+  }
372
+
373
+  return (
374
+        <Form {...formItemLayout} onSubmit={handleSubmit}>
375
+          <Form.Item label="项目Id" style={{ display: 'none' }}>
376
+            {getFieldDecorator('buildingId')(<Input disabled />)}
377
+          </Form.Item>
378
+          <Form.Item label="楼盘编号" >
379
+            {getFieldDecorator('code', {
380
+              rules: [{ required: true, message: '请输入楼盘编号' }],
381
+            })(<Input />)}
382
+          </Form.Item>
383
+          <Form.Item label="楼盘名称" >
384
+            {getFieldDecorator('buildingName', {
385
+              rules: [{ required: true, message: '请输入楼盘名' }],
386
+            })(<Input />)}
387
+          </Form.Item>
388
+          {/* <Form.Item label="别名" >
389
+            {getFieldDecorator('name')(<Input />)}
390
+          </Form.Item> */}
391
+          <Form.Item label="项目类型">
392
+            {getFieldDecorator('buildingProjectType', {
393
+              rules: [{ required: true, message: '请选择项目类型' }],
394
+            })(<BudildingProjectType />)}
395
+          </Form.Item>
396
+          <Form.Item label="列表展示均价" help="项目列表展示价格,示例:约10000元/㎡、约1000万元/套起">
397
+            {/* {getFieldDecorator('price')(<Input type="number" style={{ width: '210px' }}/>)}元/m² */}
398
+            {getFieldDecorator('price')(<Input />)}
399
+          </Form.Item>
400
+          <Form.Item label="开盘时间" >
401
+            {getFieldDecorator('openingDate')(<Input placeholder="预计xxxx年xx月开盘" maxLength = "15"/>)}
402
+          </Form.Item>
403
+          <Form.Item label="电话" >
404
+            {getFieldDecorator('tel', {
405
+              initialValue: '',
406
+              rules: [
407
+                  {
408
+                      pattern: new RegExp('^[0-9]*$'),
409
+                      message: '请输入正确的电话号码',
410
+                  },
411
+              ],
412
+            })(<Input />)}
413
+          </Form.Item>
414
+          <Form.Item label="项目说明" >
415
+            {getFieldDecorator('dynamic')(<Input placeholder="项目动态等,不超过30个字" maxLength = "30"/>)}
416
+          </Form.Item>
417
+          <Form.Item label="物业类型" >
418
+            {getFieldDecorator('propertyType')(
419
+              // <Select mode="multiple" placeholder="物业类型" style={{ width: '1016px' }}>
420
+              //   <Option value="未知">未知</Option>
421
+              // </Select>,
422
+              <Input />,
423
+            )}
424
+          </Form.Item>
425
+          <Form.Item label="销售状态" >
426
+            {getFieldDecorator('marketStatus', {
427
+              rules: [{ required: true, message: '请选择销售状态' }],
428
+            })(
429
+              <Select placeholder="销售状态" style={{ width: '1016px' }}>
430
+                {/* <Option value="待定">待定</Option>
431
+                <Option value="在售">在售</Option>
432
+                <Option value="售完">售完</Option> */}
433
+                <Option value="在线选房">在线选房</Option>
434
+                <Option value="待售">待售</Option>
435
+                <Option value="在售">在售</Option>
436
+                <Option value="售罄">售罄</Option>
437
+                <Option value="在租">在租</Option>
438
+              </Select>,
439
+            )}
440
+          </Form.Item>
441
+          <Form.Item label="项目标签" >
442
+            {getFieldDecorator('tag')(
443
+              <Select mode="tags" placeholder="输入后选中" style={{ width: '1016px' }}>
444
+
445
+              </Select>,
446
+            )}
447
+          </Form.Item>
448
+          <Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:750*600,比例5:4,用于楼盘详情">
449
+            {getFieldDecorator('videoUrl')(
450
+              // disabled={fileUploadDisabled}
451
+              <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
452
+            )}
453
+          </Form.Item>
454
+          <Form.Item label="视频封面图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于视频封面" >
455
+            {getFieldDecorator('videoImage', {
456
+              rules: [{ required: videoImage, message: '请选择视频封面图' }],
457
+            })(
458
+              <ImageUpload />,
459
+            )}
460
+          </Form.Item>
461
+          <Form.Item label="楼盘主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘详情">
462
+            {getFieldDecorator('avatarImage', {
463
+              rules: [{ required: true, message: '请选择项目主图' }],
464
+            })(
465
+              <DragableUploadImageList multiple={true} />,
466
+            )}
467
+          </Form.Item>
468
+          <Form.Item label="楼盘封面图" help="建议图片尺寸:750*420px,比例16:9,格式:jpg,用于楼盘列表">
469
+            {getFieldDecorator('listImage', {
470
+              rules: [{ required: true, message: '请选择列表图' }],
471
+            })(
472
+              <ImageUpload />,
473
+            )}
474
+          </Form.Item>
475
+          {/* <Form.Item label="地址图片" help="建议图片尺寸:750px*455px">
476
+            {getFieldDecorator('mapImg')(
477
+              <ImageUpload />,
478
+            )}
479
+          </Form.Item> */}
480
+          {/* <Form.Item label="海报底图" help="建议图片尺寸:640px*1136px" >
481
+            {getFieldDecorator('poster')(
482
+              <ImageUpload />,
483
+            )}
484
+          </Form.Item> */}
485
+          <Form.Item label="排序" help="数值越大,楼盘在小程序列表页中展示越靠前">
486
+            {getFieldDecorator('orderNo')(<Input />)}
487
+          </Form.Item>
488
+          {/* <Form.Item label="优惠信息" >
489
+            {getFieldDecorator('discount')(<Input />)}
490
+          </Form.Item> */}
491
+          <Form.Item label="首页推荐" >
492
+            {getFieldDecorator('isMain', {
493
+              initialValue: 1,
494
+            })(
495
+            <Radio.Group>
496
+              <Radio value={1}>是</Radio>
497
+              <Radio value={2}>否</Radio>
498
+            </Radio.Group>,
499
+            )}
500
+          </Form.Item>
501
+          <Form.Item label="所在城市" >
502
+            {getFieldDecorator('cityId', {
503
+              rules: [{ required: true, message: '请选择城市' }],
504
+            })(
505
+              <SelectCity onChange={(e) => cityChange(e)}/>,
506
+            )}
507
+          </Form.Item>
508
+          <Form.Item label="楼盘区域" >
509
+            {getFieldDecorator('buildingArea', {
510
+              rules: [{ required: true, message: '请输入楼盘区域' }],
511
+            })(<AreaSelect cityId={cityId}/>)}
512
+          </Form.Item>
513
+          <Form.Item label="项目地址" >
514
+            {getFieldDecorator('address', {
515
+              rules: [{ required: true, message: '请输入项目地址' }],
516
+            })(<Input />)}
517
+          </Form.Item>
518
+          <Form.Item label="项目坐标" >
519
+            {getFieldDecorator('coordinate', {
520
+              rules: [{ required: true, message: '请输入项目坐标' }],
521
+            })(<Input disabled />)}
522
+          </Form.Item>
523
+          <Form.Item label="地图位置" >
524
+            {getFieldDecorator('mapCoordinate')(<Amap onChange={e => props.form.setFieldsValue({ coordinate: e })}/>)}
525
+          </Form.Item>
526
+          <Form.Item label="周边设施搜索范围" style={{ width: '2000px' }}>
527
+            {getFieldDecorator('mapScope', {
528
+              rules: [{ required: true, message: '请选择周边设施搜索范围' }],
529
+            })(
530
+              <Select placeholder="请选择周边设施搜索范围" style={{ width: '970px' }} onChange={e => getMapScope(e)}>
531
+                <Option value={1000}>1公里</Option>
532
+                <Option value={3000}>3公里</Option>
533
+                <Option value={5000}>5公里</Option>
534
+                <Option value={10000}>10公里</Option>
535
+              </Select>,
536
+            )}
537
+          </Form.Item>
538
+          <Form.Item label="周边交通" >
539
+            {getFieldDecorator('buildingTransport')(
540
+              <TagGroup />,
541
+            )}
542
+          </Form.Item>
543
+          <Form.Item label="周边商业" >
544
+            {getFieldDecorator('buildingMall')(
545
+              <TagGroup />,
546
+            )}
547
+          </Form.Item>
548
+          <Form.Item label="周边学校" >
549
+            {getFieldDecorator('buildingEdu')(
550
+              <TagGroup />,
551
+            )}
552
+          </Form.Item>
553
+          <Form.Item label="周边医院" >
554
+            {getFieldDecorator('buildingHospital')(
555
+              <TagGroup />,
556
+            )}
557
+          </Form.Item>
558
+          <Form.Item label="周边银行" >
559
+            {getFieldDecorator('buildingBank')(
560
+              <TagGroup />,
561
+            )}
562
+          </Form.Item>
563
+          <Form.Item label="周边餐饮" >
564
+            {getFieldDecorator('buildingRestaurant')(
565
+              <TagGroup />,
566
+            )}
567
+          </Form.Item>
568
+          <Form.Item label="绿化率" >
569
+            {getFieldDecorator('greeningRate')(<Input />)}
570
+          </Form.Item>
571
+          <Form.Item label="容积率" >
572
+            {getFieldDecorator('volumeRate')(<Input />)}
573
+          </Form.Item>
574
+          <Form.Item label="车位比" >
575
+            {getFieldDecorator('parkingRate')(<Input />)}
576
+          </Form.Item>
577
+          <Form.Item label="规划户数" >
578
+            {getFieldDecorator('familyNum')(<InputNumber />)}
579
+          </Form.Item>
580
+          <Form.Item label="物业公司" >
581
+            {getFieldDecorator('serviceCompany')(<Input placeholder="不超过30个字" maxLength = "30"/>)}
582
+          </Form.Item>
583
+          <Form.Item label="物业费" >
584
+            {getFieldDecorator('serviceFee')(<Input placeholder="不超过30个字" maxLength = "30"/>)}
585
+          </Form.Item>
586
+          <Form.Item label="装修标准" >
587
+            {getFieldDecorator('decoration')(<Input />)}
588
+          </Form.Item>
589
+          <Form.Item label="开发商" >
590
+            {getFieldDecorator('propertyDeveloper')(<Input placeholder="不超过30个字" maxLength = "30"/>)}
591
+          </Form.Item>
592
+          <Form.Item label="备案名" >
593
+            {getFieldDecorator('recordName')(<Input placeholder="不超过30个字" maxLength = "30"/>)}
594
+          </Form.Item>
595
+          <Form.Item label="楼栋总数" >
596
+            {getFieldDecorator('buildingNum')(<Input min={0} type="number" style={{ width: 80}}/>)}
597
+          </Form.Item>
598
+          {/* <Form.Item label="交房时间" >
599
+            {getFieldDecorator('receivedDate')(<DatePicker />)}
600
+          </Form.Item> */}
601
+          {/* <Form.Item label="产权年限" >
602
+            {getFieldDecorator('rightsYear')(<InputNumber />)}
603
+          </Form.Item> */}
604
+          {/* <Form.Item label="预售许可证" >
605
+            {getFieldDecorator('preSalePermit')(
606
+              <ImageUpload />,
607
+            )}
608
+          </Form.Item>*/}
609
+          <Form.Item label="亮点封面" help="建议尺寸:比例3:1 690*230px,用于项目详情-项目亮点封面图">
610
+            {getFieldDecorator('highlightsCover')(
611
+              <NewImageUpload onChange={e => console.log(e,"66")}/>,
612
+            )}
613
+          </Form.Item>
614
+          <Form.Item label="亮点类型" help="说明:项目亮点必须上传封面图才会在小程序端展示">
615
+            {getFieldDecorator('highlightsType',{
616
+              initialValue: "rich",
617
+            })(
618
+            <Radio.Group onChange={e => highlightsTypeChange(e)}>
619
+              <Radio value="rich">自定义</Radio>
620
+              <Radio value="link">公众号链接</Radio>
621
+            </Radio.Group>,
622
+            )}
623
+          </Form.Item>
624
+          {typeState === 'link' && <Form.Item label="公众号链接" help="只能填写同一主体公众号的文章链接">
625
+            {getFieldDecorator('highlightsLink')(<Input placeholder="请输入公众号链接" />)}
626
+          </Form.Item>}
627
+          {typeState === 'rich' && <Form.Item label="亮点内容" >
628
+            {getFieldDecorator('highlights')(
629
+              <Wangedit />,
630
+            )}
631
+          </Form.Item> }
632
+          <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
633
+            <Button type="primary" htmlType="submit">
634
+                确定
635
+            </Button>
636
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
637
+            <Button onClick={() => router.go(-1)}>
638
+                取消
639
+            </Button>
640
+          </Form.Item>
641
+        </Form>
642
+  )
643
+}
644
+
645
+const WrappedAddBuildingForm = Form.create({ name: 'addBuilding' })(AddBuilding);
646
+
647
+export default WrappedAddBuildingForm

+ 290
- 0
estateagents-admin-manager/src/pages/building/list/add/components/buildingImage.jsx Ver arquivo

@@ -0,0 +1,290 @@
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, Modal, Layout } from 'antd';
3
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload';
4
+import moment from 'moment';
5
+import request from '../../../../../utils/request';
6
+import apis from '../../../../../services/apis';
7
+import router from 'umi/router';
8
+import DragableUploadImageList from '@/components/DragableUploadImageList'
9
+
10
+const { Header, Footer, Sider, Content } = Layout;
11
+
12
+const modalEdiFormItemLayout = {
13
+  labelCol: {
14
+    xs: { span: 24 },
15
+    sm: { span: 8 },
16
+  },
17
+  wrapperCol: {
18
+    xs: { span: 24 },
19
+    sm: { span: 16 },
20
+  },
21
+};
22
+
23
+const openNotificationWithIcon = (type, message) => {
24
+  notification[type]({
25
+    message,
26
+    description:
27
+      '',
28
+  });
29
+};
30
+
31
+/**
32
+ * 弹框
33
+ */
34
+function ModalEdi(props) {
35
+  const { apartment, buildingId, apartmentId } = props.visibleData
36
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
37
+
38
+  if (!props.visibleData) {
39
+    console.error('缺少visibleData参数!')
40
+  }
41
+
42
+  useEffect(() => {
43
+    setVisibleData(props.visibleData)
44
+    props.form.setFieldsValue({ apartmentId, apartmentName: apartment !== '' ? apartment.apartmentName : '' })
45
+  }, [props.visibleData.visible])
46
+
47
+  function handleOk(e) {
48
+    // console.log(e);
49
+    props.onCancel();
50
+    props.form.resetFields();
51
+  }
52
+
53
+  function handleCancel(e) {
54
+    // console.log(e);
55
+    props.onCancel();
56
+    props.form.resetFields();
57
+  }
58
+
59
+  function handleSubmit(e) {
60
+    e.preventDefault();
61
+    props.form.validateFieldsAndScroll((err, values) => {
62
+      if (!err) {
63
+        console.log('Received values of form: ', values);
64
+        submitData(values)
65
+      }
66
+    });
67
+  }
68
+
69
+  function submitData(data) {
70
+    if (buildingId === '' || buildingId === undefined) {
71
+      return
72
+    }
73
+    if (data.img) {
74
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
75
+      data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
76
+    } else {
77
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
78
+      data.img = visibleData.apartment.buildingImgList
79
+    }
80
+    data.buildingId = buildingId;
81
+    data.apartmentType = 'photo'
82
+    const api = (data.apartmentId !== undefined && data.apartmentId !== '') ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
83
+
84
+    // 网路请求
85
+    request({ ...api, data: { ...data } }).then(() => {
86
+      // eslint-disable-next-line no-unused-expressions
87
+      openNotificationWithIcon('success', '操作成功')
88
+      handleCancel()
89
+      props.onSuccess()
90
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
91
+    }).catch(err => {
92
+      // eslint-disable-next-line no-unused-expressions
93
+      openNotificationWithIcon('error', err)
94
+    })
95
+  }
96
+
97
+  const { getFieldDecorator } = props.form;
98
+  return (
99
+    <>
100
+      <Modal
101
+          title="编辑"
102
+          visible={visibleData.visible}
103
+          onOk={handleOk}
104
+          onCancel={handleCancel}
105
+          width={700}
106
+          footer={null}
107
+        >
108
+         <Form {...modalEdiFormItemLayout} onSubmit={handleSubmit}>
109
+          <Form.Item label="编号" style={{ display: 'none' }}>
110
+              {getFieldDecorator('apartmentId')(<Input />)}
111
+          </Form.Item>
112
+          <Form.Item label="相册名称">
113
+            {getFieldDecorator('apartmentName', {
114
+              rules: [
115
+                {
116
+                  required: true,
117
+                  message: '请输入相册名称',
118
+                },
119
+                {
120
+                  max: 10,
121
+                  message: '不超过10个字符',
122
+                },
123
+              ],
124
+            })(<Input />)}
125
+          </Form.Item>
126
+          {
127
+            !props.noImage && <Form.Item label="选择图片" help="建议图片尺寸750px*562px,比例4:3,格式:jpg">
128
+            {getFieldDecorator('img', {
129
+              rules: [
130
+                {
131
+                  required: true,
132
+                  message: '请选择图片',
133
+                },
134
+              ],
135
+            })(<ImageListUpload />)}
136
+          </Form.Item>
137
+          }
138
+          <Form.Item style={{ display: 'flex', justifyContent: 'flex-end' }}>
139
+            <Button type="primary" htmlType="submit">
140
+              保存
141
+            </Button>
142
+            &nbsp;&nbsp;&nbsp;&nbsp;
143
+            <Button onClick={() => handleCancel()}>
144
+              取消
145
+            </Button>
146
+          </Form.Item>
147
+         </Form>
148
+        </Modal>
149
+    </>
150
+  )
151
+}
152
+
153
+const WrappedModalEdiForm = Form.create({ name: 'ModalEdi' })(ModalEdi);
154
+
155
+/**
156
+ * 模块
157
+ */
158
+function BuildingImageModel(props) {
159
+  const [imageList, setImageList] = useState([])
160
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
161
+
162
+  useEffect(() => {
163
+    setImageList(getImgUrl())
164
+  }, [props.apartment.apartmentId])
165
+
166
+  function getImgUrl() {
167
+    return ((props.apartment.buildingImgList || [])).map(item => item.url)
168
+  }
169
+
170
+  function submitData(data) {
171
+    const { apartmentId } = props.apartment
172
+    if (apartmentId === '' || apartmentId === undefined) {
173
+      return
174
+    }
175
+
176
+    data.buildingId = props.apartment.buildingId;
177
+    data.apartmentType = 'photo'
178
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
179
+
180
+    // 网路请求
181
+    request({ ...api, data: { ...data } }).then(() => {
182
+      // eslint-disable-next-line no-unused-expressions
183
+      openNotificationWithIcon('success', '操作成功')
184
+    }).catch(err => {
185
+      // eslint-disable-next-line no-unused-expressions
186
+      // openNotificationWithIcon('error', err)
187
+    })
188
+  }
189
+
190
+  function onImageChange(e) {
191
+    setImageList(e)
192
+       
193
+    // 新增加图片后,更新后端数据
194
+    const img = e.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
195
+    submitData({ ...props.apartment, img })
196
+  }
197
+
198
+  function edi() {
199
+    setVisibleData({ visible: true, buildingId: props.apartment.buildingId, apartmentId: props.apartment.apartmentId, apartment: props.apartment })
200
+  }
201
+
202
+  function onCancel(e) {
203
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
204
+  }
205
+
206
+  function deletePhoto() {
207
+    Modal.confirm({
208
+      title: '确认删除当前相册',
209
+      // content: 'Bla bla ...',
210
+      okText: '确认',
211
+      cancelText: '取消',
212
+      onOk: () => {
213
+        request({ ...apis.building.buildingApartmentDelete, urlData: { id: props.apartment.apartmentId } }).then(() => {
214
+          openNotificationWithIcon('success', '操作成功')
215
+          props.onSuccess()
216
+        }).catch(err => {
217
+    
218
+        })
219
+      },
220
+    });
221
+    
222
+  }
223
+
224
+  return (
225
+    <>
226
+      <Button style={{ marginLeft: '18px', float: 'right' }} onClick={() => router.go(-1)}>返回</Button>
227
+      <span style={{ marginTop: '10px', marginBottom: '10px' }}>{props.apartment.apartmentName}({imageList.length})</span>
228
+      <Button type="link" style={{ color: 'blue' }} onClick={() => edi()}>重命名</Button>
229
+      <Button type="link" style={{ color: 'blue' }} onClick={() => deletePhoto()}>删除相册</Button>
230
+      <DragableUploadImageList value={imageList} onChange={onImageChange} unlimited/>
231
+      {/* <ImageListUpload value={imageList} onChange={onImageChange} unlimited/> */}
232
+
233
+       {/* 编辑页 */}
234
+       <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={() => props.onSuccess()} noImage/>
235
+       <hr />
236
+    </>
237
+  )
238
+}
239
+
240
+/**
241
+ * 主体
242
+ */
243
+function buildingImage(props) {
244
+  // eslint-disable-next-line react-hooks/rules-of-hooks
245
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
246
+  const [imageList, setImageList] = useState([])
247
+
248
+  // eslint-disable-next-line react-hooks/rules-of-hooks
249
+  useEffect(() => {
250
+    getList()
251
+  }, [props.building.buildingId])
252
+ 
253
+
254
+  function edi() {
255
+    setVisibleData({ visible: true, buildingId: props.building.buildingId, apartmentId: '', apartment: '' })
256
+  }
257
+
258
+  function onCancel(e) {
259
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
260
+  }
261
+
262
+  function onSuccess(e) {
263
+    getList()
264
+  }
265
+
266
+  function getList(params) {
267
+    // 网路请求
268
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'photo' } }).then(res => {
269
+      setImageList(res)
270
+    }).catch(err => {
271
+      openNotificationWithIcon('error', err.message)
272
+    })
273
+  }
274
+
275
+  return (
276
+    <>
277
+      <Button type="primary" onClick={() => edi()}>新增</Button>
278
+      <Layout style={{ background: '#fff' }}>
279
+        {
280
+          imageList.map(item => <Content><BuildingImageModel apartment={item} key={item.apartmentId} onSuccess={e => onSuccess(e)}/></Content>)
281
+        }
282
+      </Layout>
283
+
284
+      {/* 编辑页 */}
285
+      <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={e => onSuccess(e)}/>
286
+    </>
287
+  )
288
+}
289
+
290
+export default buildingImage

+ 305
- 0
estateagents-admin-manager/src/pages/building/list/add/components/buildingProjectType.jsx Ver arquivo

@@ -0,0 +1,305 @@
1
+import React, { useEffect, useState } from 'react'
2
+import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox, Select, InputNumber } from 'antd';
3
+import { render } from 'react-dom';
4
+import request from '../../../../../utils/request';
5
+import apis from '../../../../../services/apis';
6
+
7
+
8
+const formItemLayout = {
9
+  labelCol: {
10
+    xs: { span: 24 },
11
+    sm: { span: 3 },
12
+  },
13
+  wrapperCol: {
14
+    xs: { span: 24 },
15
+    sm: { span: 16 },
16
+  },
17
+};
18
+
19
+/**
20
+ * 项目类型 form 表单子组件
21
+ *
22
+ * @param {*} props
23
+ */
24
+class TypeForm extends React.Component {
25
+
26
+  componentDidMount() {
27
+    this.props.form.setFieldsValue(this.props.type)
28
+  }
29
+
30
+  onChange(e, name) {
31
+    // console.log(e)
32
+    this.props.form.validateFieldsAndScroll((err, values) => {
33
+      if (!err) {
34
+        // console.log('Received values of form: ', values);
35
+        const currentValue = name === 'marketStatus' ? e : e.target.value
36
+        if (currentValue === '') {
37
+          values[name] = null
38
+        } else {
39
+          values[name] = currentValue
40
+        }
41
+        
42
+        values.buildingTypeName = this.props.type.buildingTypeName
43
+        if(values["startPrice"] === "") {
44
+          values["startPrice"] = null
45
+        }
46
+        if(values["endPrice"] === "") {
47
+          values["endPrice"] = null
48
+        }
49
+
50
+        if(values["endPrice"] != null && values["startPrice"] == null){
51
+          notification['warn']({
52
+            message: "请填写最低价!",
53
+            description: '',
54
+          })
55
+          return
56
+        }
57
+        if(values["startPrice"] != null && values["endPrice"] != null && Number(values["startPrice"]) > Number(values["endPrice"])){
58
+          notification['warn']({
59
+            message: "最低价不得高于最高价!",
60
+            description: '',
61
+          })
62
+          return
63
+        }
64
+        this.props.onSuccess(values)
65
+      }
66
+    });
67
+  }
68
+
69
+  close() {
70
+    this.props.onClose(this.props.form.getFieldsValue(['buildingTypeId']))
71
+  }
72
+
73
+  render() {
74
+    const { getFieldDecorator } = this.props.form;
75
+
76
+    // this.props.form.setFieldsValue(this.props.type)
77
+    // console.log(this.props.type,"33333333")
78
+    return (
79
+      <>
80
+        <Col span={11} style={{
81
+          position: 'relative',
82
+          border: '1px solid #eee',
83
+          borderRadius: '4px',
84
+          marginTop: '16px',
85
+        }}>
86
+
87
+          <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
88
+
89
+          <Form {...formItemLayout} style={{ padding: '5px 0px 5px 5px' }}>
90
+            <Form.Item label="类型编号" style={{ display: 'none' }}>
91
+              {getFieldDecorator('buildingTypeId')(<Input disabled />)}
92
+            </Form.Item>
93
+            <Form.Item label="状态" style={{ display: 'none' }}>
94
+              {getFieldDecorator('status')(<Input disabled />)}
95
+            </Form.Item>
96
+            <Form.Item label="价格类型">
97
+                {getFieldDecorator('priceType')(
98
+                  <Radio.Group onChange={e => this.onChange(e, 'priceType')} >
99
+                    <Radio value="average">均价</Radio>
100
+                    <Radio value="total">总价</Radio>
101
+                    <Radio value="lease">租赁价</Radio>
102
+                  </Radio.Group>
103
+                )}
104
+              </Form.Item>
105
+            <Form.Item label="价格区间" help='最高价与最低价一致时,只展示一个'>
106
+              {getFieldDecorator('startPrice')(<Input type="number" placeholder="最低价" style={{width: '120px'}} maxLength="9" onChange={e => this.onChange(e, 'startPrice')} />)} --
107
+              {getFieldDecorator('endPrice')(<Input type="number" placeholder="最高价" style={{width: '120px'}} maxLength="9" onChange={e => this.onChange(e, 'endPrice')} />)}{this.props.type.priceType === "average" ? "元/㎡" : this.props.type.priceType === "lease" ? "元/㎡/天" : "万元/套"}
108
+            </Form.Item>
109
+            <Form.Item label="销售状态" >
110
+            {getFieldDecorator('marketStatus')(
111
+              <Select placeholder="销售状态" onChange={e => this.onChange(e, 'marketStatus')} >
112
+                <Option value="待售">待售</Option>
113
+                <Option value="在售">在售</Option>
114
+                <Option value="售罄">售罄</Option>
115
+                <Option value="在租">在租</Option>
116
+              </Select>,
117
+            )}
118
+          </Form.Item>
119
+            <Form.Item label="装修标准">
120
+              {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
121
+            </Form.Item>
122
+            <Form.Item label="产权年限">
123
+              {getFieldDecorator('rightsYear')(<Input onChange={e => this.onChange(e, 'rightsYear')} />)}
124
+            </Form.Item>
125
+          </Form>
126
+        </Col>
127
+      </>
128
+    )
129
+  }
130
+}
131
+
132
+const WrappedTypeForm = Form.create({ name: 'TypeForm' })(TypeForm);
133
+
134
+/**
135
+ *项目类型组件
136
+ *
137
+ * @param {*} props
138
+ */
139
+class ProjectTypeBody extends React.Component {
140
+
141
+  constructor(props) {
142
+    super(props)
143
+    this.state = {
144
+      one: false,
145
+      projectType: [],
146
+      defaultCheckboxValue: [], // 多选框默认选中的值
147
+      visible: false,
148
+      data: [],
149
+      // data: [{ buildingTypeId: '1', buildingTypeName: '公寓', price: '10', decoration: '全包', rightsYear: '10', status: '1' }, { buildingTypeId: '2', buildingTypeName: '住宅', price: '10', decoration: '全包', rightsYear: '10', status: '1' }, { buildingTypeId: '3', buildingTypeName: '太平房', price: '10', decoration: '全包', rightsYear: '10', status: '1' }],
150
+    }
151
+  }
152
+
153
+  componentDidMount() {
154
+    this.getList({ pageNum: 1, pageSize: 999 })
155
+  }
156
+
157
+  componentDidUpdate(prevProps) {
158
+    // 典型用法(不要忘记比较 props):
159
+    if (this.props.value !== prevProps.data && !this.state.one) {
160
+      this.setValue()
161
+      this.setState({ one: true })
162
+    }
163
+  }
164
+
165
+  onSuccess = (values, item) => {
166
+    const newData = this.getNewProjectType(values)
167
+    this.setState({ data: newData })
168
+    if (typeof this.props.onChange === 'function') {
169
+      this.props.onChange(newData)
170
+    }
171
+  }
172
+
173
+  onCheckboxChange = checkedValues => {
174
+    // console.log('checkedValues: ', checkedValues)
175
+    const checked = (`${checkedValues}` || '').split(',')
176
+    const { projectType } = this.state
177
+    const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
178
+
179
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, startPrice: null,endPrice: null,priceType: "average", decoration: null, rightsYear: null, status: '1' }))
180
+    const updateProjectDate = this.updateProjectType(tempDate)
181
+    console.log('updateProjectDate: ', updateProjectDate)
182
+    this.setState({ data: updateProjectDate })
183
+    this.setState({ defaultCheckboxValue: updateProjectDate.map(item => item.buildingTypeId) })
184
+  }
185
+
186
+  onClose = e => {
187
+    console.log(2)
188
+    const { data } = this.state
189
+    console.log('onClose——data: ', data)
190
+    console.log('onClose: ', e.buildingTypeId)
191
+    const buildingType = data.filter(item => e.buildingTypeId !== item.buildingTypeId)
192
+    console.log('onClose——data111: ', buildingType)
193
+    this.setState({ data: buildingType })
194
+    this.setState({ defaultCheckboxValue: buildingType.map(item => item.buildingTypeId) })
195
+    if (typeof this.props.onChange === 'function') {
196
+      this.props.onChange(buildingType)
197
+    }
198
+  }
199
+
200
+  getNewProjectType = values => {
201
+    const data = []
202
+    this.state.data.map(item => {
203
+      if (item.buildingTypeId === values.buildingTypeId) {
204
+        data.push(values)
205
+      } else {
206
+        data.push(item)
207
+      }
208
+    })
209
+
210
+    return data
211
+  }
212
+
213
+  updateProjectType = values => {
214
+    // 获取所有复选框选中的id
215
+    const valueIdArray = values.map(item => item.buildingTypeId)
216
+    // console.log('valueIdArray: ', valueIdArray)
217
+
218
+    // 获取 data 中已经赋值的数据  交集
219
+    const valueData = this.state.data.filter(item => valueIdArray.includes(item.buildingTypeId))
220
+    // console.log('valueData: ', valueData)
221
+
222
+    // 获取 非 data中数据(也就是没有赋值),交集
223
+    const trueValueArr = valueData.map(item => item.buildingTypeId)
224
+    const trueValueData = values.filter(item => !trueValueArr.includes(item.buildingTypeId))
225
+
226
+    // console.log('trueValueData: ', trueValueData)
227
+
228
+    // 把两个 数组的值,合并返回
229
+    return valueData.concat(trueValueData)
230
+  }
231
+
232
+  getList = params => {
233
+    request({ ...apis.buildingType.getList, params: { ...params } }).then(res => {
234
+      this.setState({ projectType: res.records })
235
+    }).catch(err => {
236
+      this.openNotificationWithIcon('error', err.message)
237
+    })
238
+  }
239
+
240
+  setValue = () => {
241
+    let tempData = []
242
+    let tempCheckboxValue = []
243
+    const { value } = this.props
244
+    // console.log('value: ', value)
245
+    if (value !== undefined && value !== null) {
246
+      tempData = value
247
+      tempCheckboxValue = tempData.map(item => item.buildingTypeId)
248
+      this.setState({ defaultCheckboxValue: tempCheckboxValue })
249
+      this.setState({ data: tempData })
250
+    }
251
+  }
252
+
253
+  openNotificationWithIcon = (type, message) => {
254
+    notification[type]({
255
+      message,
256
+      description: '',
257
+    })
258
+  }
259
+
260
+  handleOk = e => {
261
+    this.setState({
262
+      visible: false,
263
+    });
264
+  };
265
+
266
+  handleCancel = e => {
267
+    this.setState({
268
+      visible: false,
269
+    });
270
+  };
271
+
272
+  showMadel = () => {
273
+    this.setState({ visible: true })
274
+    this.getList({ pageNum: 1, pageSize: 999 })
275
+  }
276
+
277
+  render() {
278
+    return (
279
+      <>
280
+        <Button type="primary" icon="plus" size="large" onClick={() => this.showMadel()} />
281
+        <Modal
282
+          title="项目类型"
283
+          visible={this.state.visible}
284
+          // onOk={this.handleOk}
285
+          onCancel={this.handleCancel}
286
+          footer={
287
+            [
288
+            <Button key="submit" type="primary" onClick={this.handleOk}>
289
+             确定  
290
+            </Button>] 
291
+          }
292
+        >
293
+          <Checkbox.Group options={this.state.projectType.map(item => ({ label: item.buildingTypeName, value: item.buildingTypeId }))} onChange={e => this.onCheckboxChange(e)} value={this.state.defaultCheckboxValue}/>
294
+        </Modal>
295
+        <Row type="flex" justify="space-between">
296
+          {
297
+            this.state.data.map(item => <WrappedTypeForm type={item} key={item.buildingTypeId} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
298
+          }
299
+        </Row>
300
+      </>
301
+    )
302
+  }
303
+}
304
+
305
+export default ProjectTypeBody

+ 197
- 0
estateagents-admin-manager/src/pages/building/list/add/components/imageSet.jsx Ver arquivo

@@ -0,0 +1,197 @@
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, Modal } 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 ModalImage from './modalImage';
9
+
10
+const { confirm } = Modal;
11
+
12
+
13
+const saleType = [
14
+  {
15
+    id: 1,
16
+    name: '待售',
17
+  },
18
+  {
19
+    id: 2,
20
+    name: '售罄',
21
+  },
22
+  {
23
+    id: 3,
24
+    name: '在售',
25
+  },
26
+  {
27
+    id: 4,
28
+    name: '在租',
29
+  },
30
+]
31
+
32
+const houseType = [
33
+  {
34
+    id: 1,
35
+    name: '1室',
36
+  },
37
+  {
38
+    id: 2,
39
+    name: '2室',
40
+  },
41
+  {
42
+    id: 3,
43
+    name: '3室',
44
+  },
45
+  {
46
+    id: 4,
47
+    name: '4室',
48
+  },
49
+  {
50
+    id: 5,
51
+    name: '5室及以上',
52
+  },
53
+]
54
+
55
+/**
56
+ *图片设置
57
+ *
58
+ * @param {*} props
59
+ * @returns
60
+ */
61
+function imageSet(props) {
62
+  // eslint-disable-next-line react-hooks/rules-of-hooks
63
+  const [data, setData] = useState([])
64
+
65
+  // eslint-disable-next-line react-hooks/rules-of-hooks
66
+  const [visibleData, setVisibleData] = useState({ visible: false, apartmentId: '', buildingId: '' })
67
+
68
+  // eslint-disable-next-line react-hooks/rules-of-hooks
69
+  useEffect(() => {
70
+    getList()
71
+  }, [])
72
+
73
+  function openNotificationWithIcon(type, message) {
74
+    notification[type]({
75
+      message,
76
+      description:
77
+        '',
78
+    });
79
+  }
80
+
81
+  function getList(params) {
82
+    // 网路请求
83
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'apart' } }).then(res => {
84
+      setData(res)
85
+    }).catch(err => {
86
+      openNotificationWithIcon('error', err.message)
87
+    })
88
+  }
89
+
90
+  /**
91
+   *回调事件
92
+   *
93
+   */
94
+  function onModalChange() {
95
+    getList()
96
+    setVisibleData({ visible: false, apartmentId: '', buildingId: '' })
97
+  }
98
+
99
+  /**
100
+   *打开编辑页
101
+   *
102
+   * @param {*} record
103
+   */
104
+  function showEdi(record) {
105
+    setVisibleData({ visible: true, apartmentId: record === undefined ? '' : record.apartmentId, buildingId: props.building.buildingId })
106
+  }
107
+
108
+  /**
109
+   * 删除
110
+   *
111
+   * @param {*} record
112
+   */
113
+  function deleteApartment(record) {
114
+    confirm({
115
+      title: '确认删除当前数据?',
116
+      content: '确定后成功删除,点击取消则放弃当前操作',
117
+      okText: '确定',
118
+      cancelText: '取消',
119
+      onOk() {
120
+        // 网路请求
121
+        request({ ...apis.building.buildingApartmentDelete, urlData: { id: record.apartmentId } }).then(res => {
122
+          getList()
123
+          openNotificationWithIcon('success', '操作成功')
124
+        }).catch(err => {
125
+          // openNotificationWithIcon('error', err.message)
126
+        })
127
+      },
128
+      onCancel() { },
129
+    });
130
+  }
131
+
132
+
133
+  const columns = [
134
+    {
135
+      title: '户型名称',
136
+      dataIndex: 'apartmentName',
137
+      key: 'apartmentName',
138
+    },
139
+    {
140
+      title: '销售状态',
141
+      dataIndex: 'marketStatus',
142
+      key: 'marketStatus',
143
+      render: (_, record) => <span>{(saleType.filter(x => x.id == record.marketStatus)[0] || {}).name}</span>,
144
+    },
145
+    {
146
+      title: '户型',
147
+      dataIndex: 'houseType',
148
+      key: 'houseType',
149
+      render: (_, record) => <span>{(houseType.filter(x => x.id == record.houseType)[0] || {}).name}</span>,
150
+    },
151
+    {
152
+      title: '面积',
153
+      dataIndex: 'buildingArea',
154
+      key: 'buildingArea',
155
+      render: (buildingArea, _) => <span>{`${buildingArea === 0 || buildingArea === null ? "-" : buildingArea + "m²"}`}</span>,
156
+    },
157
+    {
158
+      title: '使用面积',
159
+      dataIndex: 'insideArea',
160
+      key: 'insideArea',
161
+      render: (insideArea, _) => <span>{`${insideArea === 0 || insideArea === null ? "-" : insideArea + "m²"}`}</span>,
162
+    },
163
+    {
164
+      title: '创建时间',
165
+      dataIndex: 'createDate',
166
+      key: 'createDate',
167
+      render: (_, record) => <span>{moment(record.createDate).format('YYYY-MM-DD HH:mm:ss')}</span>,
168
+    },
169
+    {
170
+      title: '操作',
171
+      dataIndex: 'apartmentId',
172
+      key: 'apartmentId',
173
+      render: (_, record) => (
174
+        <>
175
+          <Button type="link" style={{ color: 'red' }} onClick={() => showEdi(record)}>编辑</Button>
176
+          <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
177
+        </>
178
+      ),
179
+    },
180
+  ]
181
+
182
+  return (
183
+    <>
184
+      <div style={{ display: 'flex', alignItems: 'center', marginBottom: '16px', justifyContent: 'space-between' }}>
185
+        <Button type="primary" onClick={() => showEdi()}>新增户型</Button>
186
+        <Button onClick={() => router.go(-1)}>返回</Button>
187
+      </div>
188
+      <Table dataSource={data} columns={columns} pagination={false} rowKey="imageSet" />
189
+
190
+      {/* 编辑页 */}
191
+      {/*  onSuccess是子组件传递事件信息  */}
192
+      <ModalImage visibleData={visibleData} key="ModalImage" onSuccess={() => onModalChange()} />
193
+    </>
194
+  )
195
+}
196
+
197
+export default imageSet

+ 259
- 0
estateagents-admin-manager/src/pages/building/list/add/components/modalImage.jsx Ver arquivo

@@ -0,0 +1,259 @@
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 ImageListUpload from '../../../../../components/XForm/ImageListUpload'
9
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
+
11
+
12
+const { Option } = Select;
13
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+const { Meta } = Card;
15
+
16
+const { TextArea } = Input;
17
+
18
+
19
+const formItemLayout = {
20
+  labelCol: {
21
+    xs: { span: 24 },
22
+    sm: { span: 2 },
23
+  },
24
+  wrapperCol: {
25
+    xs: { span: 24 },
26
+    sm: { span: 16 },
27
+  },
28
+};
29
+
30
+const saleType = [
31
+  {
32
+    id: 1,
33
+    name: '待售',
34
+  },
35
+  {
36
+    id: 2,
37
+    name: '售罄',
38
+  },
39
+  {
40
+    id: 3,
41
+    name: '在售',
42
+  },
43
+  {
44
+    id: 4,
45
+    name: '在租',
46
+  },
47
+]
48
+
49
+const houseType = [
50
+  {
51
+    id: '1',
52
+    name: '1室',
53
+  },
54
+  {
55
+    id: '2',
56
+    name: '2室',
57
+  },
58
+  {
59
+    id: '3',
60
+    name: '3室',
61
+  },
62
+  {
63
+    id: '4',
64
+    name: '4室',
65
+  },
66
+  {
67
+    id: '5',
68
+    name: '5室及以上',
69
+  },
70
+]
71
+
72
+/**
73
+ * 图片信息
74
+ *
75
+ * @param {*} props
76
+ * @returns
77
+ */
78
+class ModalImage extends React.Component {
79
+  constructor(props) {
80
+    super(props);
81
+    this.state = {
82
+       visibleData: { visible: false, apartmentId: '', buildingId: '' },
83
+    }
84
+  }
85
+
86
+  // 挂载之后
87
+  // componentDidMount() {
88
+  //
89
+  // }
90
+
91
+  componentDidUpdate(preProps, preState) {
92
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
93
+      console.log(this.props.visibleData)
94
+      this.getById()
95
+      this.setState({ visibleData: this.props.visibleData });
96
+    }
97
+  }
98
+
99
+  // 弹框确定按钮
100
+  // eslint-disable-next-line react/sort-comp
101
+  handleOk() {
102
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
103
+  }
104
+
105
+  // 弹框取消按钮
106
+  handleCancel() {
107
+    // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
108
+    this.props.onSuccess()
109
+  }
110
+
111
+  getById(params) {
112
+    const { apartmentId } = this.props.visibleData
113
+    if (apartmentId === '' || apartmentId === undefined) {
114
+      return
115
+    }
116
+
117
+    // 网路请求
118
+    request({ ...apis.building.buildingApartmentGetById, urlData: { id: apartmentId }, params: { ...params } }).then(res => {
119
+      // res.img = res.buildingImgList.map(item => item.url)
120
+      if (res.buildingImgList) {
121
+        res.img = res.buildingImgList[0].url
122
+      }
123
+      
124
+      this.props.form.setFieldsValue(res)
125
+    }).catch(err => {
126
+     this.openNotificationWithIcon('error', err)
127
+    })
128
+  }
129
+
130
+  openNotificationWithIcon = (type, message) => {
131
+    notification[type]({
132
+      message,
133
+      description:
134
+        '',
135
+    });
136
+  };
137
+
138
+  // 提交
139
+  handleSubmit(e) {
140
+    e.preventDefault();
141
+    this.props.form.validateFields((err, values) => {
142
+      if (!err) {
143
+        this.submitData(values)
144
+      }
145
+    });
146
+  }
147
+
148
+  submitData(data) {
149
+    // TODO 这里应该是要支持多图,但是封装的控件没有
150
+    // data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
151
+    data.img = [{ imgType: 'aparment', url: data.img, orderNo: 0 }]
152
+    data.buildingId = this.props.visibleData.buildingId;
153
+    data.apartmentType = 'apart'
154
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
155
+
156
+    // 网路请求
157
+    request({ ...api, data: { ...data } }).then(() => {
158
+      // eslint-disable-next-line no-unused-expressions
159
+      this.openNotificationWithIcon('success', '操作成功')
160
+
161
+      // 传递父组件事件
162
+      // onSuccess() 是自定义
163
+      this.props.onSuccess()
164
+
165
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
166
+    }).catch(err => {
167
+      // eslint-disable-next-line no-unused-expressions
168
+      this.openNotificationWithIcon('error', err)
169
+    })
170
+  }
171
+
172
+  /**
173
+   * 取消按钮
174
+   *
175
+   * @memberof ModalImage
176
+   */
177
+  closeModal() {
178
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
179
+  }
180
+
181
+  render() {
182
+    const { getFieldDecorator } = this.props.form;
183
+    return (
184
+      <>
185
+        <Modal
186
+            title="户型设置"
187
+            width={1100}
188
+            destroyOnClose="true"
189
+            footer={null}
190
+            visible={this.state.visibleData.visible}
191
+            onOk={() => this.handleOk()}
192
+            onCancel={e => this.handleCancel(e)}
193
+          >
194
+            <Form {...formItemLayout} onSubmit={e => this.handleSubmit(e)}>
195
+              <Form.Item label="编号" style={{ display: 'none' }}>
196
+                  {getFieldDecorator('apartmentId')(<Input />)}
197
+              </Form.Item>
198
+              <Form.Item label="户型名称">
199
+                {getFieldDecorator('apartmentName', {
200
+                  rules: [
201
+                    { required: true, message: '请填写户型名称' },
202
+                    { max: 10, message: '户型名称不超过10个字符' },
203
+                  ],
204
+                })(<Input placeholder="户型名称不超过10个字符"/>)}
205
+              </Form.Item>
206
+              <Form.Item label="销售状态">
207
+                {getFieldDecorator('marketStatus', {
208
+                  rules: [{ required: true, message: '请选择销售状态' }],
209
+                })(
210
+                  <Select placeholder="销售状态">
211
+                    {
212
+                      saleType.map((item, _) => <Option value={item.id}>{item.name}</Option>)
213
+                    }
214
+                  </Select>,
215
+                )}
216
+              </Form.Item>
217
+              <Form.Item label="图片" help="建议图片尺寸336px*336px,比例1:1,格式:jpg">
218
+              {getFieldDecorator('img', {
219
+                  rules: [{ required: true, message: '请上传户型图片' }],
220
+              })(
221
+                // <ImageListUpload />,
222
+                <ImageUpload />,
223
+              )}
224
+              </Form.Item>
225
+              <Form.Item label="户型">
226
+                {getFieldDecorator('houseType', {
227
+                  rules: [{ required: true, message: '请选择户型' }],
228
+                })(
229
+                  <Select placeholder="户型">
230
+                    {
231
+                      houseType.map((item, _) => <Option value={item.id}>{item.name}</Option>)
232
+                    }
233
+                  </Select>,
234
+                )}
235
+              </Form.Item>
236
+              <Form.Item label="面积" help="单位 ㎡">
237
+                {getFieldDecorator('buildingArea')(<Input type="number" precision = '2' min='0.00' step='0.01'/>)}
238
+              </Form.Item>
239
+              <Form.Item label="使用面积" help="单位 ㎡">
240
+                {getFieldDecorator('insideArea')(<Input type="number" precision = '2' min='0.00' step='0.01'/>)}
241
+              </Form.Item>
242
+              <Form.Item label="权重" help="数值越大越靠前">
243
+                {getFieldDecorator('orderNo')(<Input type="number" />)}
244
+              </Form.Item>
245
+              <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
246
+                <Button type="primary" htmlType="submit">保存</Button>
247
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
248
+                <Button onClick={() => this.handleCancel()}>取消</Button>
249
+              </Form.Item>
250
+            </Form>
251
+        </Modal>
252
+      </>
253
+    );
254
+  }
255
+}
256
+
257
+const WrappedModalImageForm = Form.create({ name: 'modalImage' })(ModalImage);
258
+
259
+export default WrappedModalImageForm

+ 250
- 0
estateagents-admin-manager/src/pages/building/list/add/components/modalPanoramaImage.jsx Ver arquivo

@@ -0,0 +1,250 @@
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 ImageListUpload from '../../../../../components/XForm/ImageListUpload'
9
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
+
11
+
12
+const { Option } = Select;
13
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+const { Meta } = Card;
15
+
16
+const { TextArea } = Input;
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
+const houseType = [
45
+  {
46
+    id: '1',
47
+    name: '1室',
48
+  },
49
+  {
50
+    id: '2',
51
+    name: '2室',
52
+  },
53
+  {
54
+    id: '3',
55
+    name: '3室',
56
+  },
57
+  {
58
+    id: '4',
59
+    name: '4室',
60
+  },
61
+  {
62
+    id: '5',
63
+    name: '5室及以上',
64
+  },
65
+]
66
+  
67
+/**
68
+ * 图片信息
69
+ *
70
+ * @param {*} props
71
+ * @returns
72
+ */
73
+class ModalPanoramaImage extends React.Component {
74
+  constructor(props) {
75
+    super(props);
76
+    this.state = {
77
+       visibleData: { visible: false, apartmentId: '', buildingId: '',panoramaType: "apartment" },
78
+    }
79
+  }
80
+
81
+  // 挂载之后
82
+  // componentDidMount() {
83
+  //
84
+  // }
85
+
86
+  componentDidUpdate(preProps, preState) {
87
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
88
+      console.log(this.props.visibleData)
89
+      this.getById()
90
+      this.setState({ visibleData: this.props.visibleData });
91
+    }
92
+  }
93
+
94
+  // 弹框确定按钮
95
+  // eslint-disable-next-line react/sort-comp
96
+  handleOk() {
97
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
98
+  }
99
+
100
+  // 弹框取消按钮
101
+  handleCancel() {
102
+    // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
103
+    this.props.onSuccess()
104
+  }
105
+
106
+  getById(params) {
107
+    const { apartmentId } = this.props.visibleData
108
+    if (apartmentId === '' || apartmentId === undefined) {
109
+      return
110
+    }
111
+
112
+    // 网路请求
113
+    request({ ...apis.building.buildingApartmentGetById, urlData: { id: apartmentId }, params: { ...params } }).then(res => {
114
+      // res.img = res.buildingImgList.map(item => item.url)
115
+      if (res.buildingImgList) {
116
+        res.img = res.buildingImgList[0].url
117
+      }
118
+      
119
+      this.props.form.setFieldsValue(res)
120
+    }).catch(err => {
121
+     this.openNotificationWithIcon('error', err)
122
+    })
123
+  }
124
+
125
+  openNotificationWithIcon = (type, message) => {
126
+    notification[type]({
127
+      message,
128
+      description:
129
+        '',
130
+    });
131
+  };
132
+
133
+  // 提交
134
+  handleSubmit(e) {
135
+    e.preventDefault();
136
+    this.props.form.validateFields((err, values) => {
137
+      if (!err) {
138
+        this.submitData(values)
139
+      }
140
+    });
141
+  }
142
+
143
+  submitData(data) {
144
+    data.buildingId = this.props.visibleData.buildingId;
145
+    const api = apis.paorama.add;
146
+
147
+    // 网路请求
148
+    request({ ...api, data: { ...data } }).then(() => {
149
+      // eslint-disable-next-line no-unused-expressions
150
+      this.openNotificationWithIcon('success', '操作成功')
151
+
152
+      // 传递父组件事件
153
+      // onSuccess() 是自定义
154
+      this.props.onSuccess()
155
+
156
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
157
+    }).catch(err => {
158
+      // eslint-disable-next-line no-unused-expressions
159
+      this.openNotificationWithIcon('error', err)
160
+    })
161
+  }
162
+
163
+  radioOnChange(e) {
164
+    this.setState({ visibleData: { ...this.state.visibleData, panoramaType: e.target.value } })
165
+  }
166
+
167
+  /**
168
+   * 取消按钮
169
+   *
170
+   * @memberof ModalImage
171
+   */
172
+  closeModal() {
173
+    this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } })
174
+  }
175
+
176
+  render() {
177
+    const { getFieldDecorator } = this.props.form;
178
+    return (
179
+      <>
180
+        <Modal
181
+            title="新增全景图"
182
+            width={1100}
183
+            destroyOnClose="true"
184
+            footer={null}
185
+            visible={this.state.visibleData.visible}
186
+            onOk={() => this.handleOk()}
187
+            onCancel={e => this.handleCancel(e)}
188
+          >
189
+            <Form {...formItemLayout} onSubmit={e => this.handleSubmit(e)}>
190
+              <Form.Item label="全景类型" help="全景图展示位置: 项目详情Banner,户型介绍">
191
+                {getFieldDecorator('panoramaType', {
192
+                  rules: [
193
+                    {
194
+                      required: true,
195
+                      message: '请选择全景类型',
196
+                    },
197
+                  ],
198
+                })(
199
+                  <Radio.Group onChange={(e) => this.radioOnChange(e)}>
200
+                    <Radio value="apartment">户型</Radio>
201
+                    <Radio value="building">项目</Radio>
202
+                  </Radio.Group>,
203
+                )}
204
+              </Form.Item>
205
+              { this.state.visibleData.panoramaType == "apartment" && <Form.Item label="全景内容">
206
+                {getFieldDecorator('apartmentId', {
207
+                  rules: [{ required: true, message: '请选择全景内容' }],
208
+                })(
209
+                  <Select placeholder="户型">
210
+                    {
211
+                      (this.state.visibleData.panoramaList || []).map((item, _) => <Option value={item.apartmentId}>{item.apartmentName}</Option>)
212
+                    }
213
+                  </Select>,
214
+                )}
215
+              </Form.Item>}
216
+              { this.state.visibleData.panoramaType == "building" && <Form.Item label="全景内容">
217
+                {getFieldDecorator('content', {
218
+                  rules: [{ required: true, message: '请输入全景内容' }],
219
+                })(
220
+                  <Input />,
221
+                )}
222
+              </Form.Item>}
223
+              <Form.Item label="选择封面" help="建议图片尺寸750px*600px,比例5:4,格式:jpg">
224
+              {getFieldDecorator('coverImg', {
225
+                  rules: [{ required: true, message: '请上传封面图片' }],
226
+              })(
227
+                // <ImageListUpload />,
228
+                <ImageUpload />,
229
+              )}
230
+              </Form.Item>
231
+              <Form.Item label="链接地址">
232
+                {getFieldDecorator('panoramaLink', {
233
+                  rules: [{ required: true, message: '请输入链接地址' }],
234
+                })(<Input />)}
235
+              </Form.Item>
236
+              <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
237
+                <Button type="primary" htmlType="submit">保存</Button>
238
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
239
+                <Button onClick={() => this.handleCancel()}>取消</Button>
240
+              </Form.Item>
241
+            </Form>
242
+        </Modal>
243
+      </>
244
+    );
245
+  }
246
+}
247
+
248
+const WrappedModalPanoramaImageForm = Form.create({ name: 'modalPanoramaImage' })(ModalPanoramaImage);
249
+
250
+export default WrappedModalPanoramaImageForm

+ 184
- 0
estateagents-admin-manager/src/pages/building/list/add/components/panoramaImage.jsx Ver arquivo

@@ -0,0 +1,184 @@
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, Modal } 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 ModalPanoramaImage from './modalPanoramaImage';
9
+
10
+const { confirm } = Modal;
11
+
12
+
13
+const saleType = [
14
+  {
15
+    id: 1,
16
+    name: '待售',
17
+  },
18
+  {
19
+    id: 2,
20
+    name: '售罄',
21
+  },
22
+  {
23
+    id: 3,
24
+    name: '在售',
25
+  },
26
+]
27
+
28
+const houseType = [
29
+  {
30
+    id: 1,
31
+    name: '1室',
32
+  },
33
+  {
34
+    id: 2,
35
+    name: '2室',
36
+  },
37
+  {
38
+    id: 3,
39
+    name: '3室',
40
+  },
41
+  {
42
+    id: 4,
43
+    name: '4室',
44
+  },
45
+  {
46
+    id: 5,
47
+    name: '5室及以上',
48
+  },
49
+]
50
+
51
+/**
52
+ *图片设置
53
+ *
54
+ * @param {*} props
55
+ * @returns
56
+ */
57
+function panoramaImage(props) {
58
+  // eslint-disable-next-line react-hooks/rules-of-hooks
59
+  const [data, setData] = useState([])
60
+
61
+  // eslint-disable-next-line react-hooks/rules-of-hooks
62
+  const [visibleData, setVisibleData] = useState({ visible: false, apartmentId: '', buildingId: '' })
63
+
64
+  // eslint-disable-next-line react-hooks/rules-of-hooks
65
+  useEffect(() => {
66
+    getList()
67
+  }, [])
68
+
69
+  function openNotificationWithIcon(type, message) {
70
+    notification[type]({
71
+      message,
72
+      description:
73
+        '',
74
+    });
75
+  }
76
+
77
+  function getList(params) {
78
+    // 网路请求
79
+    request({ ...apis.paorama.list, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'apart' } }).then(res => {
80
+      setData(res)
81
+    }).catch(err => {
82
+      openNotificationWithIcon('error', err.message)
83
+    })
84
+  }
85
+
86
+  /**
87
+   *回调事件
88
+   *
89
+   */
90
+  function onModalChange() {
91
+    getList()
92
+    setVisibleData({ visible: false, apartmentId: '', buildingId: '' })
93
+  }
94
+
95
+  /**
96
+   *打开编辑页
97
+   *
98
+   * @param {*} record
99
+   */
100
+  function showEdi(record) {
101
+    // 网路请求
102
+    request({ ...apis.paorama.panoramaApartList, params: { buildingId: props.building.buildingId } }).then(res => {
103
+      setVisibleData({ visible: true, apartmentId: record === undefined ? '' : record.apartmentId, buildingId: props.building.buildingId, panoramaType: "apartment", panoramaList: res })
104
+    }).catch(err => {
105
+      this.openNotificationWithIcon('error', err)
106
+    })
107
+  }
108
+
109
+  /**
110
+   * 删除
111
+   *
112
+   * @param {*} record
113
+   */
114
+  function deleteApartment(record) {
115
+    confirm({
116
+      title: '确认删除当前数据?',
117
+      content: '确定后成功删除,点击取消则放弃当前操作',
118
+      okText: '确定',
119
+      cancelText: '取消',
120
+      onOk() {
121
+        // 网路请求
122
+        request({ ...apis.paorama.delete, urlData: { id: record.panoramaId } }).then(res => {
123
+          getList()
124
+          openNotificationWithIcon('success', '操作成功')
125
+        }).catch(err => {
126
+          // openNotificationWithIcon('error', err.message)
127
+        })
128
+      },
129
+      onCancel() { },
130
+    });
131
+  }
132
+
133
+
134
+  const columns = [
135
+    {
136
+      title: '封面图',
137
+      dataIndex: 'coverImg',
138
+      key: 'coverImg',
139
+      render: (x, record) => <img style={{ width: '150px', height: '120px' }} src={x} alt="" />,
140
+    },
141
+    {
142
+      title: '类型',
143
+      dataIndex: 'panoramaType',
144
+      key: 'panoramaType',
145
+      render: (x, record) => <span>{x === "apartment" ? "户型" : "项目"}</span>,
146
+    },
147
+    {
148
+      title: '内容',
149
+      dataIndex: 'content',
150
+      key: 'content',
151
+    },
152
+    {
153
+      title: '链接地址',
154
+      dataIndex: 'panoramaLink',
155
+      key: 'panoramaLink',
156
+    },
157
+    {
158
+      title: '操作',
159
+      dataIndex: 'apartmentId',
160
+      key: 'apartmentId',
161
+      render: (_, record) => (
162
+        <>
163
+          <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
164
+        </>
165
+      ),
166
+    },
167
+  ]
168
+
169
+  return (
170
+    <>
171
+      <div style={{ display: 'flex', alignItems: 'center', marginBottom: '16px', justifyContent: 'space-between' }}>
172
+        <Button type="primary" onClick={() => showEdi()}>新增全景图</Button>
173
+        <Button onClick={() => router.go(-1)}>返回</Button>
174
+      </div>
175
+      <Table dataSource={data} columns={columns} pagination={false} rowKey="imageSet" />
176
+
177
+      {/* 编辑页 */}
178
+      {/*  onSuccess是子组件传递事件信息  */}
179
+      <ModalPanoramaImage visibleData={visibleData} key="ModalImage" onSuccess={() => onModalChange()} />
180
+    </>
181
+  )
182
+}
183
+
184
+export default panoramaImage

+ 164
- 0
estateagents-admin-manager/src/pages/building/list/add/components/poster.jsx Ver arquivo

@@ -0,0 +1,164 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import yinhao from '../../../../../assets/yinhao.png'
11
+import xiaochengxu from '../../../../../assets/xiaochengxu.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import poster1 from '../../../../../assets/poster1.png';
14
+import poster2 from '../../../../../assets/poster2.png';
15
+import Styles from '../style.less';
16
+import apis from '../../../../../services/apis';
17
+
18
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
+const { TextArea } = Input;
20
+
21
+const Poster = props => {
22
+  const [inputValue, changeInput] = useState('')
23
+  const [textAreaValue, changeTextArea] = useState('')
24
+  const [imgValue, changeImg] = useState('')
25
+  const [posterId, setPosterId] = useState('')
26
+
27
+  const [building, setBuilding] = useState({ buildingImg: [{ url: '' }] })
28
+  const { buildingId } = props.building
29
+
30
+  if (buildingId) {
31
+    // eslint-disable-next-line react-hooks/rules-of-hooks
32
+    useEffect(() => {
33
+      request({
34
+        ...apis.activity.poster,
35
+        params: { targetId: buildingId, targetType: 'building' },
36
+      }).then(data => {
37
+        console.log(data, '2222')
38
+        if (data.length > 0) {
39
+          setPosterId(data[0].posterId)
40
+          changeImg(data[0].posterImg)
41
+          changeTextArea(data[0].posterDescription)
42
+          changeInput(data[0].posterTitle)
43
+        }
44
+      }).catch(err => {
45
+        message.info(err.msg || err.message)
46
+      })
47
+
48
+      getById(buildingId)
49
+      getMiniappName()
50
+    }, [])
51
+  }
52
+
53
+  // 获取详情信息
54
+  function getById(currentId) {
55
+
56
+    request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
57
+      setBuilding(res)
58
+      console.log('getById: ', res)
59
+    })
60
+  }
61
+  // 获取小程序名称
62
+  const [miniappName, setMiniappName] = useState('')
63
+  function getMiniappName() {
64
+
65
+    request({ ...apis.building.getMiniappName }).then(res => {
66
+    
67
+      setMiniappName(res)
68
+     
69
+    })
70
+  }
71
+
72
+  const submitPoster = () => {
73
+    if (buildingId) {
74
+      if (!imgValue) {
75
+        message.error('请选择海报图片')
76
+        return
77
+      }
78
+
79
+      if (posterId) {
80
+        request({
81
+          ...apis.activity.updatePoster,
82
+          urlData: { id: posterId },
83
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
84
+        }).then(() => {
85
+          message.info('保存成功')
86
+        }).catch(err => {
87
+          message.info(err.msg || err.message)
88
+        })
89
+      } else {
90
+        request({
91
+          ...apis.activity.addPoster,
92
+          data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
93
+        }).then(data => {
94
+          setPosterId(data.posterId)
95
+          message.info('保存成功')
96
+        }).catch(err => {
97
+          message.info(err.msg || err.message)
98
+        })
99
+      }
100
+    } else {
101
+      message.warn('请先保存基本信息数据')
102
+    }
103
+  }
104
+
105
+  return <div>
106
+    <div style={{ display: 'flex' }}>
107
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
108
+        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
109
+          <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
110
+
111
+          <p className={Styles.tagLabel}>
112
+            {
113
+              building.buildingTag && building.buildingTag.map(item => <span>{item.tagName}</span>)
114
+            }
115
+          </p>
116
+          <p style={{
117
+            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
118
+            display: '-webkit-box', lineClamp: '3', height: '36px', lineHeight: '36px',
119
+            WebkitLineClamp: '1',
120
+            WebkitBoxOrient: 'vertical',
121
+            overflow: 'hidden',
122
+            textOverflow: 'ellipsis',
123
+          }}>{inputValue || (building.buildingName || '海报标题')}</p>
124
+          <p style={{ color: '#999', padding: ' 0 20px' }}><span style={{ color: '#fd0d0c', fontSize: '24px', marginLeft: '6px' }}>{building.price} </span><span style={{ color: '#fd0d0c', fontSize: '20px' }}></span></p>
125
+          <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
126
+          <p style={{
127
+            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
128
+            display: '-webkit-box', lineClamp: '3', height: '72px',
129
+            WebkitLineClamp: '3',
130
+            WebkitBoxOrient: 'vertical',
131
+            overflow: 'hidden',
132
+            textOverflow: 'ellipsis',
133
+          }}>{textAreaValue || '海报描述'}</p>
134
+          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc',position:'relative' }}>
135
+            <p style={{margin:'0',fontSize:'18px',color:'#888'}}>长按识别小程序码</p>
136
+            <p style={{margin:'0',fontSize:'18px',color:'#888'}}>进入项目查看详情</p>
137
+            <img style={{ width: '80px',position: 'absolute',right:'30px',top:'10px' }} src={xiaochengxu} alt="" />
138
+          </div>
139
+        </div>
140
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
141
+      </div>
142
+      <div >
143
+        <div style={{ display: 'flex', width: '100%', margin: '30px 0' }}>
144
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}><span style={{ color: 'red' }}>*</span> 楼盘海报图</p>
145
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
146
+        </div>
147
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘海报</p>
148
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
149
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
150
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
151
+        </div>
152
+        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
153
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
154
+          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
155
+        </div>
156
+
157
+      </div>
158
+    </div>
159
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
160
+    <Button onClick={() => router.go(-1)}>取消</Button>
161
+  </div>
162
+}
163
+
164
+export default Poster

+ 96
- 0
estateagents-admin-manager/src/pages/building/list/add/components/share.jsx Ver arquivo

@@ -0,0 +1,96 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import yinhao from '../../../../../assets/yinhao.png'
11
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
12
+import logo from '../../../../../assets/logo.png';
13
+import touxiang from '../../../../../assets/touxiang.jpg';
14
+import poster1 from '../../../../../assets/poster1.png';
15
+import poster2 from '../../../../../assets/poster2.png';
16
+import apis from '../../../../../services/apis';
17
+
18
+const Share = props => {
19
+  const [inputValue, changeInput] = useState('')
20
+  const [imgValue, changeImg] = useState('')
21
+  const [shareContentId, setShareContentId] = useState('')
22
+
23
+  const { buildingId } = props.building
24
+  if (buildingId) {
25
+    // eslint-disable-next-line react-hooks/rules-of-hooks
26
+    useEffect(() => {
27
+      request({
28
+        ...apis.activity.shareContent,
29
+        params: { targetId: buildingId, targetType: 'building' },
30
+      }).then(data => {
31
+        if (data.length > 0) {
32
+          setShareContentId(data[0].shareContentId)
33
+          changeImg(data[0].shareContentImg)
34
+          changeInput(data[0].shareContentTitle)
35
+        }
36
+      }).catch(err => {
37
+        message.info(err.msg || err.message)
38
+      })
39
+    }, [])
40
+  }
41
+
42
+  const submitShare = () => {
43
+    if (buildingId) {
44
+      if (shareContentId) {
45
+        request({
46
+          ...apis.activity.updateShareContent,
47
+          urlData: { id: shareContentId },
48
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
49
+        }).then(data => {
50
+          message.info('保存成功')
51
+        }).catch(err => {
52
+          message.info(err.msg || err.message)
53
+        })
54
+       } else {
55
+        request({
56
+          ...apis.activity.addShareContent,
57
+          data: { targetId: buildingId, shareContentType: 'building', shareContentImg: imgValue,shareContentTitle: inputValue },
58
+        }).then(data => {
59
+          setShareContentId(data.shareContentId)
60
+          message.info('保存成功')
61
+        }).catch(err => {
62
+          message.info(err.msg || err.message)
63
+        })
64
+       }
65
+     } else {
66
+      message.warn('请先保存基本信息数据')
67
+     }
68
+  }
69
+
70
+  return <div style={{ padding: '20px' }}>
71
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
72
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
73
+      <div>
74
+        {/* <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
75
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
76
+          南京云致
77
+        </p> */}
78
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '精准获客平台'}</p>
79
+        <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
80
+      </div>
81
+    </div>
82
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
83
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
84
+      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
85
+    </div>
86
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
87
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>楼盘分享图</p>
88
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
89
+    </div>
90
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘分享好友</p>
91
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
92
+    <Button onClick={() => router.go(-1)}>取消</Button>
93
+  </div>
94
+}
95
+
96
+export default Share

+ 107
- 0
estateagents-admin-manager/src/pages/building/list/add/components/tags.jsx Ver arquivo

@@ -0,0 +1,107 @@
1
+import React from 'react'
2
+import { Tag, Input, Tooltip, Icon } from 'antd';
3
+
4
+/**
5
+ * 数据格式:[{ tagName: inputValue, delete: true, automatic: false }]
6
+ * @param delete 是否删除
7
+ * @param automatic 是否自动数据(比如获取地图数据就是自动的true,手动输入的是手动false)
8
+ */
9
+class EditableTagGroup extends React.Component {
10
+  state = {
11
+    inputVisible: false,
12
+    inputValue: '',
13
+  };
14
+
15
+  // 每次取值,都从 this.props.value 获取最新值
16
+  getTags = () => {
17
+    // (this.props.value || '').split(',')
18
+    if (this.props.value) {
19
+      // return this.props.value.split(',')
20
+      return this.props.value
21
+    }
22
+
23
+    return []
24
+  }
25
+
26
+  toggleOnChange = tags => {
27
+    if (typeof this.props.onChange === 'function') {
28
+      // this.props.onChange(tags.join(','))
29
+      this.props.onChange(tags)
30
+    }
31
+  }
32
+
33
+  handleClose = removedTag => {
34
+    const tags = this.getTags().filter(tag => tag.tagName !== removedTag);
35
+    // this.setState({ tags });
36
+    this.toggleOnChange(tags)
37
+  };
38
+
39
+  showInput = () => {
40
+    this.setState({ inputVisible: true }, () => this.input.focus());
41
+  };
42
+
43
+  handleInputChange = e => {
44
+    this.setState({ inputValue: e.target.value });
45
+  };
46
+
47
+  handleInputConfirm = () => {
48
+    const { inputValue } = this.state;
49
+
50
+    const tags = this.getTags()
51
+    const tagList = tags.map(x => x.tagName)
52
+    if (inputValue && tagList.indexOf(inputValue) === -1) {
53
+      // 如果有新的值,就把这个值追加到 tags 原本值的后面,在通过onChange事件传递出去
54
+      this.toggleOnChange(tags.concat([{ tagName: inputValue, delete: true, automatic: false }]))
55
+    }
56
+
57
+    this.setState({
58
+      inputVisible: false,
59
+      inputValue: '',
60
+    });
61
+  };
62
+
63
+  saveInputRef = input => (this.input = input);
64
+
65
+  render() {
66
+    const { inputVisible, inputValue } = this.state;
67
+    console.log('this.getTags(): ', this.getTags())
68
+    return (
69
+      <div>
70
+        {this.getTags().map((tag, index) => {
71
+          const isLongTag = tag.length > 20;
72
+          const tagElem = (
73
+            <Tag key={`${tag.tagName}${index}`} closable={ tag.delete } onClose={() => this.handleClose(tag.tagName)}>
74
+              {isLongTag ? `${tag.slice(0, 20)}...` : tag.tagName}
75
+            </Tag>
76
+          );
77
+          return isLongTag ? (
78
+            <Tooltip title={tag.tagName} key={`${tag.tagName}${index}`}>
79
+              {tagElem}
80
+            </Tooltip>
81
+          ) : (
82
+            tagElem
83
+          );
84
+        })}
85
+        {inputVisible && (
86
+          <Input
87
+            ref={this.saveInputRef}
88
+            type="text"
89
+            size="small"
90
+            style={{ width: 78 }}
91
+            value={inputValue}
92
+            onChange={this.handleInputChange}
93
+            onBlur={this.handleInputConfirm}
94
+            onPressEnter={this.handleInputConfirm}
95
+          />
96
+        )}
97
+        {!inputVisible && (
98
+          <Tag onClick={this.showInput} style={{ background: '#fff', borderStyle: 'dashed' }}>
99
+            <Icon type="plus" /> 新建
100
+          </Tag>
101
+        )}
102
+      </div>
103
+    );
104
+  }
105
+}
106
+
107
+export default EditableTagGroup

+ 118
- 0
estateagents-admin-manager/src/pages/building/type/edi.jsx Ver arquivo

@@ -0,0 +1,118 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Button, Row, Col, Form, Alert, notification } from 'antd';
3
+import router from 'umi/router';
4
+import Styles from './style.less';
5
+import request from '../../../utils/request';
6
+import apis from '../../../services/apis';
7
+
8
+function body(props) {
9
+  const { getFieldDecorator } = props.form;
10
+
11
+  // eslint-disable-next-line react-hooks/rules-of-hooks
12
+  let data = {}
13
+  const { id } = props.location.query;
14
+
15
+  if (id !== '') {
16
+    // eslint-disable-next-line react-hooks/rules-of-hooks
17
+    useEffect(() => {
18
+      getById(id)
19
+    }, [])
20
+  }
21
+
22
+  function handleSubmit(e) {
23
+    e.preventDefault();
24
+    props.form.validateFields((err, values) => {
25
+      if (!err) {
26
+        // 提交数据
27
+        submitData(values)
28
+      }
29
+    });
30
+  }
31
+
32
+  // 获取详情信息
33
+  function getById(currentId) {
34
+    request({ ...apis.buildingType.getById, urlData: { id: currentId } }).then(res => {
35
+      data = res
36
+      props.form.setFieldsValue(res)
37
+    })
38
+  }
39
+
40
+  const openNotificationWithIcon = (type, message) => {
41
+    notification[type]({
42
+      message,
43
+      description:
44
+        '',
45
+    });
46
+  }
47
+
48
+  function submitData(dataSources) {
49
+    if (id !== '') {
50
+      // 修改
51
+      updateType(dataSources)
52
+      return
53
+    }
54
+
55
+    dataSources.status = 1
56
+    dataSources.createDate = new Date()
57
+    request({ ...apis.buildingType.add, data: { ...dataSources } }).then(() => {
58
+      // eslint-disable-next-line no-unused-expressions
59
+      openNotificationWithIcon('success', '操作成功')
60
+      router.go(-1)
61
+    }).catch(err => {
62
+      
63
+    })
64
+  }
65
+
66
+    // 修改
67
+    function updateType(row) {
68
+      // const { url, method } = apis.buildingType.update
69
+      // const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
70
+
71
+      // request({ url: tempUrl, method, data: { ...row } }).then(() => {
72
+      //   router.go(-1)
73
+      // })
74
+      request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } }).then(() => {
75
+        // eslint-disable-next-line no-unused-expressions
76
+        openNotificationWithIcon('success', '操作成功')
77
+        router.go(-1)
78
+      }).catch(err => {
79
+        
80
+      })
81
+    }
82
+
83
+  return (
84
+    <>
85
+        <Form onSubmit={handleSubmit} style={{ width: '500px', margin: 'auto' }}>
86
+          <Form.Item style={{ display: 'none' }}>
87
+            {getFieldDecorator('buildingTypeId')(
88
+              <Input
89
+                placeholder="buildingTtypeId"
90
+              />,
91
+            )}
92
+          </Form.Item>
93
+          <Form.Item>
94
+            {getFieldDecorator('buildingTypeName', {
95
+              rules: [{ required: true, message: '请输入名称' }],
96
+            })(
97
+              <Input
98
+                placeholder="名称"
99
+              />,
100
+            )}
101
+          </Form.Item>
102
+          <Form.Item style={{ display: 'flex', justifyContent: 'space-between' }}>
103
+            <Button type="primary" htmlType="submit" className={ Styles.addButton } style={{ margin: '0' }}>
104
+              确定
105
+            </Button>
106
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
107
+            <Button onClick={() => router.go(-1)}>
108
+              取消
109
+            </Button>
110
+          </Form.Item>
111
+        </Form>
112
+    </>
113
+  )
114
+}
115
+
116
+const WrappedBuidingTypeForm = Form.create({ name: 'body' })(body);
117
+
118
+export default WrappedBuidingTypeForm

+ 125
- 0
estateagents-admin-manager/src/pages/building/type/index.jsx Ver arquivo

@@ -0,0 +1,125 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Button, Table, Pagination, Alert, Icon, Tag, notification, Modal } from 'antd'
3
+import router from 'umi/router';
4
+import moment from 'moment';
5
+import withActions from '@/components/ActionList';
6
+import EditIcon from '@/components/EditIcon';
7
+import AuthButton from '@/components/AuthButton';
8
+
9
+import request from '../../../utils/request';
10
+import apis from '../../../services/apis';
11
+
12
+export default function BuildType() {
13
+  // eslint-disable-next-line react-hooks/rules-of-hooks
14
+  const [data, setData] = useState([{ records: [] }])
15
+
16
+  const columns = [
17
+    {
18
+      title: '编号',
19
+      dataIndex: 'index',
20
+      key: 'index',
21
+      render: (text, record, index) => <span>{index + 1}</span>,
22
+    },
23
+    {
24
+      title: '类型名称',
25
+      dataIndex: 'buildingTypeName',
26
+      key: 'buildingTypeName',
27
+      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{record.buildingTypeName}</Tag>,
28
+    },
29
+    {
30
+      title: '创建时间',
31
+      dataIndex: 'createDate',
32
+      key: 'createDate',
33
+      render: (_, record) => <span>{moment(record.createDate).format('YYYY-MM-DD')}</span>,
34
+    },
35
+    {
36
+      title: '操作',
37
+      dataIndex: 'row',
38
+      key: 'row',
39
+      render: withActions((_, record) => [
40
+        <AuthButton name="admin.tdBuildingType.delete" noRight={null}>
41
+          <EditIcon text="删除" type="delete" onClick={() => deleteType(record)} />
42
+        </AuthButton>,
43
+        <AuthButton name="admin.tdBuildingType.update" noRight={null}>
44
+          <EditIcon text="编辑" type="edit" onClick={() => toEdi(record.buildingTypeId)} />
45
+        </AuthButton>,
46
+      ]),
47
+    },
48
+  ];
49
+
50
+  // eslint-disable-next-line react-hooks/rules-of-hooks
51
+  useEffect(() => {
52
+    getList({ pageNum: 1, pageSize: 10 })
53
+  }, [])
54
+
55
+  const openNotificationWithIcon = (type, message) => {
56
+    notification[type]({
57
+      message,
58
+      description:
59
+        '',
60
+    });
61
+  }
62
+
63
+  function getList(params) {
64
+    request({ ...apis.buildingType.getList, params: { ...params } }).then(res => {
65
+      setData(res)
66
+    }).catch(err => {
67
+      // eslint-disable-next-line no-unused-expressions
68
+      // openNotificationWithIcon('error', err)
69
+    })
70
+  }
71
+
72
+  // 分页
73
+  function onChange(pageNumber) {
74
+    // eslint-disable-next-line no-console
75
+    console.log('Page: ', pageNumber);
76
+    getList({ pageNum: pageNumber, pageSize: 10 })
77
+  }
78
+
79
+  function deleteType(row) {
80
+    row.status = -1
81
+    const modal = Modal.confirm();
82
+    modal.update({
83
+      content: '确认删除?',
84
+      okText: '确认',
85
+      cancelText: '关闭',
86
+      onOk: () => {
87
+        request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } }).then(() => {
88
+          getList({ pageNum: data.current, pageSize: 10 })
89
+        }).then(() => {
90
+          openNotificationWithIcon('success', '操作成功')
91
+        }).catch(err => {
92
+          // openNotificationWithIcon('error', err.message)
93
+        })
94
+
95
+        modal.destroy();
96
+      },
97
+      onCancel: () => {
98
+        modal.destroy();
99
+      },
100
+    });
101
+  }
102
+
103
+  // 跳转修改页
104
+  function toEdi(currentId) {
105
+    router.push({
106
+      pathname: '/building/type/edi',
107
+      query: {
108
+        id: currentId || '',
109
+      },
110
+    });
111
+  }
112
+
113
+  return (
114
+    <>
115
+      <AuthButton name="admin.tdBuildingType.add" noRight={null}>
116
+        <Button type="danger" onClick={() => toEdi()}>新增类型</Button>
117
+      </AuthButton>
118
+      <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="buildingType" />
119
+      {/* 分页 */}
120
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
121
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={onChange} current={data.current} />
122
+      </div>
123
+    </>
124
+  )
125
+}

+ 48
- 0
estateagents-admin-manager/src/pages/building/type/style.css Ver arquivo

@@ -0,0 +1,48 @@
1
+.SubmitButton {
2
+  background: #3a91d5;
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.SelectFrom {
7
+  width: 180px;
8
+  background: #ffffff;
9
+  border-radius: 7px;
10
+  border: 1px solid #dbdbdb;
11
+}
12
+.addButton {
13
+  background: #50be00;
14
+  border-radius: 4px;
15
+  border: 0px;
16
+  margin: 10px 0px;
17
+}
18
+.cardText {
19
+  font-size:  0.106rem;
20
+  color: #333;
21
+  line-height: 24px;
22
+  display: flex;
23
+  align-items: center;
24
+  position: relative;
25
+}
26
+.cardItem {
27
+
28
+  color: #666;
29
+  display: flex;
30
+  align-items: center;
31
+  line-height: 1.5;
32
+  font-size: 0.106rem;
33
+  margin-bottom: 0.08rem;
34
+}
35
+.ediText {
36
+  font-size: 0.106rem;
37
+  color: #ff925c;
38
+  line-height: 24px;
39
+  position: absolute;
40
+  right: 0;
41
+}
42
+.title {
43
+  display: inline-block;
44
+  width: 0.54rem;
45
+  justify-content: space-between;
46
+  text-align: justify;
47
+  text-align-last: justify;
48
+}

+ 49
- 0
estateagents-admin-manager/src/pages/building/type/style.less Ver arquivo

@@ -0,0 +1,49 @@
1
+.SubmitButton {
2
+  background: #3a91d5;
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.SelectFrom {
7
+  width: 180px;
8
+  background: #ffffff;
9
+  border-radius: 7px;
10
+  border: 1px solid #dbdbdb;
11
+}
12
+.addButton {
13
+  background: #FF4A4A;
14
+  border-radius: 4px;
15
+  border: 0px;
16
+  margin: 10px 0px;
17
+}
18
+.cardText {
19
+  color: #333;
20
+  display: flex;
21
+  align-items: center;
22
+  position: relative;
23
+  line-height: 1.5;
24
+  font-size: 0.106rem;
25
+  margin-bottom: 0.08rem;
26
+
27
+}
28
+.cardItem{
29
+  color: #666;
30
+  display: flex;
31
+  align-items: center;  
32
+  line-height: 1.5;
33
+  font-size: 0.106rem;
34
+  margin-bottom: 0.08rem;
35
+}
36
+.ediText {
37
+  font-size: 0.106rem;
38
+  color: #ff925c;
39
+  line-height: 24px;
40
+  position: absolute;
41
+  right: 0;
42
+}
43
+.title{
44
+  display: inline-block;
45
+  width: 0.54rem;
46
+  justify-content: space-between;
47
+  text-align: justify;
48
+  text-align-last:justify
49
+}

+ 47
- 0
estateagents-admin-manager/src/pages/building/type/style.wxss Ver arquivo

@@ -0,0 +1,47 @@
1
+.SubmitButton {
2
+  background: #3a91d5;
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.SelectFrom {
7
+  width: 180px;
8
+  background: #ffffff;
9
+  border-radius: 7px;
10
+  border: 1px solid #dbdbdb;
11
+}
12
+.addButton {
13
+  background: #50be00;
14
+  border-radius: 4px;
15
+  border: 0px;
16
+  margin: 10px 0px;
17
+}
18
+.cardText {
19
+  font-size:  0.106rem;
20
+  color: #333;
21
+  line-height: 24px;
22
+  display: flex;
23
+  align-items: center;
24
+  position: relative;
25
+}
26
+.cardItem {
27
+  font-size:  0.106rem;
28
+  font-weight: 400;
29
+  color: #666;
30
+  line-height: 24px;
31
+  display: flex;
32
+  align-items: center;
33
+}
34
+.ediText {
35
+  font-size:  0.106rem;
36
+  color: #ff925c;
37
+  line-height: 24px;
38
+  position: absolute;
39
+  right: 0;
40
+}
41
+.title {
42
+  display: inline-block;
43
+  width:  0.54rem;
44
+  justify-content: space-between;
45
+  text-align: justify;
46
+  text-align-last: justify;
47
+}

+ 124
- 0
estateagents-admin-manager/src/pages/carouselFigure/LiveGroup.jsx Ver arquivo

@@ -0,0 +1,124 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+import Navigate from '@/components/Navigate';
5
+
6
+const { Search } = Input;
7
+
8
+const getGroupList = fetch(apis.taliveActivity.taLiveActivity)
9
+
10
+export default props => {
11
+  const {
12
+    value,
13
+    onChange,
14
+    ...rest
15
+  } = props;
16
+
17
+  const [list, setList] = useState([]);
18
+  const [visible, setVisible] = useState(false);
19
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择直播活动' })
20
+  const getGroupTitle = val => {
21
+    return (list.filter(x => x.liveActivityId == val)[0] || {}).liveActivityTitle || '请选择直播活动'
22
+  }
23
+  const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
24
+
25
+  const buildingId = props.buildingId()
26
+
27
+  useEffect(() => {
28
+    getGroupList({
29
+      params: {
30
+        buildingId,
31
+        pageNum: 1,
32
+        pageSize: 999,
33
+        status: 1,
34
+        source: 2,
35
+      },
36
+    }).then(data => {
37
+      setList(data.records || [])
38
+
39
+       const getGroupTitle = val => {
40
+        return (data.records.filter(x => x.liveActivityId == val)[0] || {}).liveActivityTitle || '请选择直播活动'
41
+      }
42
+      const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
43
+
44
+      updateGroup(buildingId ? undefined : value);
45
+
46
+      // updateGroup(buildingId ? undefined : value);
47
+    })
48
+  }, [buildingId]);
49
+  const searchGroup = (e) => {
50
+    getGroupList({
51
+      params: {
52
+        buildingId,
53
+        pageNum: 1,
54
+        pageSize: 999,
55
+        status: 1,
56
+        source: 2,
57
+        liveActivityTitle: e
58
+      }
59
+    }).then((data) => {
60
+      setList(data.records || [])
61
+
62
+      // const getGroupTitle = val => {
63
+      //   return (data.records.filter(x => x.liveActivityId == val)[0] || {}).liveActivityTitle || '请选择直播活动'
64
+      // }
65
+      // const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
66
+
67
+      updateGroup(buildingId ? undefined : value);
68
+      // setAct(buildingId ? undefined : value);
69
+    })
70
+  }
71
+  if (value !== group.groupId) {
72
+    updateGroup(value);
73
+  }
74
+
75
+  const handleChange = val => {
76
+    onChange(val)
77
+  }
78
+
79
+  const setData = val => {
80
+    updateGroup(val)
81
+    onChange(val)
82
+    setVisible(false)
83
+  }
84
+
85
+  const columns = [
86
+    {
87
+      title: '标题',
88
+      dataIndex: 'liveActivityTitle',
89
+      key: 'liveActivityId',
90
+      align: 'center',
91
+      ellipsis: true,
92
+      render: text => <a>{text}</a>,
93
+    },
94
+    {
95
+      title: '操作',
96
+      align: 'center',
97
+      width: '20%',
98
+      render: (text, record) => (
99
+        <Navigate onClick={() => setData(record.liveActivityId)}>选择</Navigate>
100
+      ),
101
+    },
102
+  ];
103
+
104
+  return (
105
+    <div>
106
+             <div ><Navigate onClick={() => setVisible(true)}>{group.groupName}</Navigate></div>
107
+      <Modal
108
+        title="请选择"
109
+        visible={visible}
110
+        onCancel={() => setVisible(false)}
111
+        footer={[]}
112
+      >
113
+        <Search
114
+          placeholder="请输入标题"
115
+          enterButton="搜索"
116
+          size="large"
117
+          onSearch={value => searchGroup(value)}
118
+          style={{ marginBottom: '16px' }}
119
+        />
120
+        <Table rowKey={list => list.liveActivityId} columns={columns} dataSource={list} />
121
+      </Modal>
122
+    </div>
123
+  );
124
+}

+ 110
- 0
estateagents-admin-manager/src/pages/carouselFigure/SalesBatchGroup.jsx Ver arquivo

@@ -0,0 +1,110 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+import Navigate from '@/components/Navigate';
5
+
6
+const { Search } = Input;
7
+
8
+const getGroupList = fetch(apis.house.taSalesBatch)
9
+
10
+export default props => {
11
+  const {
12
+    value,
13
+    onChange,
14
+    ...rest
15
+  } = props;
16
+
17
+  const [list, setList] = useState([]);
18
+  const [visible, setVisible] = useState(false);
19
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择销售批次' })
20
+  const getGroupTitle = val => {
21
+    return (list.filter(x => x.salesBatchId == val)[0] || {}).salesBatchName || '请选择销售批次'
22
+  }
23
+  const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
24
+
25
+  const buildingId = props.buildingId()
26
+
27
+  useEffect(() => {
28
+    getGroupList({
29
+      params: {
30
+        buildingId,
31
+        pageNum: 1,
32
+        pageSize: 999,
33
+        status: 1,
34
+      },
35
+    }).then(data => {
36
+      setList(data.records || [])
37
+
38
+      updateGroup(buildingId ? undefined : value);
39
+    })
40
+  }, [buildingId]);
41
+  const searchGroup = (e) => {
42
+    getGroupList({
43
+      params: {
44
+        buildingId,
45
+        pageNum: 1,
46
+        pageSize: 999,
47
+        status: 1,
48
+        salesBatchName: e
49
+      }
50
+    }).then((data) => {
51
+      setList(data.records || [])
52
+
53
+      updateGroup(buildingId ? undefined : value);
54
+      // setAct(buildingId ? undefined : value);
55
+    })
56
+  }
57
+  if (value !== group.groupId) {
58
+    updateGroup(value);
59
+  }
60
+
61
+  const handleChange = val => {
62
+    onChange(val)
63
+  }
64
+
65
+  const setData = val => {
66
+    updateGroup(val)
67
+    onChange(val)
68
+    setVisible(false)
69
+  }
70
+
71
+  const columns = [
72
+    {
73
+      title: '标题',
74
+      dataIndex: 'salesBatchName',
75
+      key: 'salesBatchId',
76
+      align: 'center',
77
+      ellipsis: true,
78
+      render: text => <a>{text}</a>,
79
+    },
80
+    {
81
+      title: '操作',
82
+      align: 'center',
83
+      width: '20%',
84
+      render: (text, record) => (
85
+        <Navigate onClick={() => setData(record.salesBatchId)}>选择</Navigate>
86
+      ),
87
+    },
88
+  ];
89
+
90
+  return (
91
+    <div>
92
+       <div ><Navigate onClick={() => setVisible(true)}>{group.groupName}</Navigate></div>
93
+      <Modal
94
+        title="请选择"
95
+        visible={visible}
96
+        onCancel={() => setVisible(false)}
97
+        footer={[]}
98
+      >
99
+        <Search
100
+          placeholder="请输入标题"
101
+          enterButton="搜索"
102
+          size="large"
103
+          onSearch={value => searchGroup(value)}
104
+          style={{ marginBottom: '16px' }}
105
+        />
106
+        <Table rowKey={list => list.salesBatchId} columns={columns} dataSource={list} />
107
+      </Modal>
108
+    </div>
109
+  );
110
+}

+ 114
- 0
estateagents-admin-manager/src/pages/carouselFigure/SelectActivity.jsx Ver arquivo

@@ -0,0 +1,114 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+import Navigate from '@/components/Navigate';
5
+
6
+const getActivities = fetch(apis.activity.listSelected)
7
+const { Search } = Input;
8
+
9
+export default (props) => {
10
+  const {
11
+    value,
12
+    onChange,
13
+    ...rest
14
+  } = props;
15
+
16
+  const [list, setList] = useState([]);
17
+  const [visible, setVisible] = useState(false);
18
+  const [activity, setActivity] = useState({ dynamicId: undefined, title: '请选择活动' })
19
+  const getActTitle = val => ((list.filter(x => x.dynamicId === val)[0]) || {}).title || '请选择活动'
20
+  const setAct = val => setActivity({ dynamicId: val, title: getActTitle(val) })
21
+
22
+  const buildingId = props.buildingId()
23
+
24
+  useEffect(() => {
25
+    getActivities({
26
+      params: {
27
+        buildingId,
28
+        pageNum: 1,
29
+        pageSize: 999,
30
+        activityStatus: 2,
31
+      }
32
+    }).then((data) => {
33
+      setList(data.list || [])
34
+
35
+      console.log('----', buildingId, value)
36
+
37
+      setAct(buildingId ? undefined : value);
38
+    })
39
+  }, [buildingId]);
40
+
41
+  if (value !== activity.dynamicId) {
42
+    setAct(value);
43
+  }
44
+  const searchActivity =(e)=>{
45
+    getActivities({
46
+      params: {
47
+        buildingId,
48
+        pageNum: 1,
49
+        pageSize: 999,
50
+        activityStatus: 2,
51
+        name:e
52
+      }
53
+    }).then((data) => {
54
+      setList(data.list || [])
55
+
56
+      console.log('----', buildingId, value)
57
+
58
+      // setAct(buildingId ? undefined : value);
59
+    })
60
+  }
61
+
62
+  let chooseVal = value
63
+
64
+  const handleChange = val => chooseVal = val
65
+
66
+  const setData = val => {
67
+    setAct(val)
68
+    onChange(val)
69
+    setVisible(false)
70
+  }
71
+
72
+  const columns = [
73
+    {
74
+      title: '标题',
75
+      dataIndex: 'title',
76
+      key: 'dynamicId',
77
+      align: 'center',
78
+      ellipsis: true,
79
+      render: text => <a>{text}</a>,
80
+    },
81
+    {
82
+      title: '操作',
83
+      dataIndex: 'name',
84
+      align: 'center',
85
+      width: '20%',
86
+      render: (text, record) => (
87
+        <Navigate onClick={() => setData(record.dynamicId)}>选择</Navigate>
88
+      ),
89
+    },
90
+  ];
91
+
92
+  return (
93
+
94
+    <div>
95
+      <div ><Navigate onClick={() => setVisible(true)}>{activity.title}</Navigate></div>
96
+      <Modal
97
+        title="请选择"
98
+        visible={visible}
99
+        onCancel={() => setVisible(false)}
100
+        footer={[]}
101
+      >
102
+        <Search
103
+          placeholder="请输入标题"
104
+          enterButton="搜索"
105
+          size="large"
106
+          onSearch={value => searchActivity(value)}
107
+          style={{ marginBottom: '16px' }}
108
+        />
109
+        <Table rowKey={list => list.dynamicId} columns={columns} dataSource={list} />
110
+      </Modal>
111
+    </div>
112
+
113
+  );
114
+}

+ 110
- 0
estateagents-admin-manager/src/pages/carouselFigure/SelectGroup.jsx Ver arquivo

@@ -0,0 +1,110 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Select, Modal, Button, Table, Divider, Tag, Input } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+import Navigate from '@/components/Navigate';
5
+
6
+const { Search } = Input;
7
+
8
+const getGroupList = fetch(apis.groupActivity.EffectiveList)
9
+
10
+export default props => {
11
+  const {
12
+    value,
13
+    onChange,
14
+    ...rest
15
+  } = props;
16
+
17
+  const [list, setList] = useState([]);
18
+  const [visible, setVisible] = useState(false);
19
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择拼团' })
20
+  const getGroupTitle = val => {
21
+    return (list.filter(x => x.groupActivityId == val)[0] || {}).activityName || '请选择拼团'
22
+  }
23
+  const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
24
+
25
+  const buildingId = props.buildingId()
26
+
27
+  useEffect(() => {
28
+    getGroupList({
29
+      params: {
30
+        buildingId,
31
+        pageNum: 1,
32
+        pageSize: 999,
33
+        status: 1,
34
+      },
35
+    }).then(data => {
36
+      setList(data.records || [])
37
+
38
+      updateGroup(buildingId ? undefined : value);
39
+    })
40
+  }, [buildingId]);
41
+  const searchGroup = (e) => {
42
+    getGroupList({
43
+      params: {
44
+        buildingId,
45
+        pageNum: 1,
46
+        pageSize: 999,
47
+        status: 1,
48
+        name: e
49
+      }
50
+    }).then((data) => {
51
+      setList(data.records || [])
52
+
53
+      updateGroup(buildingId ? undefined : value);
54
+      // setAct(buildingId ? undefined : value);
55
+    })
56
+  }
57
+  if (value !== group.groupId) {
58
+    updateGroup(value);
59
+  }
60
+
61
+  const handleChange = val => {
62
+    onChange(val)
63
+  }
64
+
65
+  const setData = val => {
66
+    updateGroup(val)
67
+    onChange(val)
68
+    setVisible(false)
69
+  }
70
+
71
+  const columns = [
72
+    {
73
+      title: '标题',
74
+      dataIndex: 'activityName',
75
+      key: 'groupActivityId',
76
+      align: 'center',
77
+      ellipsis: true,
78
+      render: text => <a>{text}</a>,
79
+    },
80
+    {
81
+      title: '操作',
82
+      align: 'center',
83
+      width: '20%',
84
+      render: (text, record) => (
85
+         <Navigate onClick={() => setData(record.groupActivityId)}>选择</Navigate>
86
+      ),
87
+    },
88
+  ];
89
+
90
+  return (
91
+    <div>
92
+      <div><Navigate onClick={() => setVisible(true)} >{group.groupName}</Navigate></div>
93
+      <Modal
94
+        title="请选择"
95
+        visible={visible}
96
+        onCancel={() => setVisible(false)}
97
+        footer={[]}
98
+      >
99
+        <Search
100
+          placeholder="请输入标题"
101
+          enterButton="搜索"
102
+          size="large"
103
+          onSearch={value => searchGroup(value)}
104
+          style={{ marginBottom: '16px' }}
105
+        />
106
+        <Table rowKey={list => list.groupActivityId} columns={columns} dataSource={list} />
107
+      </Modal>
108
+    </div>
109
+  );
110
+}

+ 286
- 0
estateagents-admin-manager/src/pages/carouselFigure/advertisingList.jsx Ver arquivo

@@ -0,0 +1,286 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
3
+import router from 'umi/router';
4
+import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
8
+import Navigate from '@/components/Navigate';
9
+import SelectCity from '../../components/SelectButton/CitySelect'
10
+import BuildSelect from '../../components/SelectButton/BuildSelect'
11
+import apis from '../../services/apis';
12
+import request from '../../utils/request';
13
+import styles from '../style/GoodsList.less';
14
+
15
+const { Option } = Select;
16
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17
+
18
+const header = (props) => {
19
+  const [data, setData] = useState({})
20
+  //   const [page, changePage] = useState({})
21
+
22
+  useEffect(() => {
23
+    getList({ pageNum: 1, pageSize: 10, showType: 'screen' });
24
+  }, [])
25
+
26
+  // 查询列表
27
+  const getList = (params) => {
28
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params }, }).then((data) => {
29
+      console.log(data)
30
+      setData(data)
31
+    })
32
+  }
33
+
34
+
35
+  // 跳转到编辑商品
36
+  const toEdit = (contentId) => () => {
37
+    router.push({
38
+      pathname: '/carouselFigure/editAdvertising',
39
+      query: {
40
+        contentId
41
+      },
42
+    });
43
+  }
44
+
45
+  const columns = [
46
+    {
47
+      title: '主图',
48
+      dataIndex: 'image',
49
+      key: 'image',
50
+      align: 'center',
51
+      render: (image,row) => <Navigate onClick={toEdit(row.contentId)}><img src={image} className={styles.imgSmall} /></Navigate>,
52
+    },
53
+    {
54
+      title: '发布城市',
55
+      dataIndex: 'cityName',
56
+      key: 'cityName',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '关联项目',
61
+      dataIndex: 'buildingName',
62
+      key: 'buildingName',
63
+      align: 'center',
64
+      render: (buildingName) => <span>{buildingName === null ? '无' : buildingName}</span>
65
+    },
66
+    {
67
+      title: '关联内容类型',
68
+      dataIndex: 'contentType',
69
+      key: 'contentType',
70
+      align: 'center',
71
+      render: (contentType) => <span>{contentType === 'project' ? '项目' : contentType === 'activity' ? '报名活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' :
72
+        contentType === 'help' ? '助力活动' : contentType === 'group' ? '拼团活动' : contentType === 'h5' ? 'H5活动' : contentType === 'salesBatch' ? '在线选房' : contentType === 'live' ? '直播活动' : '无'}</span>
73
+    },
74
+    {
75
+      title: '发布位置',
76
+      dataIndex: 'showPosition',
77
+      key: 'showPosition',
78
+      align: 'center',
79
+      render: (showPosition) => <span>{ showPosition === 'index' ? '首页' : showPosition === 'building' ? '项目' : '' }</span>
80
+    },
81
+    {
82
+      title: '发布时间',
83
+      dataIndex: 'createDate',
84
+      key: 'createDate',
85
+      align: 'center',
86
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
87
+    },
88
+    {
89
+      title: '状态',
90
+      dataIndex: 'status',
91
+      key: 'status',
92
+      align: 'center',
93
+      render: (status) => <><span>{status == 1 ? '上架' : '下架'}</span></>
94
+    },
95
+    {
96
+      title: '操作',
97
+      dataIndex: 'handle',
98
+      key: 'handle',
99
+      align: 'center',
100
+      render: withActions((x, row) => [
101
+        <AuthButton name="admin.advert.publish" noRight={null}>
102
+          <EditIcon text={row.status === 1 ? '下架' : '上架'} type={row.status === 1 ? 'down' : 'up'}  onClick={changeStatus(row)} />
103
+        </AuthButton>,
104
+        <AuthButton name="admin.advert.put" noRight={null}>
105
+          <EditIcon text="编辑" type="edit" onClick={toEdit(row.contentId)} />
106
+        </AuthButton>,
107
+        <AuthButton name="admin.advert.delete" noRight={null}>
108
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)}/>
109
+        </AuthButton>,
110
+      ])
111
+    },
112
+  ];
113
+
114
+  const finishDynamic = (row) => {
115
+    Modal.confirm({
116
+      title: '结束以后将无法编辑, 是否继续?',
117
+      okText: '确定',
118
+      cancelText: '取消',
119
+      onOk() {
120
+        request({ ...apis.carsuseFigure.finish, data: { dynamicId: row.dynamicId, top: "" }, }).then((data) => {
121
+          console.log(data)
122
+          message.info('操作成功!')
123
+          getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
124
+        }).catch((err) => {
125
+          console.log(err)
126
+          message.info(err.msg || err.message)
127
+        })
128
+      },
129
+    });
130
+  }
131
+
132
+  //删除
133
+  const deleteCarouse = (contentId) => () => {
134
+    Modal.confirm({
135
+      title: '确认删除此数据?',
136
+      okText: '确定',
137
+      cancelText: '取消',
138
+      onOk() {
139
+        request({ ...apis.carsuseFigure.deleteExtendContent, urlData: { id: contentId } }).then((data) => {
140
+          message.info('操作成功!')
141
+          getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
142
+        }).catch((err) => {
143
+          console.log(err)
144
+          message.info(err.msg || err.message)
145
+        })
146
+      },
147
+    });
148
+  }
149
+
150
+  //   停用启用
151
+  const changeStatus = (row) => () => {
152
+    console.log(row)
153
+    if (row.status === 0) {
154
+
155
+      Modal.confirm({
156
+        title: '确认发布此数据?',
157
+        okText: '确定',
158
+        cancelText: '取消',
159
+        onOk() {
160
+          row.status = 1
161
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
162
+            message.info('操作成功!')
163
+            getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
164
+          }).catch((err) => {
165
+            console.log(err)
166
+            message.info(err.msg || err.message)
167
+          })
168
+        },
169
+      });
170
+    } else if (row.status === 1) {
171
+
172
+      Modal.confirm({
173
+        title: '停用后不会再显示在小程序端',
174
+        okText: '确定',
175
+        cancelText: '取消',
176
+        onOk() {
177
+          row.status = 0
178
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
179
+            message.info('操作成功!')
180
+            getList({ pageNum: 1, pageSize: 10, showType: 'screen' })
181
+          }).catch((err) => {
182
+            console.log(err)
183
+            message.info(err.msg || err.message)
184
+          })
185
+        },
186
+      });
187
+    }
188
+
189
+  }
190
+
191
+  const changePageNum = (pageNumber, props) => {
192
+    props.form.validateFields((err, values) => {
193
+      if (!err) {
194
+        getList({ pageNum: pageNumber, pageSize: 10, ...values, showType: 'screen' })
195
+      }
196
+    });
197
+  }
198
+
199
+  // 提交事件
200
+  const handleSubmit = (e, props) => {
201
+    e.preventDefault();
202
+    props.form.validateFields((err, values) => {
203
+      if (!err) {
204
+        console.log('提交数据: ', values)
205
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'screen' })
206
+      }
207
+    });
208
+  }
209
+
210
+  //重置搜索
211
+  function handleReset() {
212
+    props.form.resetFields();
213
+    getList({ pageNum: 1, pageSize: 10, showType: 'screen' });
214
+  }
215
+
216
+
217
+  const { getFieldDecorator } = props.form
218
+  return (
219
+
220
+    <>
221
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
222
+        <Form.Item>
223
+          {getFieldDecorator('cityId')(
224
+            <SelectCity />,
225
+          )}
226
+        </Form.Item>
227
+        <Form.Item>
228
+          {getFieldDecorator('buildingId')(
229
+            <BuildSelect />,
230
+          )}
231
+        </Form.Item>
232
+        <Form.Item>
233
+          {getFieldDecorator('contentType')(
234
+            <Select style={{ width: '180px' }} placeholder="类型">
235
+              <Option value="project">项目</Option>
236
+              <Option value="news">资讯</Option>
237
+              <Option value="activity">报名活动</Option>
238
+              <Option value="help">助力活动</Option>
239
+              <Option value="group">拼团活动</Option>
240
+              <Option value="h5">H5活动</Option>
241
+              <Option value="live">直播活动</Option>
242
+              <Option value="salesBatch">在线选房</Option>
243
+              <Option value="nothing">无</Option>
244
+            </Select>,
245
+          )}
246
+        </Form.Item>
247
+        <Form.Item>
248
+          {getFieldDecorator('showPosition')(
249
+            <Select style={{ width: '180px' }} placeholder="发布位置">
250
+              <Option value="index">首页</Option>
251
+              <Option value="building">项目</Option>
252
+            </Select>,
253
+          )}
254
+        </Form.Item>
255
+        <Form.Item>
256
+          {getFieldDecorator('status')(
257
+            <Select style={{ width: '180px' }} placeholder="状态">
258
+              <Option value="1">已上架</Option>
259
+              <Option value="0">已下架</Option>
260
+            </Select>,
261
+          )}
262
+        </Form.Item>
263
+        <Form.Item>
264
+          <AuthButton name="admin.advert.search" noRight={null}>
265
+            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
266
+              搜索
267
+          </Button>
268
+          </AuthButton>
269
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
270
+            重置
271
+            </Button>
272
+        </Form.Item>
273
+      </Form>
274
+      <AuthButton name="admin.advert.post" noRight={null}>
275
+        <Button type="danger" className={styles.addBtn} onClick={toEdit()}>新增</Button>
276
+      </AuthButton>
277
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="advertisingList" />
278
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
279
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e, props)} current={data.current} />
280
+      </div>
281
+    </>
282
+  )
283
+}
284
+const WrappedHeader = Form.create({ name: 'header' })(header);
285
+
286
+export default WrappedHeader

+ 284
- 0
estateagents-admin-manager/src/pages/carouselFigure/carouselFigureList.jsx Ver arquivo

@@ -0,0 +1,284 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
3
+import router from 'umi/router';
4
+import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
8
+import Navigate from '@/components/Navigate';
9
+import SelectCity from '../../components/SelectButton/CitySelect'
10
+import BuildSelect from '../../components/SelectButton/BuildSelect'
11
+import apis from '../../services/apis';
12
+import request from '../../utils/request';
13
+import styles from '../style/GoodsList.less';
14
+
15
+const { Option } = Select;
16
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17
+
18
+const header = (props) => {
19
+  const [data, setData] = useState({})
20
+  //   const [page, changePage] = useState({})
21
+
22
+  useEffect(() => {
23
+    getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
24
+  }, [])
25
+
26
+  // 查询列表
27
+  const getList = (params) => {
28
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params }, }).then((data) => {
29
+      console.log(data)
30
+      setData(data)
31
+    })
32
+  }
33
+
34
+
35
+  // 跳转到编辑页面
36
+  const toEditCarouse = (contentId) => () => {
37
+    router.push({
38
+      pathname: '/carouselFigure/editCarousel',
39
+      query: {
40
+        contentId
41
+      },
42
+    });
43
+  }
44
+
45
+  const columns = [
46
+    {
47
+      title: '主图',
48
+      dataIndex: 'image',
49
+      key: 'image',
50
+      align: 'center',
51
+      render: (x, row) => <Navigate onClick={toEditCarouse(row.contentId)} ><img src={row.image} className={row.showPosition === 'index' ? styles.imgIndex : row.showPosition === 'mall' ? styles.imgPerfect : ''} /></Navigate>,
52
+    },
53
+    {
54
+      title: '发布城市',
55
+      dataIndex: 'cityName',
56
+      key: 'cityName',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '关联项目',
61
+      dataIndex: 'buildingName',
62
+      key: 'buildingName',
63
+      align: 'center',
64
+      render: (buildingName) => <span>{buildingName === null ? '无' : buildingName}</span>
65
+    },
66
+    {
67
+      title: '关联内容类型',
68
+      dataIndex: 'contentType',
69
+      key: 'contentType',
70
+      align: 'center',
71
+      render: (contentType) => <span>{contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' :
72
+        contentType === 'help' ? '助力' : contentType === 'group' ? '拼团' : contentType === 'h5' ? 'H5活动' : contentType === 'salesBatch' ? '销售批次详情' : contentType === 'live' ? '直播活动详情' : '无'}</span>
73
+    },
74
+    {
75
+      title: '发布位置',
76
+      dataIndex: 'showPosition',
77
+      key: 'showPosition',
78
+      align: 'center',
79
+      render: (showPosition) => <span>{showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : ''}</span>
80
+    },
81
+    {
82
+      title: '发布时间',
83
+      dataIndex: 'createDate',
84
+      key: 'createDate',
85
+      align: 'center',
86
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
87
+    },
88
+    {
89
+      title: '状态',
90
+      dataIndex: 'status',
91
+      key: 'status',
92
+      align: 'center',
93
+      render: (status) => <><span>{status == 1 ? '已上架' : '已下架'}</span></>
94
+    },
95
+    {
96
+      title: '操作',
97
+      dataIndex: 'handle',
98
+      key: 'handle',
99
+      align: 'center',
100
+      render: withActions((x, row) => [
101
+        <AuthButton name="admin.extendContent.publish" noRight={null}>
102
+          <EditIcon type={row.status === 1 ? 'down' : 'up'} text={row.status === 1 ? '下架' : '上架'} onClick={changeStatus(row)} />
103
+        </AuthButton>,
104
+
105
+        <AuthButton name="admin.extendContent.id.put" noRight={null}>
106
+          <EditIcon text="编辑" type="edit" onClick={toEditCarouse(row.contentId)} />
107
+        </AuthButton>,
108
+
109
+        <AuthButton name="admin.extendContent.delete" noRight={null}>
110
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
111
+        </AuthButton>,
112
+      ])
113
+    },
114
+  ];
115
+
116
+  const finishDynamic = (row) => {
117
+    Modal.confirm({
118
+      title: '结束以后将无法编辑, 是否继续?',
119
+      okText: '确定',
120
+      cancelText: '取消',
121
+      onOk() {
122
+        request({ ...apis.carsuseFigure.finish, data: { dynamicId: row.dynamicId, top: "" }, }).then((data) => {
123
+          console.log(data)
124
+          message.info('操作成功!')
125
+          getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
126
+        }).catch((err) => {
127
+          console.log(err)
128
+          message.info(err.msg || err.message)
129
+        })
130
+      },
131
+    });
132
+  }
133
+
134
+  //删除
135
+  const deleteCarouse = (contentId) => () => {
136
+    Modal.confirm({
137
+      title: '确认删除此数据?',
138
+      okText: '确定',
139
+      cancelText: '取消',
140
+      onOk() {
141
+        request({ ...apis.carsuseFigure.deleteExtendContent, urlData: { id: contentId } }).then((data) => {
142
+          message.info('操作成功!')
143
+          getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
144
+        }).catch((err) => {
145
+          console.log(err)
146
+          message.info(err.msg || err.message)
147
+        })
148
+      },
149
+    });
150
+  }
151
+
152
+  //   停用启用
153
+  const changeStatus = (row) => () => {
154
+    console.log(row)
155
+    if (row.status === 0) {
156
+
157
+      Modal.confirm({
158
+        title: '确认发布此数据?',
159
+        okText: '确定',
160
+        cancelText: '取消',
161
+        onOk() {
162
+          row.status = 1
163
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
164
+            message.info('操作成功!')
165
+            getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
166
+          }).catch((err) => {
167
+            console.log(err)
168
+            row.status = 0
169
+            message.info(err.msg || err.message)
170
+          })
171
+        },
172
+      });
173
+    } else if (row.status === 1) {
174
+
175
+      Modal.confirm({
176
+        title: '停用后不会再显示在小程序端',
177
+        okText: '确定',
178
+        cancelText: '取消',
179
+        onOk() {
180
+          row.status = 0
181
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
182
+            message.info('操作成功!')
183
+            getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
184
+          }).catch((err) => {
185
+            console.log(err)
186
+            row.status = 1
187
+            message.info(err.msg || err.message)
188
+          })
189
+        },
190
+      });
191
+    }
192
+
193
+  }
194
+
195
+  const changePageNum = (pageNumber) => {
196
+    getList({ pageNum: pageNumber, pageSize: 10, showType: 'banner', ...props.form.getFieldsValue() })
197
+  }
198
+
199
+  // 提交事件
200
+  const handleSubmit = (e, props) => {
201
+    e.preventDefault();
202
+    props.form.validateFields((err, values) => {
203
+      if (!err) {
204
+        console.log('提交数据: ', values)
205
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' })
206
+      }
207
+    });
208
+  }
209
+
210
+  //重置搜索
211
+  function handleReset() {
212
+    props.form.resetFields();
213
+    getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
214
+  }
215
+
216
+  const { getFieldDecorator } = props.form
217
+  return (
218
+
219
+    <>
220
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
221
+        <Form.Item>
222
+          {getFieldDecorator('cityId')(
223
+            <SelectCity />,
224
+          )}
225
+        </Form.Item>
226
+        <Form.Item>
227
+          {getFieldDecorator('buildingId')(
228
+            <BuildSelect />,
229
+          )}
230
+        </Form.Item>
231
+        <Form.Item>
232
+          {getFieldDecorator('contentType')(
233
+            <Select style={{ width: '180px' }} placeholder="类型">
234
+              <Option value="activity">活动</Option>
235
+              <Option value="project">项目</Option>
236
+              <Option value="news">资讯</Option>
237
+              <Option value="help">助力</Option>
238
+              <Option value="group">拼团</Option>
239
+              <Option value="h5">H5</Option>
240
+              <Option value="nothing">无</Option>
241
+              {/* <Option value="other">其他</Option> */}
242
+            </Select>,
243
+          )}
244
+        </Form.Item>
245
+        <Form.Item>
246
+          {getFieldDecorator('showPosition')(
247
+            <Select style={{ width: '180px' }} placeholder="发布位置">
248
+              <Option value="mall">积分商城</Option>
249
+              <Option value="index">首页</Option>
250
+            </Select>,
251
+          )}
252
+        </Form.Item>
253
+        <Form.Item>
254
+          {getFieldDecorator('status')(
255
+            <Select style={{ width: '180px' }} placeholder="状态">
256
+              <Option value="1">已上架</Option>
257
+              <Option value="0">已下架</Option>
258
+            </Select>,
259
+          )}
260
+        </Form.Item>
261
+        <Form.Item>
262
+          <AuthButton name="admin.extendContent.search" noRight={null}>
263
+            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
264
+              搜索
265
+          </Button>
266
+          </AuthButton>
267
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
268
+            重置
269
+            </Button>
270
+        </Form.Item>
271
+      </Form>
272
+      <AuthButton name="admin.extendContent.post" noRight={null}>
273
+        <Button type="danger" className={styles.addBtn} onClick={toEditCarouse()}>新增</Button>
274
+      </AuthButton>
275
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="carouseFigureList" />
276
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
277
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
278
+      </div>
279
+    </>
280
+  )
281
+}
282
+const WrappedHeader = Form.create({ name: 'header' })(header);
283
+
284
+export default WrappedHeader

+ 426
- 0
estateagents-admin-manager/src/pages/carouselFigure/editAdvertising.jsx Ver arquivo

@@ -0,0 +1,426 @@
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import { Modal, 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/BuildSelect2'
8
+import CitySelect from '../../components/SelectButton/CitySelect2'
9
+import { FieldTypes, createForm } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit';
11
+import SelectActivity from './SelectActivity';
12
+import SelectNews from './SelectNews';
13
+import apis from '../../services/apis';
14
+import request from '../../utils/request'
15
+import SelectHelp from './SelectHelp';
16
+import SelectGroup from './SelectGroup';
17
+import SelectH5 from './SelectH5';
18
+import SalesBatchGroup from './SalesBatchGroup';
19
+import LiveGroup from './LiveGroup';
20
+/**
21
+ *
22
+ *
23
+ * @param {*} props
24
+ * @returns
25
+ */
26
+const createEditor = () => {
27
+  let contentVisible = false
28
+  let activityVisible = false
29
+  let newsVisible = false
30
+  let helpVisible = false
31
+  let groupVisible = false
32
+  let salesBatchVisible = false
33
+  let liveVisible = false
34
+  let h5Visible = false
35
+  let buildingId = ''
36
+  let cityId = ''
37
+  let isHaveActive = false
38
+  let isCanChoose = true
39
+  let isHavePosition = false
40
+  let islet = true
41
+
42
+  const setExtraData = (data) => {
43
+    if (data.isHaveActive !== undefined) {
44
+      isHaveActive = data.isHaveActive
45
+      if (!isHaveActive) {
46
+        // data.contentType=null
47
+        data.buildingId = null
48
+      }
49
+    }
50
+    islet = isHaveActive
51
+    if (data.showPosition == 'index') {
52
+      isHavePosition = true;
53
+    } else {
54
+      isHavePosition = false;
55
+    }
56
+
57
+    // if (data.contentType == 'h5' || data.contentType=='live') {
58
+    //   isHaveActive = true;
59
+    // } else {
60
+    //   isHaveActive = false;
61
+    // }
62
+
63
+    contentVisible = data.contentType === 'other';
64
+    activityVisible = data.contentType === 'activity';
65
+    newsVisible = data.contentType === 'news';
66
+    helpVisible = data.contentType === 'help';
67
+    groupVisible = data.contentType === 'group';
68
+    salesBatchVisible = data.contentType === 'salesBatch';
69
+    liveVisible = data.contentType === 'live';
70
+    h5Visible = data.contentType === 'h5';
71
+
72
+    cityId = data.cityId
73
+    // console.log(data.buildingId, ' data.buildingId')
74
+    buildingId = data.buildingId
75
+  }
76
+
77
+  const setExtraData1 = data => {
78
+    console.log(data, "data.buildingIddata.buildingId2")
79
+    islet = data.isHaveActive
80
+
81
+    if ((data.contentType === 'h5' && data.buildingId == null) || data.contentType === '' || data.contentType === 'nothing' || (data.contentType === 'live' && data.buildingId == null)) {
82
+      isHaveActive = false
83
+    } else {
84
+      isHaveActive = true
85
+    }
86
+    // if (!isHaveActivea && data.contentType === 'h5') {
87
+    //   // data.contentType=null
88
+    //   data.buildingId = null
89
+    // }
90
+
91
+    // if (data.isHaveActive !== undefined) {
92
+    //   isHaveActive = data.isHaveActive
93
+    //   if (!isHaveActive) {
94
+    //     // data.contentType=null
95
+    //     data.buildingId = null
96
+    //   }
97
+    // }
98
+    if (data.showPosition == 'index') {
99
+      isHavePosition = true;
100
+    } else {
101
+      isHavePosition = false;
102
+    }
103
+
104
+    contentVisible = data.contentType === 'other';
105
+    activityVisible = data.contentType === 'activity';
106
+    newsVisible = data.contentType === 'news';
107
+    helpVisible = data.contentType === 'help';
108
+    groupVisible = data.contentType === 'group';
109
+    salesBatchVisible = data.contentType === 'salesBatch';
110
+    liveVisible = data.contentType === 'live';
111
+    h5Visible = data.contentType === 'h5';
112
+
113
+    console.log(data.buildingId, ' data.buildingId')
114
+    buildingId = data.buildingId
115
+  }
116
+
117
+  const handleFormValueChange = (props, changedValues, allValues) => {
118
+    setExtraData(allValues)
119
+  }
120
+
121
+  const XForm = createForm({ onValuesChange: handleFormValueChange })
122
+
123
+  return (props) => {
124
+    // const [tab, changeTab] = useState('basic')
125
+    const contentId = props.location.query.contentId
126
+    const [data, setData] = useState({})
127
+    const formRef = useRef(null);
128
+
129
+    // 查询列表
130
+    const getDetail = contentId => {
131
+      request({ ...apis.carsuseFigure.getExtendContent, urlData: { id: contentId } }).then((data) => {
132
+        setExtraData1(data)
133
+        setData(data)
134
+      })
135
+    }
136
+    useEffect(() => {
137
+      if (contentId) {
138
+        isCanChoose = false
139
+        getDetail(contentId);
140
+      } else {
141
+        isCanChoose = true
142
+      }
143
+    }, [])
144
+
145
+    const cancelPage = () => {
146
+      isCanChoose = true
147
+      router.push({
148
+        pathname: '/carouselFigure/advertisingList',
149
+      });
150
+    }
151
+
152
+    const fields = [
153
+      {
154
+        label: '是否关联项目',
155
+        name: 'isHaveActive',
156
+        type: FieldTypes.Switch,
157
+        value: isHaveActive,
158
+        hidden: () => !isCanChoose,
159
+        props: {
160
+          onChange: () => {
161
+            const type = formRef.current.props.form.getFieldValue('contentType')
162
+            if (formRef.current && (type !== 'live' && type !== 'h5')) {
163
+              console.log(formRef.current.props.form.getFieldValue('contentType'), '2222')
164
+              formRef.current.props.form.resetFields(['contentType', []]);
165
+            }
166
+          },
167
+        },
168
+        rules: [
169
+          { required: true, message: '是否城市活动' },
170
+        ],
171
+      },
172
+      {
173
+        label: '发布位置',
174
+        name: 'showPosition',
175
+        type: FieldTypes.Select,
176
+        value: isHaveActive,
177
+        dict: [{
178
+          label: '首页',
179
+          value: 'index',
180
+        },
181
+        {
182
+          label: '项目',
183
+          value: 'building',
184
+        }],
185
+        value: data.showPosition,
186
+        rules: [
187
+          { required: true, message: '请选择发布位置' },
188
+        ],
189
+      },
190
+      {
191
+        label: '所属项目',
192
+        name: 'buildingId',
193
+        render: <BuildSelect />,
194
+        value: data.buildingId,
195
+        hidden: () => !isHaveActive && isHavePosition,
196
+        rules: [
197
+          { required: true, message: '请选择所属项目' },
198
+        ],
199
+      },
200
+      {
201
+        label: '展示城市',
202
+        name: 'cityId',
203
+        render: <CitySelect />,
204
+        hidden: () => !isHavePosition || isHaveActive,
205
+        value: data.cityId,
206
+        rules: [
207
+          { required: true, message: '请选择展示城市' },
208
+        ],
209
+      },
210
+      {
211
+        label: '开屏广告',
212
+        name: 'image',
213
+        type: FieldTypes.ImageUploader,
214
+        value: data.image,
215
+        help: '建议图片尺寸:640*960px,比例2:3,格式:jpg,用于开屏广告',
216
+        rules: [
217
+          { required: true, message: '请上传图片' },
218
+        ],
219
+      },
220
+      {
221
+        label: '类型',
222
+        name: 'contentType',
223
+        type: FieldTypes.Select,
224
+        hidden: () => isHaveActive,
225
+        dict: [{
226
+          label: 'H5活动详情',
227
+          value: 'h5',
228
+        },
229
+        {
230
+          label: '直播活动详情',
231
+          value: 'live',
232
+        },
233
+        {
234
+          label: '其它',
235
+          value: 'others',
236
+        }],
237
+        value: data.contentType,
238
+        rules: [
239
+          { required: true, message: '请选择类型' },
240
+        ],
241
+      },
242
+      {
243
+        label: '标题',
244
+        name: 'title',
245
+        type: FieldTypes.Text,
246
+        hidden: true,
247
+        value: data.title,
248
+        rules: [
249
+          { required: true, message: '请输入标题' },
250
+        ],
251
+      },
252
+      {
253
+        label: '类型',
254
+        name: 'contentType',
255
+        hidden: () => !isHaveActive,
256
+        type: FieldTypes.Select,
257
+        dict: [{
258
+          label: '报名活动详情',
259
+          value: 'activity'
260
+        },
261
+        {
262
+          label: '项目详情',
263
+          value: 'project'
264
+        },
265
+        {
266
+          label: '资讯详情',
267
+          value: 'news'
268
+        },
269
+        {
270
+          label: '拼团活动详情',
271
+          value: 'group'
272
+        },
273
+        {
274
+          label: '助力活动详情',
275
+          value: 'help'
276
+        },
277
+        {
278
+          label: 'H5活动详情',
279
+          value: 'h5',
280
+        },
281
+        {
282
+          label: '在线选房详情',
283
+          value: 'salesBatch',
284
+        },
285
+        {
286
+          label: '直播活动详情',
287
+          value: 'live',
288
+        },
289
+        {
290
+          label: '其它',
291
+          value: 'others',
292
+        }],
293
+        value: data.contentType,
294
+        rules: [
295
+          { required: true, message: '请选择类型' },
296
+        ],
297
+      },
298
+      {
299
+        label: '发布H5活动',
300
+        name: 'targetId',
301
+        render: <SelectH5 buildingId={() => islet ? buildingId : ''} />,
302
+        hidden: () => !h5Visible,
303
+        value: data.targetId,
304
+        rules: [
305
+          { required: true, message: '请选择发布H5' },
306
+        ],
307
+      },
308
+      {
309
+        label: '发布活动',
310
+        name: 'targetId',
311
+        render: <SelectActivity buildingId={() => buildingId} />,
312
+        hidden: () => !activityVisible,
313
+        value: data.targetId,
314
+        rules: [
315
+          { required: true, message: '请选择发布活动' },
316
+        ],
317
+      },
318
+      {
319
+        label: '发布资讯',
320
+        name: 'targetId',
321
+        render: <SelectNews buildingId={() => buildingId} />,
322
+        hidden: () => !newsVisible,
323
+        value: data.targetId,
324
+        rules: [
325
+          { required: true, message: '请选择发布资讯' },
326
+        ],
327
+      },
328
+      {
329
+        label: '发布内容',
330
+        name: 'content',
331
+        render: <Wangedit />,
332
+        value: data.content,
333
+        hidden: () => !contentVisible,
334
+        rules: [
335
+          { required: true, message: '请选择发布内容' },
336
+        ],
337
+      },
338
+      {
339
+        label: '发布助力',
340
+        name: 'targetId',
341
+        render: <SelectHelp buildingId={() => buildingId} />,
342
+        hidden: () => !helpVisible,
343
+        value: data.targetId,
344
+        rules: [
345
+          { required: true, message: '请选择发布助力' },
346
+        ],
347
+      },
348
+      {
349
+        label: '发布拼团',
350
+        name: 'targetId',
351
+        render: <SelectGroup buildingId={() => buildingId} />,
352
+        hidden: () => !groupVisible,
353
+        value: data.targetId,
354
+        rules: [
355
+          { required: true, message: '请选择发布拼团' },
356
+        ],
357
+      },
358
+      {
359
+        label: '发布销售批次',
360
+        name: 'targetId',
361
+        render: <SalesBatchGroup buildingId={() => buildingId} />,
362
+        hidden: () => !salesBatchVisible,
363
+        value: data.targetId,
364
+        rules: [
365
+          { required: true, message: '请选择发布销售批次' },
366
+        ],
367
+      },
368
+      {
369
+        label: '发布直播活动',
370
+        name: 'targetId',
371
+        render: <LiveGroup buildingId={() => islet ? buildingId : ''} />,
372
+        hidden: () => !liveVisible,
373
+        value: data.targetId,
374
+        rules: [
375
+          { required: true, message: '请选择发布直播活动' },
376
+        ],
377
+      },
378
+      {
379
+        label: '状态',
380
+        name: 'status',
381
+        type: FieldTypes.Select,
382
+        dict: [{
383
+          label: "上架",
384
+          value: 1
385
+        },
386
+        {
387
+          label: "下架",
388
+          value: 0
389
+        },],
390
+        value: data.status != null ? data.status : 1,
391
+      },
392
+    ]
393
+
394
+    const handleSubmit = val => {
395
+      val.showType = 'screen'
396
+      if (!isHaveActive && val.targetId) {
397
+        if (!val.contentType) {
398
+          val.contentType = 'h5'
399
+        }
400
+      }
401
+      if (!isHaveActive && !val.targetId) {
402
+        val.contentType = ''
403
+      }
404
+      if (contentId) {
405
+        request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: contentId }, data: val, }).then((data) => {
406
+          cancelPage()
407
+        }).catch((err) => {
408
+          message.info(err.msg || err.message)
409
+        })
410
+      } else {
411
+        request({ ...apis.carsuseFigure.addExtendContent, data: val, }).then((data) => {
412
+          cancelPage()
413
+        }).catch((err) => {
414
+          message.info(err.msg || err.message)
415
+        })
416
+      }
417
+    }
418
+
419
+
420
+    return (
421
+      <XForm wrappedComponentRef={formRef} onSubmit={handleSubmit} onCancel={cancelPage} onValuesChange={handleFormValueChange} fields={fields}></XForm>
422
+    );
423
+  }
424
+}
425
+
426
+export default createEditor()

+ 393
- 0
estateagents-admin-manager/src/pages/carouselFigure/editCarousel.jsx Ver arquivo

@@ -0,0 +1,393 @@
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 moment from 'moment';
5
+import router from 'umi/router';
6
+import styles from '../style/GoodsList.less';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect2'
8
+import CitySelect from '../../components/SelectButton/CitySelect2'
9
+import { createForm, FieldTypes } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit'
11
+import apis from '../../services/apis';
12
+import request from '../../utils/request'
13
+import SelectHelp from './SelectHelp';
14
+import SelectGroup from './SelectGroup';
15
+import SalesBatchGroup from './SalesBatchGroup';
16
+import LiveGroup from './LiveGroup';
17
+import SelectNews from './SelectNews';
18
+import SelectActivity from './SelectActivity';
19
+import SelectH5 from './SelectH5';
20
+
21
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
22
+/**
23
+ *
24
+ *
25
+ * @param {*} props
26
+ * @returns
27
+ */
28
+ const Edit = props => {
29
+  let contentVisible = false
30
+  let activityVisible = false
31
+  let newsVisible = false
32
+  let helpVisible = false
33
+  let groupVisible = false
34
+  let salesBatchVisible = false
35
+  let liveVisible = false
36
+  let h5Visible = false
37
+  let buildingId = ''
38
+  let cityId=''
39
+  let locationType = false
40
+  let isHaveActive=false
41
+  let isCanChoose=true
42
+
43
+  const setExtraData = (data) => {
44
+    console.log(data, 'data');
45
+    if(data.isHaveActive!=undefined){
46
+      isHaveActive=data.isHaveActive
47
+      if(!isHaveActive) {
48
+        // data.contentType=null
49
+        data.buildingId=null
50
+      }
51
+    }
52
+
53
+    contentVisible = data.contentType === 'other';
54
+    activityVisible = data.contentType === 'activity';
55
+    newsVisible = data.contentType === 'news';
56
+    helpVisible = data.contentType === 'help';
57
+    groupVisible = data.contentType === 'group';
58
+    salesBatchVisible = data.contentType === 'salesBatch';
59
+    liveVisible = data.contentType === 'live';
60
+    h5Visible = data.contentType === 'h5';
61
+
62
+    cityId=data.cityId
63
+    buildingId = data.buildingId
64
+    locationType = data.showPosition === 'mall';
65
+    console.log(locationType, 'locationType');
66
+  }
67
+
68
+  const setExtraData1 = (data) => {
69
+     if((data.contentType=='h5'  && data.buildingId == null) || data.contentType==''||data.contentType=='nothing' || (data.contentType=='live' && data.buildingId == null)){
70
+        isHaveActive=false
71
+     }else{
72
+        isHaveActive=true
73
+     }
74
+
75
+    contentVisible = data.contentType === 'other';
76
+    activityVisible = data.contentType === 'activity';
77
+    newsVisible = data.contentType === 'news';
78
+    helpVisible = data.contentType === 'help';
79
+    groupVisible = data.contentType === 'group';
80
+    salesBatchVisible = data.contentType === 'salesBatch';
81
+    liveVisible = data.contentType === 'live';
82
+    buildingId = data.buildingId
83
+    locationType = data.showPosition === 'mall';
84
+    h5Visible = data.contentType === 'h5';
85
+    console.log(locationType, 'locationType');
86
+  }
87
+
88
+
89
+  const handleFormValueChange = (props, changedValues, allValues) => {
90
+      setExtraData(allValues)
91
+  }
92
+
93
+  const XForm = createForm({ onValuesChange: handleFormValueChange })
94
+
95
+  return props => {
96
+    const [tab, changeTab] = useState('basic')
97
+    const { contentId } = props.location.query
98
+    const [data, setData] = useState({})
99
+
100
+    if (contentId) {
101
+      isCanChoose=false
102
+      // eslint-disable-next-line react-hooks/rules-of-hooks
103
+      useEffect(() => {
104
+        getDetail(contentId);
105
+      }, [])
106
+
107
+      // 查询列表
108
+      const getDetail = contentId => {
109
+        request({ ...apis.carsuseFigure.getExtendContent, urlData: { id: contentId } }).then(data => {
110
+            console.log(data)
111
+            setExtraData1(data)
112
+            setData(data)
113
+        })
114
+      }
115
+    }else{
116
+      isCanChoose=true
117
+    }
118
+
119
+    const cancelPage = () => {
120
+      router.push({
121
+        pathname: '/carouselFigure/carouselFigureList',
122
+      });
123
+    }
124
+
125
+      const fields = [
126
+        {
127
+          label: '是否关联项目',
128
+          name: 'isHaveActive',
129
+          type: FieldTypes.Switch,
130
+          value:isHaveActive,
131
+          hidden: () => !isCanChoose,
132
+          rules: [
133
+            { required: true,message: '是否城市活动' },
134
+          ],
135
+        },
136
+        {
137
+          label: '所属项目',
138
+          name: 'buildingId',
139
+          render: <BuildSelect />,
140
+          hidden: () => !isHaveActive,
141
+          value: data.buildingId,
142
+          rules: [
143
+            { required: true, message: '请选择所属项目' },
144
+          ],
145
+        },
146
+        {
147
+          label: '展示城市',
148
+          name: 'cityId',
149
+          render: <CitySelect />,
150
+          hidden: () => isHaveActive,
151
+          value: data.cityId,
152
+          rules: [
153
+            { required: true, message: '请选择展示城市' },
154
+          ],
155
+        },
156
+        {
157
+          label: '发布位置',
158
+          name: 'showPosition',
159
+          type: FieldTypes.Select,
160
+          dict: [{
161
+            label: '首页',
162
+            value: 'index',
163
+          },
164
+          {
165
+            label: '积分商城',
166
+            value: 'mall',
167
+          }],
168
+          value: data.showPosition,
169
+          rules: [
170
+            { required: true, message: '请选择发布位置' },
171
+          ],
172
+        },
173
+        {
174
+          label: () => (locationType ? '积分商城轮播图' : '首页轮播图'),
175
+          name: 'image',
176
+          type: FieldTypes.ImageUploader,
177
+          value: data.image,
178
+          help: () => (locationType ? '建议图片尺寸:750*250px,比例3:1,格式:jpg,用于积分商城banner轮播' : '建议图片尺寸:750*464px,比例1.:0.618,格式:jpg,用于:首页顶部banner轮播'),
179
+          rules: [
180
+            { required: true, message: '请上传轮播图' },
181
+          ],
182
+        },
183
+        {
184
+          label: '类型',
185
+          name: 'contentType',
186
+          type: FieldTypes.Select,
187
+          hidden: () => isHaveActive,
188
+          dict: [{
189
+            label: 'h5',
190
+            value: 'h5',
191
+          },
192
+          {
193
+            label: '直播活动详情',
194
+            value: 'live',
195
+          }],
196
+          value: data.contentType,
197
+          rules: [
198
+            { required: true, message: '请选择类型' },
199
+          ],
200
+        },
201
+        {
202
+          label: '标题',
203
+          name: 'title',
204
+          type: FieldTypes.Text,
205
+          value: data.title,
206
+          hidden: true,
207
+          rules: [
208
+            { required: true, message: '请输入标题' },
209
+          ],
210
+        },
211
+        {
212
+          label: '类型',
213
+          name: 'contentType',
214
+          type: FieldTypes.Select,
215
+          hidden: () => !isHaveActive,
216
+          dict: [{
217
+            label: '常规活动',
218
+            value: 'activity',
219
+          },
220
+          {
221
+            label: '项目',
222
+            value: 'project',
223
+          },
224
+          {
225
+            label: '资讯',
226
+            value: 'news',
227
+          },
228
+          // {
229
+          //   label: '其他',
230
+          //   value: 'other',
231
+          // },
232
+          {
233
+            label: '拼团',
234
+            value: 'group',
235
+          },
236
+          {
237
+            label: '助力',
238
+            value: 'help',
239
+          },
240
+          {
241
+            label: 'h5',
242
+            value: 'h5',
243
+          },
244
+          {
245
+            label: '销售批次详情',
246
+            value: 'salesBatch',
247
+          },
248
+          {
249
+            label: '直播活动详情',
250
+            value: 'live',
251
+          }],
252
+          value: data.contentType,
253
+          rules: [
254
+            { required: true, message: '请选择类型' },
255
+          ],
256
+        },
257
+        {
258
+          label: '发布活动',
259
+          name: 'targetId',
260
+          render: <SelectActivity buildingId={() => buildingId} />,
261
+          hidden: () => !activityVisible,
262
+          value: data.targetId,
263
+          rules: [
264
+            { required: true, message: '请选择发布活动' },
265
+          ],
266
+        },
267
+        {
268
+          label: '是否发布H5',
269
+          name: 'targetId',
270
+          render: <SelectH5 buildingId={() => buildingId}/>,
271
+          hidden: () => !h5Visible,
272
+          value: data.targetId,
273
+          rules: [
274
+            { required: false, message: '请选择发布H5' },
275
+          ],
276
+        },
277
+        {
278
+          label: '发布资讯',
279
+          name: 'targetId',
280
+          render: <SelectNews buildingId={() => buildingId} />,
281
+          hidden: () => !newsVisible,
282
+          value: data.targetId,
283
+          rules: [
284
+            { required: true, message: '请选择发布资讯' },
285
+          ],
286
+        },
287
+        {
288
+          label: '发布内容',
289
+          name: 'content',
290
+          render: <Wangedit />,
291
+          value: data.content,
292
+          hidden: () => !contentVisible,
293
+          rules: [
294
+            { required: true, message: '请输入发布内容' },
295
+          ],
296
+        },
297
+        {
298
+          label: '发布助力',
299
+          name: 'targetId',
300
+          render: <SelectHelp buildingId={() => buildingId} />,
301
+          hidden: () => !helpVisible,
302
+          value: data.targetId,
303
+          rules: [
304
+            { required: true, message: '请选择发布助力' },
305
+          ],
306
+        },
307
+        {
308
+          label: '发布拼团',
309
+          name: 'targetId',
310
+          render: <SelectGroup buildingId={() => buildingId} />,
311
+          hidden: () => !groupVisible,
312
+          value: data.targetId,
313
+          rules: [
314
+            { required: true, message: '请选择发布拼团' },
315
+          ],
316
+        },
317
+        {
318
+          label: '发布销售批次',
319
+          name: 'targetId',
320
+          render: <SalesBatchGroup buildingId={() => buildingId} />,
321
+          hidden: () => !salesBatchVisible,
322
+          value: data.targetId,
323
+          rules: [
324
+            { required: true, message: '请选择发布销售批次' },
325
+          ],
326
+        },
327
+        {
328
+          label: '发布直播活动',
329
+          name: 'targetId',
330
+          render: <LiveGroup buildingId={() => buildingId} />,
331
+          hidden: () => !liveVisible,
332
+          value: data.targetId, 
333
+          rules: [
334
+            { required: true, message: '请选择发布直播活动' },
335
+          ],
336
+        },
337
+        {
338
+          label: '状态',
339
+          name: 'status',
340
+          type: FieldTypes.Select,
341
+          dict: [{
342
+            label: '上架',
343
+            value: 1,
344
+          },
345
+          {
346
+            label: '下架',
347
+            value: 0,
348
+          }],
349
+          value: data.status != null ? data.status : 1,
350
+        },
351
+        {
352
+          label: '权重',
353
+          name: 'orderNo',
354
+          type: FieldTypes.Number,
355
+          value: data.orderNo,
356
+          help: "数值越大越靠前",
357
+        },
358
+      ]
359
+
360
+      const handleSubmit = val => {
361
+        console.log(val,"232323")
362
+        val.showType = 'banner'
363
+        if(!isHaveActive&&val.targetId) {
364
+          if(!val.contentType){
365
+            val.contentType='h5'
366
+          }
367
+        }
368
+        if(!isHaveActive&&!val.targetId){
369
+          val.contentType=''
370
+        }
371
+        if (contentId) {
372
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: contentId }, data: val }).then(data => {
373
+            cancelPage()
374
+          }).catch(err => {
375
+            message.info(err.msg || err.message)
376
+          })
377
+        } else {
378
+          request({ ...apis.carsuseFigure.addExtendContent, data: val }).then(data => {
379
+            cancelPage()
380
+          }).catch(err => {
381
+            message.info(err.msg || err.message)
382
+          })
383
+        }
384
+      }
385
+
386
+    return (
387
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
388
+    );
389
+  }
390
+ }
391
+
392
+
393
+export default Edit()

+ 361
- 0
estateagents-admin-manager/src/pages/carouselFigure/propaganda.jsx Ver arquivo

@@ -0,0 +1,361 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Modal, 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/BuildSelect2'
8
+import CitySelect from '../../components/SelectButton/CitySelect2'
9
+import { FieldTypes, createForm } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit';
11
+import SelectActivity from './SelectActivity';
12
+import SelectNews from './SelectNews';
13
+import apis from '../../services/apis';
14
+import request from '../../utils/request'
15
+import SelectHelp from './SelectHelp';
16
+import SelectGroup from './SelectGroup';
17
+import SelectH5 from './SelectH5';
18
+import SalesBatchGroup from './SalesBatchGroup';
19
+import LiveGroup from './LiveGroup';
20
+/**
21
+ *
22
+ *
23
+ * @param {*} props
24
+ * @returns
25
+ */
26
+ const createEditor = () => {
27
+  let contentVisible = false
28
+  let activityVisible = false
29
+  let newsVisible = false
30
+  let helpVisible = false
31
+  let groupVisible = false
32
+  let salesBatchVisible = false
33
+  let liveVisible = false
34
+  let h5Visible = false
35
+  let buildingId = ''
36
+  let cityId = ''
37
+  let isHaveActive=false
38
+  let isCanChoose=true
39
+
40
+  const setExtraData = (data) => {
41
+    if(data.isHaveActive!=undefined){
42
+      isHaveActive=data.isHaveActive
43
+      if(!isHaveActive) {
44
+        // data.contentType=null
45
+        data.buildingId=null
46
+      }
47
+    }
48
+
49
+    contentVisible = data.contentType === 'other';
50
+    activityVisible = data.contentType === 'activity';
51
+    newsVisible = data.contentType === 'news';
52
+    helpVisible = data.contentType === 'help';
53
+    groupVisible = data.contentType === 'group';
54
+    salesBatchVisible = data.contentType === 'salesBatch';
55
+    liveVisible = data.contentType === 'live';
56
+    h5Visible = data.contentType === 'h5';
57
+    cityId=data.cityId
58
+    buildingId = data.buildingId
59
+  }
60
+
61
+  const setExtraData1 = (data) => {
62
+    console.log(data.buildingId,"data.buildingIddata.buildingId3")
63
+    if(data.contentType=='h5'||data.contentType==''||data.contentType=='nothing' || (data.contentType=='live' && data.buildingId == null)){
64
+       isHaveActive=false
65
+    }else{
66
+       isHaveActive=true
67
+    }
68
+
69
+    contentVisible = data.contentType === 'other';
70
+    activityVisible = data.contentType === 'activity';
71
+    newsVisible = data.contentType === 'news';
72
+    helpVisible = data.contentType === 'help';
73
+    groupVisible = data.contentType === 'group';
74
+    salesBatchVisible = data.contentType === 'salesBatch';
75
+    liveVisible = data.contentType === 'live';
76
+    h5Visible = data.contentType === 'h5';
77
+    buildingId = data.buildingId
78
+  }
79
+
80
+  const handleFormValueChange = (props, changedValues, allValues) => {
81
+      setExtraData(allValues)
82
+  }
83
+
84
+  const XForm = createForm({ onValuesChange: handleFormValueChange })
85
+
86
+  return (props) => {
87
+    const [ tab, changeTab ] = useState('basic')
88
+    const contentId = props.location.query.contentId
89
+    const [ data, setData ] = useState({})
90
+
91
+    if(contentId){
92
+      isCanChoose=false
93
+      useEffect(() => {
94
+        getDetail(contentId);
95
+      },[])
96
+
97
+      // 查询列表
98
+      const getDetail = (contentId) => {
99
+        request({ ...apis.carsuseFigure.getExtendContent,urlData:{id: contentId}}).then((data) => {
100
+          setExtraData1(data)
101
+          setData(data)
102
+        })
103
+      }
104
+    }else{
105
+      isCanChoose=true
106
+    }
107
+
108
+    const cancelPage = () =>{
109
+      router.push({
110
+        pathname: '/carouselFigure/propagandaList',
111
+      });
112
+    }
113
+
114
+    const fields = [
115
+      {
116
+        label: '是否关联项目',
117
+        name: 'isHaveActive',
118
+        type: FieldTypes.Switch,
119
+        value:isHaveActive,
120
+        hidden: () => !isCanChoose,
121
+        rules: [
122
+          { required: true,message: '是否城市活动' },
123
+        ],
124
+      },
125
+      {
126
+        label: '所属项目',
127
+        name: 'buildingId',
128
+        render: <BuildSelect />,
129
+        value: data.buildingId,
130
+        hidden: () => !isHaveActive,
131
+        rules: [
132
+          { required: true, message: '请选择所属项目' },
133
+        ],
134
+      },
135
+      {
136
+        label: '所属城市',
137
+        name: 'cityId',
138
+        render: <CitySelect />,
139
+        hidden: () => isHaveActive,
140
+        value: data.cityId,
141
+        rules: [
142
+          { required: true, message: '请选择展示城市' },
143
+        ],
144
+      },
145
+      {
146
+        label: '主图',
147
+        name: 'image',
148
+        type: FieldTypes.ImageUploader,
149
+        value: data.image,
150
+        help: '建议图片尺寸:750*188px,比例4:1,格式:jpg,用于:首页宣传位',
151
+        rules: [
152
+          { required: true, message: '请上传图片' },
153
+        ],
154
+      },
155
+      {
156
+        label: '类型',
157
+        name: 'contentType',
158
+        type: FieldTypes.Select,
159
+        hidden: () => isHaveActive,
160
+        dict: [{
161
+          label: 'h5',
162
+          value: 'h5',
163
+        },
164
+        {
165
+          label: '直播活动详情',
166
+          value: 'live',
167
+        }],
168
+        value: data.contentType,
169
+        rules: [
170
+          { required: true, message: '请选择类型' },
171
+        ],
172
+      },
173
+      {
174
+        label: '标题',
175
+        name: 'title',
176
+        type: FieldTypes.Text,
177
+        hidden: true,
178
+        value: data.title,
179
+        rules: [
180
+          { required: true, message: '请输入标题' },
181
+        ],
182
+      },
183
+      {
184
+        label: '类型',
185
+        name: 'contentType',
186
+        hidden: () => !isHaveActive,
187
+        type: FieldTypes.Select,
188
+        dict: [{
189
+          label: '常规活动',
190
+          value: 'activity'
191
+        },
192
+        {
193
+          label: '项目',
194
+          value: 'project'
195
+        },
196
+        {
197
+          label: '资讯',
198
+          value: 'news'
199
+        },
200
+        {
201
+          label: '拼团',
202
+          value: 'group'
203
+        },
204
+        {
205
+          label: '助力',
206
+          value: 'help'
207
+        },
208
+        {
209
+          label: 'h5',
210
+          value: 'h5',
211
+        },
212
+        {
213
+          label: '销售批次详情',
214
+          value: 'salesBatch',
215
+        },
216
+        {
217
+          label: '直播活动详情',
218
+          value: 'live',
219
+        }],
220
+        value: data.contentType,
221
+        rules: [
222
+          { required: true, message: '请选择类型' },
223
+        ],
224
+      },
225
+      {
226
+        label: '发布活动',
227
+        name: 'targetId',
228
+        render: <SelectActivity buildingId={() => buildingId} />,
229
+        hidden: () => !activityVisible,
230
+        value: data.targetId,
231
+        rules: [
232
+          { required: true, message: '请选择发布活动' },
233
+        ],
234
+      },
235
+      {
236
+        label: '发布资讯',
237
+        name: 'targetId',
238
+        render: <SelectNews buildingId={() => buildingId} />,
239
+        hidden: () => !newsVisible,
240
+        value: data.targetId,
241
+        rules: [
242
+          { required: true, message: '请选择发布资讯' },
243
+        ],
244
+      },
245
+      {
246
+        label: '发布内容',
247
+        name: 'content',
248
+        render: <Wangedit />,
249
+        value: data.content,
250
+        hidden: () => !contentVisible,
251
+        rules: [
252
+          { required: true, message: '请选择发布内容' },
253
+        ],
254
+      },
255
+      {
256
+        label: '发布助力',
257
+        name: 'targetId',
258
+        render: <SelectHelp buildingId={() => buildingId} />,
259
+        hidden: () => !helpVisible,
260
+        value: data.targetId,
261
+        rules: [
262
+          { required: true, message: '请选择发布助力' },
263
+        ],
264
+      },
265
+      {
266
+        label: '是否发布H5',
267
+        name: 'targetId',
268
+        render: <SelectH5 buildingId={() => buildingId}/>,
269
+        hidden: () => !h5Visible,
270
+        value: data.targetId,
271
+        rules: [
272
+          { required: false, message: '请选择发布H5' },
273
+        ],
274
+      },
275
+      {
276
+        label: '发布拼团',
277
+        name: 'targetId',
278
+        render: <SelectGroup buildingId={() => buildingId} />,
279
+        hidden: () => !groupVisible,
280
+        value: data.targetId,
281
+        rules: [
282
+          { required: true, message: '请选择发布拼团' },
283
+        ],
284
+      },
285
+      {
286
+        label: '发布销售批次',
287
+        name: 'targetId',
288
+        render: <SalesBatchGroup buildingId={() => buildingId} />,
289
+        hidden: () => !salesBatchVisible,
290
+        value: data.targetId,
291
+        rules: [
292
+          { required: true, message: '请选择发布销售批次' },
293
+        ],
294
+      },
295
+      {
296
+        label: '发布直播活动',
297
+        name: 'targetId',
298
+        render: <LiveGroup buildingId={() => buildingId} />,
299
+        hidden: () => !liveVisible,
300
+        value: data.targetId,
301
+        rules: [
302
+          { required: true, message: '请选择发布直播活动' },
303
+        ],
304
+      },
305
+      {
306
+        label: '状态',
307
+        name: 'status',
308
+        type: FieldTypes.Select,
309
+        dict: [{
310
+          label: "上架",
311
+          value: 1
312
+        },
313
+        {
314
+          label: "下架",
315
+          value: 0
316
+        },],
317
+        value: data.status != null ? data.status : 1,
318
+      },
319
+      {
320
+        label: '权重',
321
+        name: 'orderNo',
322
+        type: FieldTypes.Number,
323
+        value: data.orderNo,
324
+        help: "数值越大越靠前",
325
+      },
326
+    ]
327
+
328
+    const handleSubmit = val => {
329
+      console.log(val,"valvalval")
330
+      val.showType = 'propaganda'
331
+      if(!isHaveActive&&val.targetId) {
332
+          if(!val.contentType){
333
+            val.contentType='h5'
334
+          }
335
+      }
336
+      if(!isHaveActive&&!val.targetId){
337
+        val.contentType=''
338
+      }
339
+      if(contentId){
340
+        request({ ...apis.carsuseFigure.updataExtendContent,urlData:{id: contentId}, data: val,}).then((data) => {
341
+          cancelPage()
342
+        }).catch((err) => {
343
+          message.info(err.msg || err.message)
344
+        })
345
+      }else{
346
+        request({ ...apis.carsuseFigure.addExtendContent, data: val,}).then((data) => {
347
+          cancelPage()
348
+        }).catch((err) => {
349
+          message.info(err.msg || err.message)
350
+        })
351
+      }
352
+    }
353
+
354
+
355
+    return (
356
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} onValuesChange={handleFormValueChange} fields={fields}></XForm>
357
+    );
358
+   }
359
+ }
360
+
361
+export default createEditor()

+ 284
- 0
estateagents-admin-manager/src/pages/carouselFigure/propagandaList.jsx Ver arquivo

@@ -0,0 +1,284 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
3
+import router from 'umi/router';
4
+import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import EditIcon from '@/components/EditIcon';
7
+import withActions from '@/components/ActionList';
8
+import Navigate from '@/components/Navigate';
9
+import SelectCity from '../../components/SelectButton/CitySelect'
10
+import BuildSelect from '../../components/SelectButton/BuildSelect'
11
+import apis from '../../services/apis';
12
+import request from '../../utils/request';
13
+import styles from '../style/GoodsList.less';
14
+
15
+const { Option } = Select;
16
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17
+
18
+const header = (props) => {
19
+  const [data, setData] = useState({})
20
+  //   const [page, changePage] = useState({})
21
+
22
+  useEffect(() => {
23
+    getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' });
24
+  }, [])
25
+
26
+  // 查询列表
27
+  const getList = (params) => {
28
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params }, }).then((data) => {
29
+      console.log(data)
30
+      setData(data)
31
+    })
32
+  }
33
+
34
+
35
+  // 跳转到编辑商品
36
+  const toEdit = (contentId) => () => {
37
+    router.push({
38
+      pathname: '/carouselFigure/propaganda',
39
+      query: {
40
+        contentId
41
+      },
42
+    });
43
+  }
44
+
45
+  const columns = [
46
+    {
47
+      title: '主图',
48
+      dataIndex: 'image',
49
+      key: 'image',
50
+      align: 'center',
51
+      render: (image,row) => <Navigate onClick={toEdit(row.contentId)} ><img src={image} className={styles.propaganda} /></Navigate>,
52
+    },
53
+    {
54
+      title: '发布城市',
55
+      dataIndex: 'cityName',
56
+      key: 'cityName',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '关联项目',
61
+      dataIndex: 'buildingName',
62
+      key: 'buildingName',
63
+      align: 'center',
64
+      render: (buildingName) => <span>{buildingName === null ? '无' : buildingName}</span>
65
+    },
66
+    {
67
+      title: '关联内容类型',
68
+      dataIndex: 'contentType',
69
+      key: 'contentType',
70
+      align: 'center',
71
+      render: (contentType) => <span>{contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' :
72
+        contentType === 'help' ? '助力' : contentType === 'group' ? '拼团' : contentType === 'h5' ? 'H5活动' : contentType === 'salesBatch' ? '销售批次详情' : contentType === 'live' ? '直播活动详情' : '无'}</span>
73
+    },
74
+    // {
75
+    //   title: '发布位置',
76
+    //   dataIndex: 'showPosition',
77
+    //   key: 'showPosition',
78
+    //   align: 'center',
79
+    //   render: (showPosition) => <span>{ showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : '' }</span>
80
+    // },
81
+    {
82
+      title: '发布时间',
83
+      dataIndex: 'createDate',
84
+      key: 'createDate',
85
+      align: 'center',
86
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
87
+    },
88
+    {
89
+      title: '状态',
90
+      dataIndex: 'status',
91
+      key: 'status',
92
+      align: 'center',
93
+      render: (status) => <><span>{status == 1 ? '上架' : '下架'}</span></>
94
+    },
95
+    {
96
+      title: '操作',
97
+      dataIndex: 'handle',
98
+      key: 'handle',
99
+      align: 'center',
100
+      render: withActions((x, row) => [
101
+        <AuthButton name="admin.propaganda.publish" noRight={null}>
102
+          <EditIcon text={row.status === 1 ? '下架': '上架'} type={row.status === 1 ? 'down': 'up'} onClick={changeStatus(row)} />
103
+        </AuthButton>,
104
+        <AuthButton name="admin.propaganda.put" noRight={null}>
105
+          <EditIcon text="编辑" type="edit" onClick={toEdit(row.contentId)} />
106
+        </AuthButton>,
107
+        <AuthButton name="admin.propaganda.delete" noRight={null}>
108
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
109
+        </AuthButton>,
110
+      ])
111
+    },
112
+  ];
113
+
114
+  const finishDynamic = (row) => {
115
+    Modal.confirm({
116
+      title: '结束以后将无法编辑, 是否继续?',
117
+      okText: '确定',
118
+      cancelText: '取消',
119
+      onOk() {
120
+        request({ ...apis.carsuseFigure.finish, data: { dynamicId: row.dynamicId, top: "" }, }).then((data) => {
121
+          console.log(data)
122
+          message.info('操作成功!')
123
+          getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' })
124
+        }).catch((err) => {
125
+          console.log(err)
126
+          message.info(err.msg || err.message)
127
+        })
128
+      },
129
+    });
130
+  }
131
+
132
+  //删除
133
+  const deleteCarouse = (contentId) => () => {
134
+    Modal.confirm({
135
+      title: '确认删除此数据?',
136
+      okText: '确定',
137
+      cancelText: '取消',
138
+      onOk() {
139
+        request({ ...apis.carsuseFigure.deleteExtendContent, urlData: { id: contentId } }).then((data) => {
140
+          message.info('操作成功!')
141
+          getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' })
142
+        }).catch((err) => {
143
+          console.log(err)
144
+          message.info(err.msg || err.message)
145
+        })
146
+      },
147
+    });
148
+  }
149
+
150
+  //   停用启用
151
+  const changeStatus = (row) => () => {
152
+    console.log(row)
153
+    if (row.status === 0) {
154
+
155
+      Modal.confirm({
156
+        title: '确认发布此数据?',
157
+        okText: '确定',
158
+        cancelText: '取消',
159
+        onOk() {
160
+          row.status = 1
161
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
162
+            message.info('操作成功!')
163
+            getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' })
164
+          }).catch((err) => {
165
+            console.log(err)
166
+            message.info(err.msg || err.message)
167
+          })
168
+        },
169
+      });
170
+    } else if (row.status === 1) {
171
+
172
+      Modal.confirm({
173
+        title: '停用后不会再显示在小程序端',
174
+        okText: '确定',
175
+        cancelText: '取消',
176
+        onOk() {
177
+          row.status = 0
178
+          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
179
+            message.info('操作成功!')
180
+            getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' })
181
+          }).catch((err) => {
182
+            console.log(err)
183
+            message.info(err.msg || err.message)
184
+          })
185
+        },
186
+      });
187
+    }
188
+
189
+  }
190
+
191
+  const changePageNum = (pageNumber, props) => {
192
+    props.form.validateFields((err, values) => {
193
+      if (!err) {
194
+        getList({ pageNum: pageNumber, pageSize: 10, ...values, showType: 'propaganda' })
195
+      }
196
+    });
197
+  }
198
+
199
+  // 提交事件
200
+  const handleSubmit = (e, props) => {
201
+    e.preventDefault();
202
+    props.form.validateFields((err, values) => {
203
+      if (!err) {
204
+        console.log('提交数据: ', values)
205
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'propaganda' })
206
+      }
207
+    });
208
+  }
209
+
210
+  //重置搜索
211
+  function handleReset() {
212
+    props.form.resetFields();
213
+    getList({ pageNum: 1, pageSize: 10, showType: 'propaganda' });
214
+  }
215
+
216
+
217
+  const { getFieldDecorator } = props.form
218
+  return (
219
+
220
+    <>
221
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
222
+        <Form.Item>
223
+          {getFieldDecorator('cityId')(
224
+            <SelectCity />,
225
+          )}
226
+        </Form.Item>
227
+        <Form.Item>
228
+          {getFieldDecorator('buildingId')(
229
+            <BuildSelect />,
230
+          )}
231
+        </Form.Item>
232
+        <Form.Item>
233
+          {getFieldDecorator('contentType')(
234
+            <Select style={{ width: '180px' }} placeholder="类型">
235
+              <Option value="activity">活动</Option>
236
+              <Option value="project">项目</Option>
237
+              <Option value="news">资讯</Option>
238
+              <Option value="help">助力</Option>
239
+              <Option value="group">拼团</Option>
240
+              <Option value="h5">H5</Option>
241
+              <Option value="nothing">无</Option>
242
+            </Select>,
243
+          )}
244
+        </Form.Item>
245
+        {/* <Form.Item>
246
+          {getFieldDecorator('showPosition')(
247
+            <Select style={{ width: '180px' }} placeholder="发布位置">
248
+              <Option value="mall">商城</Option>
249
+              <Option value="index">首页</Option>
250
+            </Select>,
251
+          )}
252
+        </Form.Item> */}
253
+        <Form.Item>
254
+          {getFieldDecorator('status')(
255
+            <Select style={{ width: '180px' }} placeholder="状态">
256
+              <Option value="1">已上架</Option>
257
+              <Option value="0">已下架</Option>
258
+            </Select>,
259
+          )}
260
+        </Form.Item>
261
+        <Form.Item>
262
+          <AuthButton name="admin.advert.search" noRight={null}>
263
+            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
264
+              搜索
265
+          </Button>
266
+          </AuthButton>
267
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
268
+            重置
269
+            </Button>
270
+        </Form.Item>
271
+      </Form>
272
+      <AuthButton name="admin.propaganda.post" noRight={null}>
273
+        <Button type="danger" className={styles.addBtn} onClick={toEdit()}>新增</Button>
274
+      </AuthButton>
275
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="advertisingList" />
276
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
277
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e, props)} current={data.current} />
278
+      </div>
279
+    </>
280
+  )
281
+}
282
+const WrappedHeader = Form.create({ name: 'header' })(header);
283
+
284
+export default WrappedHeader