张延森 3 年之前
父節點
當前提交
6f167681f6
共有 30 個檔案被更改,包括 988 行新增20 行删除
  1. 二進制
      src/assets/touxiang.jpg
  2. 45
    0
      src/components/Poster/Form.jsx
  3. 34
    0
      src/components/Poster/Preview.jsx
  4. 25
    0
      src/components/Poster/index.jsx
  5. 25
    0
      src/components/Poster/style.less
  6. 41
    0
      src/components/Share/index.jsx
  7. 9
    4
      src/components/TableList/index.jsx
  8. 39
    0
      src/pages/building/Edit/AlbumList/Form.jsx
  9. 30
    0
      src/pages/building/Edit/AlbumList/List.jsx
  10. 18
    0
      src/pages/building/Edit/AlbumList/index.jsx
  11. 78
    0
      src/pages/building/Edit/Apartment/Form.jsx
  12. 61
    0
      src/pages/building/Edit/Apartment/List.jsx
  13. 18
    0
      src/pages/building/Edit/Apartment/index.jsx
  14. 53
    0
      src/pages/building/Edit/Basic/getData.js
  15. 6
    6
      src/pages/building/Edit/Basic/index.jsx
  16. 35
    0
      src/pages/building/Edit/Channel.jsx
  17. 45
    0
      src/pages/building/Edit/News/Form.jsx
  18. 44
    0
      src/pages/building/Edit/News/List.jsx
  19. 18
    0
      src/pages/building/Edit/News/index.jsx
  20. 61
    0
      src/pages/building/Edit/Panorama/Form.jsx
  21. 47
    0
      src/pages/building/Edit/Panorama/List.jsx
  22. 18
    0
      src/pages/building/Edit/Panorama/index.jsx
  23. 83
    0
      src/pages/building/Edit/SpecialRoom/Form.jsx
  24. 56
    0
      src/pages/building/Edit/SpecialRoom/List.jsx
  25. 18
    0
      src/pages/building/Edit/SpecialRoom/index.jsx
  26. 1
    1
      src/pages/building/Edit/components/Amap/index.jsx
  27. 17
    0
      src/pages/building/Edit/components/InputNumber.jsx
  28. 24
    0
      src/pages/building/Edit/components/ModalForm/index.jsx
  29. 38
    8
      src/pages/building/Edit/index.jsx
  30. 1
    1
      src/pages/document.ejs

二進制
src/assets/touxiang.jpg 查看文件


+ 45
- 0
src/components/Poster/Form.jsx 查看文件

@@ -0,0 +1,45 @@
1
+import React from 'react'
2
+import { Button, Form, Input } from 'antd'
3
+import ImageUpload from '@/components/XForm/ImageUpload'
4
+
5
+const formItemLayout = {
6
+  labelCol: {
7
+    xs: { span: 24 },
8
+    sm: { span: 3 },
9
+  },
10
+  wrapperCol: {
11
+    xs: { span: 24 },
12
+    sm: { span: 19 },
13
+  },
14
+}
15
+
16
+const PosterForm = (props) => {
17
+  const { form } = props
18
+  const { getFieldDecorator } = form
19
+
20
+  const handleImageChange = (img) => {
21
+    props.onImageChange(img)
22
+  }
23
+
24
+  return (
25
+    <Form {...formItemLayout}>
26
+      <Form.Item label="海报图" help="图片建议尺寸:1080*1925px,比例9:16,格式:jpg">
27
+      {getFieldDecorator('posterImg', {
28
+          rules: [{ required: true, message: '请楼盘海报图' }],
29
+      })(<ImageUpload onChange={handleImageChange} />)}
30
+      </Form.Item>
31
+      <Form.Item label="海报标题">
32
+      {getFieldDecorator('posterTitle')(<Input />)}
33
+      </Form.Item>
34
+      <Form.Item label="海报描述">
35
+      {getFieldDecorator('posterDescription')(<Input.TextArea row={4} />)}
36
+      </Form.Item>
37
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
38
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
39
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
40
+      </Form.Item>
41
+    </Form>
42
+  )
43
+}
44
+
45
+export default Form.create({})(PosterForm)

+ 34
- 0
src/components/Poster/Preview.jsx 查看文件

@@ -0,0 +1,34 @@
1
+import React, { useMemo } from 'react'
2
+import { Avatar, Row, Col, Empty, Typography } from 'antd'
3
+import Styles from './style.less'
4
+
5
+const { Title } = Typography;
6
+const qrStyle = {
7
+  width: '100%',
8
+  height: '100%',
9
+}
10
+
11
+export default (props) => {
12
+  const qrCode = useMemo(() => require('@/assets/xiaochengxu.png'), [])
13
+  const avatar = useMemo(() => require('@/assets/touxiang.jpg'), [])
14
+
15
+  return (
16
+    <div>
17
+      <div className={Styles.image}>
18
+        {
19
+          props.img ?
20
+            <img src={props.img} alt="" style={{width: '100%', height: '100%'}} /> :
21
+            <div style={{paddingTop: '200px'}}><Empty description="暂无海报图" /></div>
22
+        }
23
+      </div>
24
+      <Row gutter={24} style={{padding: '2em'}}>
25
+        <Col span={6}><Avatar size={78} src={avatar} /></Col>
26
+        <Col span={10}>
27
+          <Title level={4}>新联家</Title>
28
+          <div>长按识别看房</div>
29
+        </Col>
30
+        <Col span={8}><img src={qrCode} alt="" style={qrStyle} /></Col>
31
+      </Row>
32
+    </div>
33
+  )
34
+}

