张延森 hace 5 años
padre
commit
59b0194fc0

+ 5
- 6
src/pages/house/edit/components/EnDash/index.jsx Ver fichero

2
 
2
 
3
 export default function EnDash(props) {
3
 export default function EnDash(props) {
4
     const { size = 1, color = '#999', style = {}, ...left } = props
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
         ...style,
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 Ver fichero

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 Ver fichero

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 Ver fichero

6
 
6
 
7
   return (
7
   return (
8
     <div className={Style.floor}>
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
         {roomList.map((room) => {
11
         {roomList.map((room) => {
12
           return (
12
           return (
13
             <div className={Style.item} key={room.houseId} >
13
             <div className={Style.item} key={room.houseId} >

+ 13
- 8
src/pages/house/edit/components/HouseGrid/Room.jsx Ver fichero

4
 import Style from './style.less'
4
 import Style from './style.less'
5
 
5
 
6
 export default function Room(props) {
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
   const handleClick = () => {
13
   const handleClick = () => {
11
     if (props.onClick) {
14
     if (props.onClick) {
13
     }
16
     }
14
   }
17
   }
15
 
18
 
19
+  const wanY = Number(price / 10000).toFixed(0)
20
+
16
   return (
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
       </div>
28
       </div>
24
     </HotBlock>
29
     </HotBlock>
25
   )
30
   )

+ 2
- 2
src/pages/house/edit/components/HouseGrid/Unit.jsx Ver fichero

6
 
6
 
7
   return (
7
   return (
8
     <div className={Style.unit}>
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
         {floorList.map(floor => props.render(floor))}
11
         {floorList.map(floor => props.render(floor))}
12
       </div>
12
       </div>
13
     </div>
13
     </div>

+ 6
- 4
src/pages/house/edit/components/HouseGrid/index.js Ver fichero

6
 
6
 
7
 
7
 
8
 export default function(props) {
8
 export default function(props) {
9
-  const { blockList = [] } = props.dataset || {}
9
+  const blockList = props.dataset || []
10
   
10
   
11
   // 仅仅是一个函数, 不是函数式组件
11
   // 仅仅是一个函数, 不是函数式组件
12
   function renderRoom(room) {
12
   function renderRoom(room) {
22
     <div>
22
     <div>
23
       {
23
       {
24
         blockList.map((block) => (
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
           </div>
32
           </div>
31
         ))
33
         ))
32
       }
34
       }

+ 21
- 16
src/pages/house/edit/components/HouseGrid/style.less Ver fichero

13
     color: #730000;
13
     color: #730000;
14
   }
14
   }
15
 
15
 
16
-  .tip {
17
-    color: #BB9C79;
18
-  }
19
-
20
-  .offline {
16
+  &.offline {
21
     color: #fff;
17
     color: #fff;
22
     background: #000;
18
     background: #000;
19
+    
20
+    .info, .warn {
21
+      color: #fff;
22
+    }
23
   }
23
   }
24
 }
24
 }
25
 
25
 
26
 .floor {
26
 .floor {
27
   display: flex;
27
   display: flex;
28
 
28
 
29
-  .head {
29
+  &-head {
30
     font-size: 20px;
30
     font-size: 20px;
31
     padding-top: 36px;
31
     padding-top: 36px;
32
     flex: none;
32
     flex: none;
33
     width: 14%;
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
     text-align: center;
40
     text-align: center;
39
     flex: auto;
41
     flex: auto;
40
     display: flex;
42
     display: flex;
41
     justify-content: flex-start;
43
     justify-content: flex-start;
42
-    flex-wrap: wrap;
44
+    overflow-x: auto;
43
 
45
 
44
     .item {
46
     .item {
45
-      width: 31%;
46
       flex: none;
47
       flex: none;
48
+      width: 110px;
47
 
49
 
48
       & + .item {
50
       & + .item {
49
           margin-left: 2%;
51
           margin-left: 2%;
53
 }
55
 }
54
 
56
 
55
 .unit {
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
     font-size: 22px;
63
     font-size: 22px;
59
-    line-height: 1.8em;
64
+    line-height: 44px;
60
     color: #000;
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 Ver fichero

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Button, Radio } from 'antd';
2
+import { Form, Button, Radio, Icon } from 'antd';
3
 import HouseGrid from './HouseGrid';
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
 const PreselectionImg = props => {
63
 const PreselectionImg = props => {
64
+  const salesBatchId = props.salesBatchId
7
   const [hotType, setHotType] = useState(1)
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
   return (
78
   return (
10
     <div>
79
     <div>
11
       <Form layout="inline">
80
       <Form layout="inline">
12
         <Form.Item label="热度选择">
81
         <Form.Item label="热度选择">
13
-          <Radio.Group onChange={setHotType} value={hotType}>
82
+          <Radio.Group onChange={e => setHotType(e.target.value)} value={hotType}>
14
             <Radio value={1}>基础热度</Radio>
83
             <Radio value={1}>基础热度</Radio>
15
             <Radio value={2}>实际热度</Radio>
84
             <Radio value={2}>实际热度</Radio>
16
             <Radio value={3}>显示热度</Radio>
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
           </Radio.Group>
87
           </Radio.Group>
19
         </Form.Item>
88
         </Form.Item>
20
         <div>基础热度即预设的预选数量,实际并不存在用户预选,用来美化数据。实际热度即真实用户预选数量,基础热度+实际热度=显示热度</div>
89
         <div>基础热度即预设的预选数量,实际并不存在用户预选,用来美化数据。实际热度即真实用户预选数量,基础热度+实际热度=显示热度</div>
21
       </Form>
90
       </Form>
22
-      <HouseGrid dataset={} hotType={hotType} />
91
+      <HouseGrid dataset={blockList} hotType={hotType} />
92
+      <HelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} />
23
     </div>
93
     </div>
24
   )
94
   )
25
 }
95
 }

+ 9
- 7
src/pages/house/edit/index.jsx Ver fichero

58
     setTab('preselectionRecord')
58
     setTab('preselectionRecord')
59
   }
59
   }
60
 
60
 
61
+  const batchId = salesBatchData.salesBatchId || (props.location.query && props.location.query.id)
62
+
61
   return (
63
   return (
62
     <>
64
     <>
63
       <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
65
       <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
71
         <Radio.Button value="visitRecord">访问记录</Radio.Button>
73
         <Radio.Button value="visitRecord">访问记录</Radio.Button>
72
       </Radio.Group>
74
       </Radio.Group>
73
       <div style={{ marginTop: '20px' }}>
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
         { (tab === 'house' && <HouseTab salesBatchId={props.location.query.id} buildingId={props.location.query.buildingId} onSuccess={e => housTabChange(e)}/>)}
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
       </div>
84
       </div>
83
     </>
85
     </>
84
   )
86
   )

+ 5
- 0
src/services/apis.js Ver fichero

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