张延森 5 年之前
父節點
當前提交
59b0194fc0

+ 5
- 6
src/pages/house/edit/components/EnDash/index.jsx 查看文件

@@ -2,14 +2,13 @@ import React from 'react'
2 2
 
3 3
 export default function EnDash(props) {
4 4
     const { size = 1, color = '#999', style = {}, ...left } = props
5
-    const size = props.size || 1
6
-    const color = props.color || '#999'
7 5
 
8
-    const newSt = {
6
+    const newSt = { 
9 7
         ...style,
10
-        borderBottom: `${size}px dashed ${color}`,
11
-        transform: 'translateY(50%)'
8
+        display: 'flex',
9
+        alignItems: 'center',
10
+        justifyContent: 'center',
12 11
     }
13 12
 
14
-    return <div style={newSt} { ...left } />
13
+    return <div style={newSt} { ...left }><hr style={{ border: 'none', borderBottom: `${size}px dashed ${color}`, width: '100%' }} /></div>
15 14
 }

+ 109
- 0
src/pages/house/edit/components/HelpDoc/index.jsx 查看文件

@@ -0,0 +1,109 @@
1
+import React, { PureComponent } from 'react'
2
+import { Modal, Row, Col } from 'antd'
3
+import EnDash from '../EnDash'
4
+
5
+import Style from './style.less'
6
+import HotBlock from '../HotBlock'
7
+
8
+const dataset = [
9
+  {
10
+    label: '(0)',
11
+    value: 0,
12
+  },
13
+  {
14
+    label: '(1)',
15
+    value: 1,
16
+  },
17
+  {
18
+    label: '(2)',
19
+    value: 2,
20
+  },
21
+  {
22
+    label: '(3)',
23
+    value: 3,
24
+  },
25
+  {
26
+    label: '(4)',
27
+    value: 4,
28
+  },
29
+  {
30
+    label: '(5)',
31
+    value: 5,
32
+  },
33
+  {
34
+    label: '(6~10)',
35
+    value: 8,
36
+  },
37
+  {
38
+    label: '(11~20)',
39
+    value: 15,
40
+  },
41
+  {
42
+    label: '(21~30)',
43
+    value: 25,
44
+  },
45
+  {
46
+    label: '(31~40)',
47
+    value: 35,
48
+  },
49
+  {
50
+    label: '(41~50)',
51
+    value: 45,
52
+  },
53
+  {
54
+    label: '(51~100)',
55
+    value: 80,
56
+  },
57
+  {
58
+    label: '(101~200)',
59
+    value: 150,
60
+  },
61
+  {
62
+    label: '(200以上)',
63
+    value: 201,
64
+  },
65
+]
66
+
67
+function Cell(props) {
68
+  return (
69
+    <Row type="flex" align="middle" gutter={20}>
70
+      <Col span={4}>{props.left}</Col>
71
+      <Col span={12}><EnDash /></Col>
72
+      <Col span={6}>{props.right}</Col>
73
+    </Row>
74
+  )
75
+}
76
+
77
+export default function HelpDoc(props) {
78
+  return (
79
+    <Modal footer={null} title="相关说明" visible={props.visible} onCancel={props.onCancel} width={800}>
80
+      <div className={Style.article}>
81
+        <div className={Style.section}>
82
+          <div className={Style.title}>1.图例解释:</div>
83
+          <div>
84
+            <Cell left="1号楼" right="楼栋/幢" />
85
+            <Cell left="2单元" right="单元" />
86
+            <Cell left="3楼" right="楼层" />
87
+            <Cell left="301" right="房号" />
88
+            <Cell left="1人" right="预选人数" />
89
+            <Cell left="234万" right="价格" />
90
+            <Cell left="A户型" right="户型名" />
91
+          </div>
92
+        </div>
93
+        <div className={Style.section}>
94
+          <div className={Style.title}>2.预选人数(热度):</div>
95
+          <div>每有一位客户预选此房源,热度自动增加1,热度越大说明想购买此房源的用户越多,认筹摇号购买难度越大。</div>
96
+        </div>
97
+        <div className={Style.section}>
98
+          <div className={Style.title}>3.热度指标:</div>
99
+          <div className={Style.subtitle}>颜色越深代表热度越高。黑底白字代表房源未发布,未发布房源用户不会看到。</div>
100
+          <div className={Style.flex}>
101
+            {
102
+              dataset.map((block) => (<div className={Style['flex-item']} key={block.value}><HotBlock number={block.value}>{block.label}</HotBlock></div>))
103
+            }
104
+          </div>
105
+        </div>
106
+      </div>
107
+    </Modal>
108
+  );
109
+}

+ 36
- 0
src/pages/house/edit/components/HelpDoc/style.less 查看文件

@@ -0,0 +1,36 @@
1
+.article {
2
+    .section {
3
+        font-size: 16px;
4
+        line-height: 1.8em;
5
+        color: #666;
6
+
7
+        & + .section {
8
+            margin-top: 24px;
9
+        }
10
+    }
11
+
12
+    .title {
13
+        font-size: 18px;
14
+        line-height: 2em;
15
+        color: #333;
16
+    }
17
+
18
+    .subtitle {
19
+        font-size: 14px;
20
+        line-height: 1.6em;
21
+        color: #999;
22
+    }
23
+
24
+    .flex {
25
+        display: flex;
26
+        flex-wrap: wrap;
27
+
28
+        .flex-item {
29
+            margin-top: 16px;
30
+            margin-right: 8px;
31
+            flex: none;
32
+            width: 100px;
33
+            text-align: center;
34
+        }
35
+    }
36
+}

+ 2
- 2
src/pages/house/edit/components/HouseGrid/Floor.jsx 查看文件

@@ -6,8 +6,8 @@ export default function Floor(props) {
6 6
 
7 7
   return (
8 8
     <div className={Style.floor}>
9
-      <div className={Style.head}>{floorName}</div>
10
-      <div className={Style.body}>
9
+      <div className={Style['floor-head']}>{floorName}</div>
10
+      <div className={Style['floor-body']}>
11 11
         {roomList.map((room) => {
12 12
           return (
13 13
             <div className={Style.item} key={room.houseId} >

+ 13
- 8
src/pages/house/edit/components/HouseGrid/Room.jsx 查看文件

@@ -4,8 +4,11 @@ import HotBlock from "../HotBlock"
4 4
 import Style from './style.less'
5 5
 
6 6
 export default function Room(props) {
7
-  const { roomNumber, totalNum, price, apartmentName, status } = props.dataset || {}
8
-  const personNum = `(${totalNum}人)`
7
+  const { roomName, price, apartmentName, status, heat, realHeat } = props.dataset || {}
8
+  let personNum = props.hotType === 1 ? (heat || 0) : (realHeat || 0)
9
+  if (props.hotType === 3) {
10
+    personNum = 0 + heat + realHeat
11
+  }
9 12
 
10 13
   const handleClick = () => {
11 14
     if (props.onClick) {
@@ -13,13 +16,15 @@ export default function Room(props) {
13 16
     }
14 17
   }
15 18
 
19
+  const wanY = Number(price / 10000).toFixed(0)
20
+
16 21
   return (
17
-    <HotBlock number={totalNum}>
18
-      <div className={Style.room} onClick={handleClick}>
19
-        <div className={classNames(Style.warn, {[`${Style.offline}`]: status !== 1})}>{roomNumber}</div>
20
-        <div className={classNames(Style.warn, {[`${Style.offline}`]: status !== 1})}>{personNum}</div>
21
-        <div className={classNames(Style.info, {[`${Style.offline}`]: status !== 1})}>{price}</div>
22
-        <div className={classNames(Style.info, {[`${Style.offline}`]: status !== 1})}>{apartmentName}</div>
22
+    <HotBlock number={personNum}>
23
+      <div className={classNames(Style.room, { [`${Style.offline}`]: status !== 1 })} onClick={handleClick}>
24
+        <div className={Style.warn}>{roomName}</div>
25
+        <div className={Style.warn}>{`(${personNum}人)`}</div>
26
+        <div className={Style.info}>{`${wanY} 万`}</div>
27
+        <div className={Style.info}>{apartmentName}</div>
23 28
       </div>
24 29
     </HotBlock>
25 30
   )

+ 2
- 2
src/pages/house/edit/components/HouseGrid/Unit.jsx 查看文件

@@ -6,8 +6,8 @@ export default function Unit(props) {
6 6
 
7 7
   return (
8 8
     <div className={Style.unit}>
9
-      <div className={Style.head}>{unitName}</div>
10
-      <div className={Style.body}>
9
+      <div className={Style['unit-head']}>{unitName}</div>
10
+      <div className={Style['unit-body']}>
11 11
         {floorList.map(floor => props.render(floor))}
12 12
       </div>
13 13
     </div>

+ 6
- 4
src/pages/house/edit/components/HouseGrid/index.js 查看文件

@@ -6,7 +6,7 @@ import Unit from './Unit';
6 6
 
7 7
 
8 8
 export default function(props) {
9
-  const { blockList = [] } = props.dataset || {}
9
+  const blockList = props.dataset || []
10 10
   
11 11
   // 仅仅是一个函数, 不是函数式组件
12 12
   function renderRoom(room) {
@@ -22,11 +22,13 @@ export default function(props) {
22 22
     <div>
23 23
       {
24 24
         blockList.map((block) => (
25
-          <div>
26
-            <PageHeader key={block.blockId} title={`${block.termName} ${block.blockName}`} backIcon={false} />
25
+          <div key={block.blockId} style={{marginTop: '20px', overflowX: 'auto'}}>
26
+            <PageHeader title={`${block.termName} ${block.blockName}`} backIcon={false} />
27
+            <div style={{ display: 'flex', padding: '10px' }}>
27 28
             {
28
-              (block.unitList || []).map((unit) => (<Card key={unit.unitId}><Unit dataset={unit} render={renderFloor} /></Card>))
29
+              (block.unitList || []).map((unit) => (<div key={unit.unitId} style={{ flex: 'auto', marginRight: '30px' }} ><Unit dataset={unit} render={renderFloor} /></div>))
29 30
             }
31
+            </div>
30 32
           </div>
31 33
         ))
32 34
       }

+ 21
- 16
src/pages/house/edit/components/HouseGrid/style.less 查看文件

@@ -13,37 +13,39 @@
13 13
     color: #730000;
14 14
   }
15 15
 
16
-  .tip {
17
-    color: #BB9C79;
18
-  }
19
-
20
-  .offline {
16
+  &.offline {
21 17
     color: #fff;
22 18
     background: #000;
19
+    
20
+    .info, .warn {
21
+      color: #fff;
22
+    }
23 23
   }
24 24
 }
25 25
 
26 26
 .floor {
27 27
   display: flex;
28 28
 
29
-  .head {
29
+  &-head {
30 30
     font-size: 20px;
31 31
     padding-top: 36px;
32 32
     flex: none;
33 33
     width: 14%;
34
-    text-align: left;
34
+    min-width: 100px;
35
+    text-align: center;
35 36
   }
36 37
 
37
-  .body {
38
+  &-body {
39
+    padding-top: 10px;
38 40
     text-align: center;
39 41
     flex: auto;
40 42
     display: flex;
41 43
     justify-content: flex-start;
42
-    flex-wrap: wrap;
44
+    overflow-x: auto;
43 45
 
44 46
     .item {
45
-      width: 31%;
46 47
       flex: none;
48
+      width: 110px;
47 49
 
48 50
       & + .item {
49 51
           margin-left: 2%;
@@ -53,15 +55,18 @@
53 55
 }
54 56
 
55 57
 .unit {
56
-  .head {
57
-    padding: 12px 40px;
58
+  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
59
+  max-width: 600px;
60
+
61
+  &-head {
62
+    padding-left: 40px;
58 63
     font-size: 22px;
59
-    line-height: 1.8em;
64
+    line-height: 44px;
60 65
     color: #000;
61
-    background-color: #F8F8F8;
66
+    background: #f8f8f8;
62 67
   }
63 68
 
64
-  .body {
65
-    padding: 0 20px;
69
+  &-body {
70
+    // padding: 0 20px;
66 71
   }
67 72
 }

+ 75
- 5
src/pages/house/edit/components/preselectionImg.jsx 查看文件

@@ -1,25 +1,95 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Button, Radio } from 'antd';
2
+import { Form, Button, Radio, Icon } from 'antd';
3 3
 import HouseGrid from './HouseGrid';
4
-import apis from '../../../../services/apis';
4
+import { fetch, apis } from '../../../../utils/request'
5
+import HelpDoc from './HelpDoc';
6
+
7
+const getHouseList = fetch(apis.house.listHouseResources)
8
+
9
+function groupHouseList(houseList = []) {
10
+  // 先按照楼层分组
11
+  const floorList = houseList.reduce((list, room) => {
12
+    let found = false
13
+
14
+    list.forEach((floor) => {
15
+      if (floor.floorId === room.floorId) {
16
+        found = true
17
+        floor.roomList.push(room)
18
+      }
19
+    })
20
+    
21
+    if (!found) {
22
+      list.push({ ...room, roomList: [ room ]})
23
+    }
24
+
25
+    return list
26
+  }, [])
27
+
28
+  // 再按照单元分组
29
+  const unitList = floorList.reduce((list, floor) => {
30
+    let found = false
31
+    list.forEach((unit) => {
32
+      if (unit.unitId === floor.unitId) {
33
+        found = true
34
+        unit.floorList.push(floor)
35
+      }
36
+    })
37
+    
38
+    if (!found) {
39
+      list.push({ ...floor, floorList: [ floor ]})
40
+    }
41
+
42
+    return list
43
+  }, [])
44
+
45
+  // 最后按照楼栋分组
46
+  return unitList.reduce((list, unit) => {
47
+    let found = false
48
+    list.forEach((block) => {
49
+      if (block.blockId === unit.blockId) {
50
+        found = true
51
+        block.unitList.push(unit)
52
+      }
53
+    })
54
+    
55
+    if (!found) {
56
+      list.push({ ...unit, unitList: [ unit ]})
57
+    }
58
+
59
+    return list
60
+  }, [])
61
+}
5 62
 
6 63
 const PreselectionImg = props => {
64
+  const salesBatchId = props.salesBatchId
7 65
   const [hotType, setHotType] = useState(1)
66
+  const [blockList, setBlockList] = useState([])
67
+  const [showHelp, setShowHelp] = useState(false)
68
+
69
+  useEffect(() => {
70
+    if (salesBatchId) {
71
+      getHouseList({ params: { salesBatchId } }).then(res => {
72
+        const groupedData = groupHouseList(res)
73
+        setBlockList(groupedData)
74
+      })
75
+    }
76
+  }, [salesBatchId])
8 77
 
9 78
   return (
10 79
     <div>
11 80
       <Form layout="inline">
12 81
         <Form.Item label="热度选择">
13
-          <Radio.Group onChange={setHotType} value={hotType}>
82
+          <Radio.Group onChange={e => setHotType(e.target.value)} value={hotType}>
14 83
             <Radio value={1}>基础热度</Radio>
15 84
             <Radio value={2}>实际热度</Radio>
16 85
             <Radio value={3}>显示热度</Radio>
17
-            <Button type="primary" shape="circle" icon="question-circle" size="small" />
86
+            <Icon type="question-circle" theme="filled" style={{ fontSize: '18px', color: '#F00' }} onClick={() => setShowHelp(true)} />
18 87
           </Radio.Group>
19 88
         </Form.Item>
20 89
         <div>基础热度即预设的预选数量,实际并不存在用户预选,用来美化数据。实际热度即真实用户预选数量,基础热度+实际热度=显示热度</div>
21 90
       </Form>
22
-      <HouseGrid dataset={} hotType={hotType} />
91
+      <HouseGrid dataset={blockList} hotType={hotType} />
92
+      <HelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} />
23 93
     </div>
24 94
   )
25 95
 }

+ 9
- 7
src/pages/house/edit/index.jsx 查看文件

@@ -58,6 +58,8 @@ function EditHouse(props) {
58 58
     setTab('preselectionRecord')
59 59
   }
60 60
 
61
+  const batchId = salesBatchData.salesBatchId || (props.location.query && props.location.query.id)
62
+
61 63
   return (
62 64
     <>
63 65
       <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
@@ -71,14 +73,14 @@ function EditHouse(props) {
71 73
         <Radio.Button value="visitRecord">访问记录</Radio.Button>
72 74
       </Radio.Group>
73 75
       <div style={{ marginTop: '20px' }}>
74
-        { (tab === 'base' && <Base salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }} onSuccess={e => buildingOnSuccess(e)}/>)} 
76
+        { (tab === 'base' && <Base salesBatchId={{ batchId }} onSuccess={e => buildingOnSuccess(e)}/>)} 
75 77
         { (tab === 'house' && <HouseTab salesBatchId={props.location.query.id} buildingId={props.location.query.buildingId} onSuccess={e => housTabChange(e)}/>)}
76
-        { (tab === 'poster' && <Poster salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
77
-        { (tab === 'share' && <Share salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
78
-        { (tab === 'preselectionImg' && <PreselectionImg />)}
79
-        { (tab === 'preselectionRecord' && <PreselectionRecord houseId={houseId} buildingId={props.location.query.buildingId} salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
80
-        { (tab === 'shareRecord' && <ShareRecord salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
81
-        { (tab === 'visitRecord' && <VisitRecord salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
78
+        { (tab === 'poster' && <Poster salesBatchId={{ batchId }}/>)}
79
+        { (tab === 'share' && <Share salesBatchId={{ batchId }}/>)}
80
+        { (tab === 'preselectionImg' && <PreselectionImg salesBatchId={batchId} />)}
81
+        { (tab === 'preselectionRecord' && <PreselectionRecord houseId={houseId} buildingId={props.location.query.buildingId} salesBatchId={{ batchId }}/>)}
82
+        { (tab === 'shareRecord' && <ShareRecord salesBatchId={{ batchId }}/>)}
83
+        { (tab === 'visitRecord' && <VisitRecord salesBatchId={{ batchId }}/>)}
82 84
       </div>
83 85
     </>
84 86
   )

+ 5
- 0
src/services/apis.js 查看文件

@@ -1183,6 +1183,11 @@ export default {
1183 1183
     url: `${prefix}/house/saveExcelValue`,
1184 1184
     method: 'POST',
1185 1185
     action: 'upload',
1186
+  },
1187
+  listHouseResources: {
1188
+    url: `${prefix}/listHousingResources`,
1189
+    method: 'GET',
1190
+    action: 'admin.taHousingResources.get',
1186 1191
   }
1187 1192
  },
1188 1193
 }