+ 25
- 0
src/components/Poster/index.jsx 查看文件

@@ -0,0 +1,25 @@
1
+import React, { useMemo, useState } from 'react'
2
+import { getImgURL } from '@/utils/image'
3
+import Preview from './Preview'
4
+import Form from './Form'
5
+import Styles from './style.less'
6
+
7
+export default (props) => {
8
+  const { target } = props
9
+  const { id: targetId, type: targetType } = target
10
+
11
+  const [poster, setPoster] = useState()
12
+
13
+  const posterImage = useMemo(() => (poster ? getImgURL(poster) : undefined), [poster]);
14
+
15
+  return (
16
+    <div className={Styles['building-poster']}>
17
+      <div className={Styles['poster-preview']}>
18
+        <Preview img={posterImage} />
19
+      </div>
20
+      <div className={Styles['poster-form']}>
21
+        <Form onImageChange={setPoster} />
22
+      </div>
23
+    </div>
24
+  )
25
+}

+ 25
- 0
src/components/Poster/style.less 查看文件

@@ -0,0 +1,25 @@
1
+.building-poster {
2
+  display: flex;
3
+  margin: 2em;
4
+
5
+  .poster-preview {
6
+    flex: none;
7
+    width: 375px;
8
+    height: 810px;
9
+    border: 1px solid rgba(0, 0, 0, 0.12);
10
+    box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px 3px;
11
+  
12
+    .image {
13
+      width: 100%;
14
+      height: 667px;
15
+      border: 0;
16
+      background: rgba(0, 0, 0, 0.05);
17
+    }
18
+  }
19
+
20
+  .poster-form {
21
+    flex: auto;
22
+    margin-left: 4em;
23
+    max-width: 800px;
24
+  }
25
+}

+ 41
- 0
src/components/Share/index.jsx 查看文件

@@ -0,0 +1,41 @@
1
+import React from 'react'
2
+import { Button, Form, Input } from 'antd'
3
+import ImageUpload from '@/components/XForm/ImageUpload'
4
+
5
+const formItemLayout = {
6
+  labelCol: {
7
+    xs: { span: 24 },
8
+    sm: { span: 3 },
9
+  },
10
+  wrapperCol: {
11
+    xs: { span: 24 },
12
+    sm: { span: 19 },
13
+  },
14
+}
15
+
16
+const ShareForm = (props) => {
17
+  const { target, form } = props
18
+  const { id: targetId, type: shareContentType } = target
19
+  const { getFieldDecorator } = form
20
+
21
+  return (
22
+    <Form {...formItemLayout}>
23
+      <Form.Item label="分享标题">
24
+      {getFieldDecorator('shareContentTitle', {
25
+        rules: [{required: true, message: '请填写分享标题'}]
26
+      })(<Input />)}
27
+      </Form.Item>
28
+      <Form.Item label="分享图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg">
29
+      {getFieldDecorator('posterImg', {
30
+          rules: [{ required: true, message: '请上传分享图' }],
31
+      })(<ImageUpload />)}
32
+      </Form.Item>
33
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
34
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
35
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
36
+      </Form.Item>
37
+    </Form>
38
+  )
39
+}
40
+
41
+export default Form.create({})(ShareForm)

+ 9
- 4
src/components/TableList/index.jsx 查看文件

@@ -10,9 +10,9 @@ export default React.forwardRef((props, ref) => {
10 10
   const mounted = useRef(false);
11 11
   const [list, setList] = useState();
12 12
   const [pageTotal, setPageTotal] = useState(0);
13
-  const [pageConfig, setPageConfig] = useState({ current: 1, pageSize: 10 });
14 13
 
15
-  const { api, urlData, params, onPageChange, postData=()=>{}, ...tableProps } = props;
14
+  const { api, urlData, params, onPageChange, postData=()=>{}, page, ...tableProps } = props;
15
+  const [pageConfig, setPageConfig] = useState({ current: 1, pageSize: !page ? 500 : 10, ...(page || {}) });
16 16
 
17 17
   // 更新分页
18 18
   const updatePage = useCallback(
@@ -37,9 +37,9 @@ export default React.forwardRef((props, ref) => {
37 37
 
38 38
 
39 39
     const queryParams = {
40
-      ...(postData(params) || params || {}),
41 40
       pageNum: pageConfig.current,
42 41
       pageSize: pageConfig.pageSize,
42
+      ...(postData(params) || params || {}),
43 43
     };
44 44
 
45 45
     request({ ...api, urlData: urlData || undefined, params: queryParams })
@@ -94,7 +94,12 @@ export default React.forwardRef((props, ref) => {
94 94
   return (
95 95
     <>
96 96
       <TableList loading={loading} dataSource={list} {...tableProps} />
97
-      <Pagination {...pageConfig} total={pageTotal} onChange={updatePage} />
97
+      {
98
+        props.page !== false &&
99
+        (
100
+          <Pagination {...pageConfig} total={pageTotal} onChange={updatePage} />
101
+        )
102
+      }
98 103
     </>
99 104
   );
100 105
 });

+ 39
- 0
src/pages/building/Edit/AlbumList/Form.jsx 查看文件

@@ -0,0 +1,39 @@
1
+import React from 'react'
2
+import { Button, Form, Input, Select } from 'antd'
3
+import ImageListUpload from '@/components/XForm/ImageListUpload'
4
+import ModalForm from '../components/ModalForm'
5
+
6
+const AMForm = (props) => {
7
+  const { visible, onCancel, form } = props
8
+  const { getFieldDecorator } = form
9
+
10
+  return (
11
+    <ModalForm
12
+      title="相册设置"
13
+      visible={visible}
14
+      onCancel={onCancel}
15
+    >
16
+      <Form.Item label="相册名称">
17
+        {getFieldDecorator('apartmentName', {
18
+          rules: [
19
+            { required: true, message: '请填写相册名称' },
20
+            { max: 10, message: '相册名称不超过10个字符' },
21
+          ],
22
+        })(<Input placeholder="相册名称不超过10个字符"/>)}
23
+      </Form.Item>
24
+      <Form.Item label="相册图片" help="建议图片尺寸750*600,比例5:4,格式:jpg">
25
+      {getFieldDecorator('img', {
26
+          rules: [{ required: true, message: '请上传相册图片' }],
27
+      })(
28
+        <ImageListUpload />,
29
+      )}
30
+      </Form.Item>
31
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
32
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
33
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
34
+      </Form.Item>
35
+    </ModalForm>
36
+  )
37
+}
38
+
39
+export default Form.create({})(AMForm)

+ 30
- 0
src/pages/building/Edit/AlbumList/List.jsx 查看文件

@@ -0,0 +1,30 @@
1
+import React from 'react'
2
+import { Button, Collapse, Popconfirm } from 'antd'
3
+
4
+const { Panel } = Collapse;
5
+
6
+const Extra = (props) => (
7
+  <>
8
+    <Button type="link" size="small" onClick={props.onRename}>重命名</Button>
9
+    <Popconfirm
10
+      title="Are you sure delete this task?"
11
+      onConfirm={props.onDelete}
12
+    >
13
+      <Button type="link" size="small" style={{color: 'red'}}>删除</Button>
14
+    </Popconfirm>    
15
+  </>
16
+)
17
+
18
+export default (props) => {
19
+
20
+  return (
21
+    <Collapse defaultActiveKey={['1']} expandIconPosition="right" style={{marginTop: '2em'}}>
22
+      <Panel header="This is panel header 1" key="1" extra={<Extra />}>
23
+        <div>123</div>
24
+      </Panel>
25
+      <Panel header="This is panel header 2" key="2" extra={<Extra />}>
26
+        <div>456</div>
27
+      </Panel>
28
+    </Collapse>
29
+  )
30
+}

+ 18
- 0
src/pages/building/Edit/AlbumList/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+import React, { useState } from 'react'
2
+import { Button } from 'antd'
3
+import Form from './Form'
4
+import List from './List'
5
+
6
+export default (props) => {
7
+  const [visible, setVisible] = useState(false)
8
+
9
+  return (
10
+    <div>
11
+      <div>
12
+        <Button type="primary" onClick={() => setVisible(true)}>新增户型</Button>
13
+      </div>
14
+      <Form visible={visible} onCancel={() => setVisible(false)} />
15
+      <List />
16
+    </div>
17
+  )
18
+}

+ 78
- 0
src/pages/building/Edit/Apartment/Form.jsx 查看文件

@@ -0,0 +1,78 @@
1
+import React from 'react'
2
+import { Button, Form, Input, Select } from 'antd'
3
+import ImageUpload from '@/components/XForm/ImageUpload'
4
+import ModalForm from '../components/ModalForm'
5
+import InputNumber from '../components/InputNumber'
6
+import { validMinNum } from '../utils'
7
+
8
+const Option = Select.Option
9
+const fullWidth = { width: '100%' }
10
+
11
+const AMForm = (props) => {
12
+  const { visible, onCancel, form } = props
13
+  const { getFieldDecorator } = form
14
+
15
+  return (
16
+    <ModalForm
17
+      title="户型设置"
18
+      visible={visible}
19
+      onCancel={onCancel}
20
+    >
21
+      <Form.Item label="编号" style={{ display: 'none' }}>
22
+          {getFieldDecorator('apartmentId')(<Input />)}
23
+      </Form.Item>
24
+      <Form.Item label="户型名称">
25
+        {getFieldDecorator('apartmentName', {
26
+          rules: [
27
+            { required: true, message: '请填写户型名称' },
28
+            { max: 10, message: '户型名称不超过10个字符' },
29
+          ],
30
+        })(<Input placeholder="户型名称不超过10个字符"/>)}
31
+      </Form.Item>
32
+      <Form.Item label="销售状态">
33
+        {getFieldDecorator('marketStatus', {
34
+          rules: [{ required: true, message: '请选择销售状态' }],
35
+        })(
36
+          <Select placeholder="销售状态">
37
+            <Option value="未开盘">未开盘</Option>
38
+            <Option value="在售">在售</Option>
39
+            <Option value="售罄">售罄</Option>
40
+          </Select>
41
+        )}
42
+      </Form.Item>
43
+      <Form.Item label="图片" help="建议图片尺寸336px*336px,比例1:1,格式:jpg">
44
+      {getFieldDecorator('img', {
45
+          rules: [{ required: true, message: '请上传户型图片' }],
46
+      })(
47
+        <ImageUpload />,
48
+      )}
49
+      </Form.Item>
50
+      <Form.Item label="厅室">
51
+        {getFieldDecorator('houseType', {
52
+          rules: [{ required: true, message: '请填写户型厅室' }],
53
+        })(<Input placeholder="例如: 三室一厅" />)}
54
+      </Form.Item>
55
+      <Form.Item label="面积">
56
+        {getFieldDecorator('buildingArea', {
57
+            rules: [{ validator: validMinNum }]
58
+          })(<InputNumber precision={2} min={0} step={0.01} addonAfter="㎡" />)}
59
+      </Form.Item>
60
+      <Form.Item label="使用面积">
61
+        {getFieldDecorator('insideArea', {
62
+            rules: [{ validator: validMinNum }]
63
+          })(<InputNumber precision={2} min={0} step={0.01} addonAfter="㎡" />)}
64
+      </Form.Item>
65
+      <Form.Item label="权重" help="数值越大越靠前">
66
+        {getFieldDecorator('orderNo', {
67
+            rules: [{ validator: validMinNum }]
68
+          })(<InputNumber min={0} step={1} style={fullWidth} />)}
69
+      </Form.Item>
70
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
71
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
72
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
73
+      </Form.Item>
74
+    </ModalForm>
75
+  )
76
+}
77
+
78
+export default Form.create({})(AMForm)

+ 61
- 0
src/pages/building/Edit/Apartment/List.jsx 查看文件

@@ -0,0 +1,61 @@
1
+import React from 'react'
2
+import { Button, Table } from 'antd'
3
+
4
+export default (props) => {
5
+  
6
+  const columns = [
7
+    {
8
+      title: '户型名称',
9
+      dataIndex: 'apartmentName',
10
+      key: 'apartmentName',
11
+    },
12
+    {
13
+      title: '销售状态',
14
+      dataIndex: 'marketStatus',
15
+      key: 'marketStatus',
16
+    },
17
+    {
18
+      title: '户型',
19
+      dataIndex: 'houseType',
20
+      key: 'houseType',
21
+    },
22
+    {
23
+      title: '面积',
24
+      dataIndex: 'buildingArea',
25
+      key: 'buildingArea',
26
+      render: (buildingArea, _) => <span>{`${buildingArea === 0 || buildingArea === null ? "-" : buildingArea + "m²"}`}</span>,
27
+    },
28
+    {
29
+      title: '使用面积',
30
+      dataIndex: 'insideArea',
31
+      key: 'insideArea',
32
+      render: (insideArea, _) => <span>{`${insideArea === 0 || insideArea === null ? "-" : insideArea + "m²"}`}</span>,
33
+    },
34
+    {
35
+      title: '创建时间',
36
+      dataIndex: 'createDate',
37
+      key: 'createDate',
38
+      render: (_, record) => <span>{moment(record.createDate).format('YYYY-MM-DD HH:mm')}</span>,
39
+    },
40
+    {
41
+      title: '操作',
42
+      dataIndex: 'apartmentId',
43
+      key: 'apartmentId',
44
+      render: (_, record) => (
45
+        <>
46
+          <Button type="link" onClick={() => props.onEdit(record)}>编辑</Button>
47
+          <Popconfirm
48
+            title="确定要进行删除操作 ?"
49
+            onConfirm={() => props.onDelete(record)}
50
+          >
51
+            <Button type="link" style={{ color: 'red' }}>删除</Button>
52
+          </Popconfirm>
53
+        </>
54
+      ),
55
+    },
56
+  ]
57
+
58
+  return (
59
+    <Table columns={columns} style={{marginTop: '1em', width: '100%'}} rowKey="apartmentId" />
60
+  )
61
+}

+ 18
- 0
src/pages/building/Edit/Apartment/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+import React, { useState } from 'react'
2
+import { Button } from 'antd'
3
+import Form from './Form'
4
+import List from './List'
5
+
6
+export default (props) => {
7
+  const [visible, setVisible] = useState(false)
8
+
9
+  return (
10
+    <div>
11
+      <div>
12
+        <Button type="primary" onClick={() => setVisible(true)}>新增户型</Button>
13
+      </div>
14
+      <Form visible={visible} onCancel={() => setVisible(false)} />
15
+      <List />
16
+    </div>
17
+  )
18
+}

+ 53
- 0
src/pages/building/Edit/Basic/getData.js 查看文件

@@ -0,0 +1,53 @@
1
+import moment from 'moment'
2
+import { fetch, apis } from '@/utils/request'
3
+
4
+export default (id) => {
5
+  if (!id) {
6
+    return Promise.reject('没有找到有效的项目ID');
7
+  }
8
+
9
+  return new Promise((resolve, reject) => {
10
+    fetch(apis.building.buildingGetById)({ urlData: { id } }).then((res) => {
11
+      const data = { ...res }
12
+
13
+      // 交房时间
14
+      if (res.receivedDate) {
15
+        data.receivedDate = moment(res.receivedDate)
16
+      }
17
+
18
+      // 标签
19
+      if (res.buildingTag) {
20
+        data.tag = res.buildingTag.map((x) => x.tagName)
21
+      }
22
+
23
+      // 主图 - 多个
24
+      if (res.buildingImg) {
25
+        data.avatarImage = res.buildingImg.map((x) => x.url)
26
+      }
27
+
28
+      // 封面 - 一个
29
+      if (res.buildingListImg) {
30
+        data.listImage = res.buildingListImg.map(item => item.url)[0]
31
+      }
32
+
33
+      // 视频
34
+      if (res.videoUrl) {
35
+        data.videoUrl = [].concat(res.videoUrl)
36
+      }
37
+
38
+      // 视频封面
39
+      if (res.videoImage) {
40
+        data.videoImage = res.videoImage[0].url
41
+      }
42
+
43
+      // POI 相关
44
+      if (res.mapJson) {
45
+        data.mapJson = JSON.parse(res.mapJson) || []
46
+      }
47
+
48
+      resolve(data)
49
+    }).catch((err) => {
50
+      reject(err.message || err)
51
+    })
52
+  })
53
+}

src/pages/building/Edit/Basic.jsx → src/pages/building/Edit/Basic/index.jsx 查看文件

@@ -6,12 +6,12 @@ import ImageListUpload from '@/components/XForm/ImageListUpload'
6 6
 import SelectCity from '@/components/SelectButton/CitySelect'
7 7
 import AreaSelect from '@/components/SelectButton/AreaSelect'
8 8
 import { POI_TYPES_KETY, POI_TYPES, getPoiData } from '@/utils/map'
9
-import BuildingType from './components/BuildingTypeSelect'
10
-import OpenTimePicker from './components/OpenTimePicker'
11
-import Amap from './components/Amap'
12
-import EditableArround from './components/EditableArround'
13
-import FormGroupItem, { gourpItemLayout } from './components/FormGroupItem'
14
-import { formItemLayout, validMinNum } from './utils'
9
+import Amap from '../components/Amap'
10
+import BuildingType from '../components/BuildingTypeSelect'
11
+import OpenTimePicker from '../components/OpenTimePicker'
12
+import EditableArround from '../components/EditableArround'
13
+import FormGroupItem, { gourpItemLayout } from '../components/FormGroupItem'
14
+import { formItemLayout, validMinNum } from '../utils'
15 15
 
16 16
 const fullWidth= { width: '100%' }
17 17
 const Item = Form.Item

+ 35
- 0
src/pages/building/Edit/Channel.jsx 查看文件

@@ -0,0 +1,35 @@
1
+import React from 'react'
2
+import { Button, Form, Input, Select } from 'antd'
3
+import InputNumber from './components/InputNumber'
4
+import { formItemLayout, validMinNum } from './utils'
5
+
6
+const ChannelForm = (props) => {
7
+  const { form } = props
8
+  const { getFieldDecorator } = form
9
+
10
+  return (
11
+    <Form {...formItemLayout}>
12
+      <Form.Item label="渠道">
13
+      {getFieldDecorator('shareContentTitle', {
14
+        rules: [{required: true, message: '请填写分享标题'}]
15
+      })(<Select />)}
16
+      </Form.Item>
17
+      <Form.Item label="报备有效期">
18
+      {getFieldDecorator('posterImg', {
19
+          rules: [{ validator: validMinNum }],
20
+      })(<InputNumber min={0} step={1} addonAfter="天" />)}
21
+      </Form.Item>
22
+      <Form.Item label="报备有效期">
23
+      {getFieldDecorator('posterImg', {
24
+          rules: [{ validator: validMinNum }],
25
+      })(<Input.TextArea row={4} />)}
26
+      </Form.Item>
27
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
28
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
29
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
30
+      </Form.Item>
31
+    </Form>
32
+  )
33
+}
34
+
35
+export default Form.create({})(ChannelForm)

+ 45
- 0
src/pages/building/Edit/News/Form.jsx 查看文件

@@ -0,0 +1,45 @@
1
+import React from 'react'
2
+import { Button, Form, Input, DatePicker } from 'antd'
3
+import ModalForm from '../components/ModalForm'
4
+
5
+const fullWidth = { width: '100%' }
6
+
7
+const AMForm = (props) => {
8
+  const { visible, onCancel, form } = props
9
+  const { getFieldDecorator } = form
10
+
11
+  return (
12
+    <ModalForm
13
+      title="项目动态设置"
14
+      visible={visible}
15
+      onCancel={onCancel}
16
+    >
17
+      <Form.Item label="时间">
18
+      {getFieldDecorator('img', {
19
+          rules: [{ required: true, message: '请选择时间' }],
20
+      })(
21
+        <DatePicker style={fullWidth} />,
22
+      )}
23
+      </Form.Item>
24
+      <Form.Item label="标题">
25
+        {getFieldDecorator('apartmentName', {
26
+          rules: [
27
+            { required: true, message: '请填写标题' },
28
+            { max: 30, message: '标题不超过30个字符' },
29
+          ],
30
+        })(<Input placeholder="标题不超过30个字符"/>)}
31
+      </Form.Item>
32
+      <Form.Item label="内容">
33
+        {getFieldDecorator('marketStatus', {
34
+          rules: [{ required: true, message: '请填写内容' }],
35
+        })(<Input.TextArea row={4} />)}
36
+      </Form.Item>
37
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
38
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
39
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
40
+      </Form.Item>
41
+    </ModalForm>
42
+  )
43
+}
44
+
45
+export default Form.create({})(AMForm)

+ 44
- 0
src/pages/building/Edit/News/List.jsx 查看文件

@@ -0,0 +1,44 @@
1
+import React from 'react'
2
+import { Button, Table } from 'antd'
3
+
4
+export default (props) => {
5
+  
6
+  const columns = [
7
+    {
8
+      title: '标题',
9
+      dataIndex: 'apartmentName',
10
+      key: 'apartmentName',
11
+    },
12
+    {
13
+      title: '内容',
14
+      dataIndex: 'marketStatus',
15
+      key: 'marketStatus',
16
+    },
17
+    {
18
+      title: '时间',
19
+      dataIndex: 'createDate',
20
+      key: 'createDate',
21
+      render: (_, record) => <span>{moment(record.createDate).format('YYYY-MM-DD')}</span>,
22
+    },
23
+    {
24
+      title: '操作',
25
+      dataIndex: 'apartmentId',
26
+      key: 'apartmentId',
27
+      render: (_, record) => (
28
+        <>
29
+          <Button type="link" onClick={() => props.onEdit(record)}>编辑</Button>
30
+          <Popconfirm
31
+            title="确定要进行删除操作 ?"
32
+            onConfirm={() => props.onDelete(record)}
33
+          >
34
+            <Button type="link" style={{ color: 'red' }}>删除</Button>
35
+          </Popconfirm>
36
+        </>
37
+      ),
38
+    },
39
+  ]
40
+
41
+  return (
42
+    <Table columns={columns} style={{marginTop: '1em', width: '100%'}} rowKey="apartmentId" />
43
+  )
44
+}

+ 18
- 0
src/pages/building/Edit/News/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+import React, { useState } from 'react'
2
+import { Button } from 'antd'
3
+import Form from './Form'
4
+import List from './List'
5
+
6
+export default (props) => {
7
+  const [visible, setVisible] = useState(false)
8
+
9
+  return (
10
+    <div>
11
+      <div>
12
+        <Button type="primary" onClick={() => setVisible(true)}>新增动态</Button>
13
+      </div>
14
+      <Form visible={visible} onCancel={() => setVisible(false)} />
15
+      <List />
16
+    </div>
17
+  )
18
+}

+ 61
- 0
src/pages/building/Edit/Panorama/Form.jsx 查看文件

@@ -0,0 +1,61 @@
1
+import React, { useState } from 'react'
2
+import { Button, Form, Input, Select, Radio } from 'antd'
3
+import ImageUpload from '@/components/XForm/ImageUpload'
4
+import ModalForm from '../components/ModalForm'
5
+
6
+const fullWidth = { width: '100%' }
7
+
8
+const AMForm = (props) => {
9
+  const { visible, onCancel, form } = props
10
+  const { getFieldDecorator } = form
11
+
12
+  const [panoramaType, setPanoramaType] = useState('apartment')
13
+
14
+  return (
15
+    <ModalForm
16
+      title="全景设置"
17
+      visible={visible}
18
+      onCancel={onCancel}
19
+    >
20
+      <Form.Item label="全景类型">
21
+        {getFieldDecorator('panoramaType', {
22
+          rules: [{ required: true, message: '请选择全景类型' } ],
23
+        })(
24
+          <Radio.Group onChange={(e) => setPanoramaType(e.target.value)} buttonStyle="solid">
25
+            <Radio.Button value="apartment">户型</Radio.Button>
26
+            <Radio.Button value="building">项目</Radio.Button>
27
+          </Radio.Group>,
28
+        )}
29
+      </Form.Item>
30
+      { panoramaType == "apartment" && <Form.Item label="全景内容">
31
+        {getFieldDecorator('apartmentId', {
32
+          rules: [{ required: true, message: '请选择全景内容' }],
33
+        })(
34
+          <Select placeholder="户型" style={fullWidth}>
35
+          </Select>
36
+        )}
37
+      </Form.Item>}
38
+      { panoramaType == "building" && <Form.Item label="全景内容">
39
+        {getFieldDecorator('content', {
40
+          rules: [{ required: true, message: '请输入全景内容' }],
41
+        })(<Input placeholder="请简述全景内容" />)}
42
+      </Form.Item>}
43
+      <Form.Item label="选择封面" help="建议图片尺寸750px*600px,比例5:4,格式:jpg">
44
+      {getFieldDecorator('coverImg', {
45
+          rules: [{ required: true, message: '请上传封面图片' }],
46
+      })(<ImageUpload />)}
47
+      </Form.Item>
48
+      <Form.Item label="链接地址">
49
+        {getFieldDecorator('panoramaLink', {
50
+          rules: [{ required: true, message: '请输入链接地址' }],
51
+        })(<Input />)}
52
+      </Form.Item>
53
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
54
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
55
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
56
+      </Form.Item>
57
+    </ModalForm>
58
+  )
59
+}
60
+
61
+export default Form.create({})(AMForm)

+ 47
- 0
src/pages/building/Edit/Panorama/List.jsx 查看文件

@@ -0,0 +1,47 @@
1
+import React from 'react'
2
+import { Button, Table } from 'antd'
3
+
4
+export default (props) => {
5
+  
6
+  const columns = [
7
+    {
8
+      title: '封面图',
9
+      dataIndex: 'coverImg',
10
+      key: 'coverImg',
11
+      render: (x, record) => <img style={{ width: '150px', height: '120px', borderRadius: '4px' }} src={x} alt="" />,
12
+    },
13
+    {
14
+      title: '类型',
15
+      dataIndex: 'panoramaType',
16
+      key: 'panoramaType',
17
+      render: (x, record) => <span>{x === "apartment" ? "户型" : "项目"}</span>,
18
+    },
19
+    {
20
+      title: '内容',
21
+      dataIndex: 'content',
22
+      key: 'content',
23
+    },
24
+    {
25
+      title: '链接地址',
26
+      dataIndex: 'panoramaLink',
27
+      key: 'panoramaLink',
28
+    },
29
+    {
30
+      title: '操作',
31
+      dataIndex: 'apartmentId',
32
+      key: 'apartmentId',
33
+      render: (_, record) => (
34
+        <Popconfirm
35
+          title="确定要进行删除操作 ?"
36
+          onConfirm={() => props.onDelete(record)}
37
+        >
38
+          <Button type="link" style={{ color: 'red' }}>删除</Button>
39
+        </Popconfirm>
40
+      ),
41
+    },
42
+  ]
43
+
44
+  return (
45
+    <Table columns={columns} style={{marginTop: '1em', width: '100%'}} rowKey="apartmentId" />
46
+  )
47
+}

+ 18
- 0
src/pages/building/Edit/Panorama/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+import React, { useState } from 'react'
2
+import { Button } from 'antd'
3
+import Form from './Form'
4
+import List from './List'
5
+
6
+export default (props) => {
7
+  const [visible, setVisible] = useState(false)
8
+
9
+  return (
10
+    <div>
11
+      <div>
12
+        <Button type="primary" onClick={() => setVisible(true)}>新增全景</Button>
13
+      </div>
14
+      <Form visible={visible} onCancel={() => setVisible(false)} />
15
+      <List />
16
+    </div>
17
+  )
18
+}

+ 83
- 0
src/pages/building/Edit/SpecialRoom/Form.jsx 查看文件

@@ -0,0 +1,83 @@
1
+import React from 'react'
2
+import { Button, Form, Input, DatePicker } from 'antd'
3
+import ModalForm from '../components/ModalForm'
4
+import InputNumber from '../components/InputNumber'
5
+import { validMinNum } from '../utils'
6
+
7
+const fullWidth = { width: '100%' }
8
+
9
+const AMForm = (props) => {
10
+  const { visible, onCancel, form } = props
11
+  const { getFieldDecorator } = form
12
+
13
+  return (
14
+    <ModalForm
15
+      title="特价房设置"
16
+      visible={visible}
17
+      onCancel={onCancel}
18
+    >
19
+      <Form.Item label="房源">
20
+        {getFieldDecorator('apartmentName', {
21
+          rules: [
22
+            { required: true, message: '请填写房源' },
23
+            { max: 30, message: '房源不超过30个字符' },
24
+          ],
25
+        })(<Input placeholder="比如 3# 15-02"/>)}
26
+      </Form.Item>
27
+      <Form.Item label="户型">
28
+        {getFieldDecorator('apartmentName', {
29
+          rules: [
30
+            { required: true, message: '请填写房源' },
31
+            { max: 30, message: '房源不超过30个字符' },
32
+          ],
33
+        })(<Input placeholder="比如 三室一厅"/>)}
34
+      </Form.Item>
35
+      <Form.Item label="面积">
36
+        {getFieldDecorator('apartmentName', {
37
+          rules: [
38
+            { required: true, message: '请填写面积' },
39
+            { validator: validMinNum },
40
+          ],
41
+        })(<InputNumber min={0} precision={0.01} step={1} addonAfter="㎡"/>)}
42
+      </Form.Item>
43
+      <Form.Item label="时间">
44
+      {getFieldDecorator('img', {
45
+          rules: [{ required: true, message: '请选择时间' }],
46
+      })(
47
+        <DatePicker.RangePicker
48
+          showTime={{ format: 'HH:mm' }}
49
+          format="YYYY-MM-DD HH:mm"
50
+          placeholder={['开始时间', '结束时间']}
51
+          style={fullWidth} />,
52
+      )}
53
+      </Form.Item>
54
+      <Form.Item label="原始价">
55
+        {getFieldDecorator('apartmentName', {
56
+          rules: [
57
+            { required: true, message: '请填写原始价' },
58
+          ],
59
+        })(<Input placeholder="请填写原始价"/>)}
60
+      </Form.Item>
61
+      <Form.Item label="现价">
62
+        {getFieldDecorator('apartmentName', {
63
+          rules: [
64
+            { required: true, message: '请填写现价' },
65
+          ],
66
+        })(<Input placeholder="请填写现价"/>)}
67
+      </Form.Item>
68
+      <Form.Item label="节省价">
69
+        {getFieldDecorator('apartmentName', {
70
+          rules: [
71
+            { required: true, message: '请填写节省价' },
72
+          ],
73
+        })(<Input placeholder="请填写节省价"/>)}
74
+      </Form.Item>
75
+      <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
76
+        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
77
+        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
78
+      </Form.Item>
79
+    </ModalForm>
80
+  )
81
+}
82
+
83
+export default Form.create({})(AMForm)

+ 56
- 0
src/pages/building/Edit/SpecialRoom/List.jsx 查看文件

@@ -0,0 +1,56 @@
1
+import React from 'react'
2
+import { Button, Table } from 'antd'
3
+
4
+export default (props) => {
5
+  
6
+  const columns = [
7
+    {
8
+      title: '房源',
9
+      dataIndex: 'apartmentName',
10
+      key: 'apartmentName',
11
+    },
12
+    {
13
+      title: '户型',
14
+      dataIndex: 'marketStatus',
15
+      key: 'marketStatus',
16
+    },
17
+    {
18
+      title: '面积',
19
+      dataIndex: 'marketStatus',
20
+      key: 'marketStatus',
21
+      render: (t) => <span>{`${t || ' -- '} ㎡`}</span>,
22
+    },
23
+    {
24
+      title: '开始时间',
25
+      dataIndex: 'createDate',
26
+      key: 'createDate',
27
+      render: (_, record) => <span>{moment(record.createDate).format('YYYY-MM-DD')}</span>,
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: 'apartmentId',
38
+      key: 'apartmentId',
39
+      render: (_, record) => (
40
+        <>
41
+          <Button type="link" onClick={() => props.onEdit(record)}>编辑</Button>
42
+          <Popconfirm
43
+            title="确定要进行删除操作 ?"
44
+            onConfirm={() => props.onDelete(record)}
45
+          >
46
+            <Button type="link" style={{ color: 'red' }}>删除</Button>
47
+          </Popconfirm>
48
+        </>
49
+      ),
50
+    },
51
+  ]
52
+
53
+  return (
54
+    <Table columns={columns} style={{marginTop: '1em', width: '100%'}} rowKey="apartmentId" />
55
+  )
56
+}

+ 18
- 0
src/pages/building/Edit/SpecialRoom/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+import React, { useState } from 'react'
2
+import { Button } from 'antd'
3
+import Form from './Form'
4
+import List from './List'
5
+
6
+export default (props) => {
7
+  const [visible, setVisible] = useState(false)
8
+
9
+  return (
10
+    <div>
11
+      <div>
12
+        <Button type="primary" onClick={() => setVisible(true)}>新增特价房</Button>
13
+      </div>
14
+      <Form visible={visible} onCancel={() => setVisible(false)} />
15
+      <List />
16
+    </div>
17
+  )
18
+}

+ 1
- 1
src/pages/building/Edit/components/Amap/index.jsx 查看文件

@@ -95,7 +95,7 @@ export default (props) => {
95 95
     ...inputStyle,
96 96
     top: '10px',
97 97
     background: 'rgba(255, 255, 255, .9)',
98
-    border: '1px solid',
98
+    border: '1px solid #bbb',
99 99
   }
100 100
 
101 101
   return (

+ 17
- 0
src/pages/building/Edit/components/InputNumber.jsx 查看文件

@@ -0,0 +1,17 @@
1
+import React from 'react'
2
+import { Input, InputNumber } from 'antd'
3
+
4
+export default (props) => {
5
+  const { addonAfter, ...leftProps } = props;
6
+
7
+  if (!addonAfter) {
8
+    return <InputNumber {...leftProps} />
9
+  }
10
+
11
+  return (
12
+    <Input.Group compact>
13
+      <InputNumber style={{ width: 'calc(100% - 3em - 1px)' }} {...leftProps} />
14
+      <Input value={addonAfter} disabled style={{ width: '3em' }} />
15
+    </Input.Group>
16
+  )
17
+}

+ 24
- 0
src/pages/building/Edit/components/ModalForm/index.jsx 查看文件

@@ -0,0 +1,24 @@
1
+import React from 'react'
2
+import { Modal, Form } from 'antd'
3
+import { formItemLayout } from '../../utils'
4
+
5
+const noop = () => undefined
6
+
7
+export default (props) => {
8
+  const { title, visible, onCancel = noop, modalProps = {}, children, ...leftProps } = props
9
+
10
+  return (
11
+    <Modal
12
+      title={title}
13
+      width={800}
14
+      visible={visible}
15
+      onCancel={onCancel}
16
+      footer={null}
17
+      {...modalProps}
18
+    >
19
+      <Form {...formItemLayout} {...leftProps} >
20
+        {children}
21
+      </Form>
22
+    </Modal>
23
+  )
24
+}

+ 38
- 8
src/pages/building/Edit/index.jsx 查看文件

@@ -1,11 +1,21 @@
1 1
 import React from 'react'
2 2
 import { Tabs, Card } from 'antd'
3
+import Poster from '@/components/Poster'
4
+import Share from '@/components/Share'
3 5
 import Basic from './Basic'
6
+import Apartment from './Apartment'
7
+import AlbumList from './AlbumList'
8
+import Panorama from './Panorama'
9
+import Channel from './Channel'
10
+import News from './News'
11
+import SpecialRoom from './SpecialRoom'
4 12
 import styles from './style.less'
5 13
 
6 14
 const { TabPane } = Tabs
7 15
 
8 16
 export default (props) => {
17
+  const target = { id: '', type: 'building' }
18
+
9 19
   return (
10 20
     <Card>
11 21
       <Tabs defaultActiveKey="1">
@@ -15,22 +25,42 @@ export default (props) => {
15 25
           </div>
16 26
         </TabPane>
17 27
         <TabPane tab="户型设置" key="2">
18
-          Content of Tab Pane 2
28
+          <div className={styles['tab-wrapper']}>
29
+            <Apartment />
30
+          </div>
19 31
         </TabPane>
20 32
         <TabPane tab="项目相册" key="3">
21
-          Content of Tab Pane 3
33
+          <div className={styles['tab-wrapper']}>
34
+            <AlbumList />
35
+          </div>
22 36
         </TabPane>
23 37
         <TabPane tab="全景照片" key="4">
24
-          Content of Tab Pane 3
38
+          <div className={styles['tab-wrapper']}>
39
+            <Panorama />
40
+          </div>
25 41
         </TabPane>
26
-        <TabPane tab="海报图片" key="5">
27
-          Content of Tab Pane 3
42
+        <TabPane tab="项目动态" key="8">
43
+          <div className={styles['tab-wrapper']}>
44
+            <News />
45
+          </div>
28 46
         </TabPane>
29
-        <TabPane tab="分享设置" key="6">
30
-          Content of Tab Pane 3
47
+        <TabPane tab="特价房源" key="9">
48
+          <div className={styles['tab-wrapper']}>
49
+            <SpecialRoom />
50
+          </div>
31 51
         </TabPane>
32 52
         <TabPane tab="渠道设置" key="7">
33
-          Content of Tab Pane 3
53
+          <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
54
+            <Channel />
55
+          </div>
56
+        </TabPane>
57
+        <TabPane tab="海报图片" key="5">
58
+          <Poster target={target} />
59
+        </TabPane>
60
+        <TabPane tab="分享设置" key="6">
61
+          <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
62
+            <Share target={target} />
63
+          </div>
34 64
         </TabPane>
35 65
       </Tabs>
36 66
     </Card>

+ 1
- 1
src/pages/document.ejs 查看文件

@@ -7,7 +7,7 @@
7 7
       name="viewport"
8 8
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
9 9
     />
10
-    <title>Ant Design Pro</title>
10
+    <title>新 联 家</title>
11 11
     <link rel="icon" href="/favicon.png" type="image/x-icon" />
12 12
   </head>
13 13
   <body>