Browse Source

静态页面

1002884655 3 years ago
parent
commit
578b8f0219

+ 36
- 26
src/pages/index/buildingDetail/components/BasicInfo/index.jsx View File

@@ -1,17 +1,17 @@
1
-import React, { useState, useEffect } from 'react'
2
-import './index.scss'
3
-import '../../../../../assets/css/iconfont.css'
1
+
2
+import '@/assets/css/iconfont.css'
4 3
 import { ScrollView, Image } from '@tarojs/components'
4
+import './index.scss'
5 5
 
6 6
 export default function BasicInfo (props) {
7
-  const { Data = {} } = props
7
+  const { Info = {} } = props
8 8
   return (
9 9
     <view className='components BasicInfo'>
10 10
 
11 11
       {/* 标题名称 */}
12 12
       <view className='Title flex-h'>
13 13
         <view className='flex-item'>
14
-          <text>葛洲坝·南京中国府高档小区</text>
14
+          <text>{Info.buildingName}</text>
15 15
         </view>
16 16
         <view className='Collect'>
17 17
           <text className='iconfont icon-shoucang'></text>
@@ -22,8 +22,8 @@ export default function BasicInfo (props) {
22 22
       {/* 标签 */}
23 23
       <view className='Tags'>
24 24
         {
25
-          ['全朝南', '品牌开发商', '轨交房'].map((item, index) => (
26
-            <text key={`TagItem-${index}`}>{item}</text>
25
+          (Info.buildingTag || []).map((item, index) => (
26
+            <text key={`TagItem-${index}`}>{item.tagName}</text>
27 27
           ))
28 28
         }
29 29
       </view>
@@ -32,25 +32,32 @@ export default function BasicInfo (props) {
32 32
       <view className='ProjectList'>
33 33
         <ScrollView scroll-x>
34 34
           {
35
-            ['', '', ''].map((item, index) => (
35
+            (Info.buildingProjectType || []).map((item, index) => (
36 36
               <view className='ListItem' key={`List-${index}`}>
37
-                <Image mode='heightFix' src={require('../../../../../assets/buildingDetail-icon4.jpg')} />
37
+                <Image mode='heightFix' src={require('@/assets/buildingDetail-icon4.jpg')} />
38 38
                 <view>
39 39
                   <view>
40 40
                     <text>项目类型:</text>
41
-                    <text className='active black'>公寓</text>
41
+                    <text className='active black'>{item.buildingTypeName}</text>
42 42
                   </view>
43 43
                   <view>
44 44
                     <text>房屋产权:</text>
45
-                    <text className='active'>40年</text>
45
+                    <text className='active'>{item.rightsYear}年</text>
46 46
                     <text>装修标准:</text>
47
-                    <text className='active'>毛坯</text>
47
+                    <text className='active'>{item.decoration || '暂无'}</text>
48 48
                   </view>
49 49
                   <view>
50 50
                     <text>项目参考价格:</text>
51
-                    <text className='active'>45-75万/套</text>
51
+                    {
52
+                      (item.startPrice || item.endPrice) &&
53
+                      <text className='active'>约{item.startPrice}-{item.endPrice}万/套</text>
54
+                    }
55
+                    {
56
+                      !(item.startPrice || item.endPrice) &&
57
+                      <text className='active'>暂无数据</text>
58
+                    }
52 59
                   </view>
53
-                  <text className='SaleStatus active'>在售</text>
60
+                  <text className='SaleStatus active'>{item.marketStatus}</text>
54 61
                 </view>
55 62
               </view>
56 63
             ))
@@ -68,7 +75,7 @@ export default function BasicInfo (props) {
68 75
             <text>楼盘地址:</text>
69 76
           </view>
70 77
           <view className='flex-item3'>
71
-            <text className='active'>南京市建邺区友谊街与建邺路交汇处235号</text>
78
+            <text className='active'>{Info.address}</text>
72 79
           </view>
73 80
         </view>
74 81
         <view className='flex-h'>
@@ -76,7 +83,7 @@ export default function BasicInfo (props) {
76 83
             <text>开盘时间:</text>
77 84
           </view>
78 85
           <view className='flex-item3'>
79
-            <text className='active'>2019年8月5日</text>
86
+            <text className='active'>{Info.openingDate || '待定'}</text>
80 87
           </view>
81 88
         </view>
82 89
         <view className='flex-h'>
@@ -84,13 +91,13 @@ export default function BasicInfo (props) {
84 91
             <text>容积率:</text>
85 92
           </view>
86 93
           <view className='flex-item'>
87
-            <text className='active'>1.5</text>
94
+            <text className='active'>{Info.volumeRate || '暂无'}</text>
88 95
           </view>
89 96
           <view className='flex-item'>
90 97
             <text>车位比率:</text>
91 98
           </view>
92 99
           <view className='flex-item'>
93
-            <text className='active'>1 : 200</text>
100
+            <text className='active'>{Info.parkingRate || '暂无'}</text>
94 101
           </view>
95 102
         </view>
96 103
         <view className='flex-h'>
@@ -98,13 +105,13 @@ export default function BasicInfo (props) {
98 105
             <text>绿化率:</text>
99 106
           </view>
100 107
           <view className='flex-item'>
101
-            <text className='active'>40%</text>
108
+            <text className='active'>{Info.greeningRate || '暂无'}</text>
102 109
           </view>
103 110
           <view className='flex-item'>
104 111
             <text>物业费:</text>
105 112
           </view>
106 113
           <view className='flex-item'>
107
-            <text className='active'>1.9元/㎡/月</text>
114
+            <text className='active'>{Info.serviceFee || '暂无'}</text>
108 115
           </view>
109 116
         </view>
110 117
         <view className='flex-h'>
@@ -112,29 +119,32 @@ export default function BasicInfo (props) {
112 119
             <text>规划户数:</text>
113 120
           </view>
114 121
           <view className='flex-item'>
115
-            <text className='active'>2000</text>
122
+            <text className='active'>{Info.familyNum || '暂无'}</text>
116 123
           </view>
117 124
           <view className='flex-item'>
118 125
             <text>物业:</text>
119 126
           </view>
120 127
           <view className='flex-item'>
121
-            <text className='active'>万科物业</text>
128
+            <text className='active'>{Info.serviceCompany || '暂无'}</text>
122 129
           </view>
123 130
         </view>
124 131
       </view>
125 132
 
126 133
       {/* 围观 */}
127 134
       <view className='Views flex-h'>
128
-          <text>28人围观</text>
135
+          <text>{Info.pvNum || 0}人围观</text>
129 136
           <view className='flex-item'>
130 137
             {
131
-              ['', '', '', '', '', ''].map((item, index) => (
138
+              (Info?.uvList?.records || []).slice(0, 8).map((item, index) => (
132 139
                 <view key={`ViewsItem-${index}`}>
133
-                  <Image mode='aspectFill' className='centerLabel' src={null} />
140
+                  <Image mode='aspectFill' className='centerLabel' src={item.photoOravatar} />
134 141
                 </view>
135 142
               ))
136 143
             }
137
-            <text>...</text>
144
+            {
145
+              (Info?.uvList?.records || []).length > 8 &&
146
+              <text>...</text>
147
+            }
138 148
           </view>
139 149
       </view>
140 150
 

+ 28
- 4
src/pages/index/buildingDetail/index.jsx View File

@@ -1,8 +1,11 @@
1 1
 import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3 3
 import { ScrollView } from '@tarojs/components'
4
+import '@/assets/css/iconfont.css'
5
+import { useSelector } from 'react-redux'
6
+import { fetch } from '@/utils/request'
7
+import { API_ITEMS_DETAIL } from '@/constants/api'
4 8
 import './index.scss'
5
-import '../../../assets/css/iconfont.css'
6 9
 import DetailBottom from './components/DetailBottom/index'
7 10
 import BasicInfo from './components/BasicInfo/index'
8 11
 import SpecialPriceHouse from './components/SpecialPriceHouse/index'
@@ -15,11 +18,32 @@ import LivingActivity from './components/LivingActivity/index'
15 18
 import News from './components/News/index'
16 19
 import Pictures from './components/Pictures/index'
17 20
 
18
-export default withLayout(() => {
19
-
21
+export default withLayout((props) => {
22
+  
23
+  const user = useSelector(state => state.user)
24
+  const [PersonId, setPersonId] = useState(null)
25
+  const [DetailInfo, setDetailInfo] = useState({})
20 26
   const [IsPull, setPull] = useState(false)
21 27
   const [PullTimer, setPullTimer] = useState(null)
22 28
 
29
+  useEffect(() => {
30
+    if(user?.userInfo?.person?.personId) {
31
+      setPersonId(user.userInfo.person.personId)
32
+    }
33
+  }, [user])
34
+
35
+  useEffect(() => {
36
+    if(PersonId) {
37
+      GetBuildingDetail()
38
+    }
39
+  }, [PersonId])
40
+
41
+  const GetBuildingDetail = () => { // 获取楼盘信息
42
+    fetch({ url: `${API_ITEMS_DETAIL}/${props.router.params.id}`, method: 'get'}).then((res) => {
43
+      setDetailInfo(res || {})
44
+    })
45
+  }
46
+
23 47
   const PageRefresh = () => { // 页面下拉刷新回调
24 48
     setPull(true)
25 49
   }
@@ -55,7 +79,7 @@ export default withLayout(() => {
55 79
 
56 80
                 {/* 基本信息 */}
57 81
                 <view className='BasicInfo'>
58
-                  <BasicInfo></BasicInfo>
82
+                  <BasicInfo Info={DetailInfo}></BasicInfo>
59 83
                 </view>
60 84
 
61 85
                 {/* 特价房源 */}

+ 1
- 1
src/pages/index/helpToFindHouse/components/BuyHouse/formData.js View File

@@ -38,7 +38,7 @@ const questions = [
38 38
   },
39 39
   {
40 40
     question: '你想买的区域是?',
41
-    key: 'district',
41
+    key: 'intentArea',
42 42
     type: 'select',
43 43
     result: '',
44 44
     resultId: null,

+ 28
- 16
src/pages/index/helpToFindHouse/components/BuyHouse/index.jsx View File

@@ -1,12 +1,12 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2
+import '@/assets/css/iconfont.css'
3
+import { Image, Slider, Textarea, Picker } from '@tarojs/components'
2 4
 import './index.scss'
3
-import '../../../../../assets/css/iconfont.css'
4
-import { Image, Slider, Textarea } from '@tarojs/components'
5 5
 import SubmitBuyHouseResult from '../SubmitBuyHouseResult/index'
6 6
 import questions from './formData'
7 7
 
8 8
 export default function BuyHouse (props) {
9
-  const { change = () => { }, toSubmit = () => {} } = props
9
+  const { change = () => { }, toSubmit = () => { }, CityList = [] } = props
10 10
 
11 11
   const [FormData, setFormData] = useState(questions)
12 12
 
@@ -15,14 +15,17 @@ export default function BuyHouse (props) {
15 15
 
16 16
   const [ShowPopup, setShowPopup] = useState(false)
17 17
 
18
+  const [CityName, setCityName] = useState(null)
19
+  const [CityId, setCityId] = useState(null)
20
+
18 21
   useEffect(() => {
19
-    if(StepId === 1) {
22
+    if (StepId === 1) {
20 23
       setStepRange([0, 4])
21
-    } else if(StepId === 2) {
24
+    } else if (StepId === 2) {
22 25
       setStepRange([4, 7])
23
-    } else if(StepId === 3) {
26
+    } else if (StepId === 3) {
24 27
       setStepRange([7, 10])
25
-    } else if(StepId === 4) {
28
+    } else if (StepId === 4) {
26 29
       setStepRange([10, 12])
27 30
     }
28 31
     change(StepId)
@@ -59,7 +62,7 @@ export default function BuyHouse (props) {
59 62
     if (StepId < 4) {
60 63
       setStepId(StepId + 1)
61 64
     } else {
62
-      toSubmit(FormData)
65
+      toSubmit(FormData.concat([{result: CityId, key: 'intentArea'}]))
63 66
     }
64 67
   }
65 68
 
@@ -69,6 +72,11 @@ export default function BuyHouse (props) {
69 72
     }
70 73
   }
71 74
 
75
+  const PickerChange = (e) => {
76
+    setCityName(CityList[e.detail.value - 0].name)
77
+    setCityId(CityList[e.detail.value - 0].id)
78
+  }
79
+
72 80
   return (
73 81
     <view className='components BuyHouse'>
74 82
       {
@@ -89,7 +97,7 @@ export default function BuyHouse (props) {
89 97
                       item.options.map((subItem, subIndex) => (
90 98
                         <view key={`${item.key}-${subIndex}`} className={item.resultId === subItem.id ? 'active' : ''} onClick={CutCheckbox(subItem, index)}>
91 99
                           {subItem.name}
92
-                          <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
100
+                          <Image mode='heightFix' src={require('@/assets/findHouse-icon1.png')}></Image>
93 101
                         </view>
94 102
                       ))
95 103
                     }
@@ -98,14 +106,14 @@ export default function BuyHouse (props) {
98 106
                 {
99 107
                   item.type === 'checkbox' && item.remark !== undefined &&
100 108
                   <view className='Textarea'>
101
-                    <Textarea placeholder="请说出您的其他需求,让我们更好的为您服务!" onInput={(e) => {remarkInput(e, index)}} />
109
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => { remarkInput(e, index) }} />
102 110
                   </view>
103 111
                 }
104 112
                 {
105 113
                   item.type === 'range' &&
106 114
                   <view className='RangeList flex-h'>
107 115
                     <view className='flex-item'>
108
-                      <Slider activeColor="#193C83" block-color="#fff" onChange={(e) => { Rangehange(e, index) }} min={item.options[0]} max={item.options[1]} show-value />
116
+                      <Slider activeColor='#193C83' block-color='#fff' onChange={(e) => { Rangehange(e, index) }} min={item.options[0]} max={item.options[1]} show-value />
109 117
                     </view>
110 118
                     <text>万</text>
111 119
                   </view>
@@ -115,11 +123,15 @@ export default function BuyHouse (props) {
115 123
                   <view className='Area'>
116 124
                     <view className='flex-h'>
117 125
                       {
118
-                        item.key === 'district' &&
126
+                        item.key === 'intentArea' &&
119 127
                         <text className='iconfont icon-dingwei'></text>
120 128
                       }
121
-                      <text>不限</text>
122
-                      <view className='flex-item'></view>
129
+                      {/* <text>不限</text> */}
130
+                      <view className='flex-item'>
131
+                        <Picker range-key='name' onChange={PickerChange} value={0} range={CityList}>
132
+                          <text>{CityName || '请选择'}</text>
133
+                        </Picker>
134
+                      </view>
123 135
                       <text className='iconfont icon-jiantoudown'></text>
124 136
                     </view>
125 137
                   </view>
@@ -127,7 +139,7 @@ export default function BuyHouse (props) {
127 139
                 {
128 140
                   item.type === 'textarea' &&
129 141
                   <view className='Textarea'>
130
-                    <Textarea placeholder="请说出您的其他需求,让我们更好的为您服务!" onInput={(e) => {textareaInput(e, index)}} />
142
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => { textareaInput(e, index) }} />
131 143
                   </view>
132 144
                 }
133 145
               </view>

+ 52
- 0
src/pages/index/helpToFindHouse/components/HousePurchasing/formData.js View File

@@ -0,0 +1,52 @@
1
+const questions = [
2
+  {
3
+    question: '你想买的国家和地区是?',
4
+    key: 'intentArea',
5
+    type: 'textarea',
6
+    result: '',
7
+    resultId: null
8
+  },
9
+  {
10
+    question: '你的购房预算是多少?',
11
+    key: 'budget',
12
+    type: 'range',
13
+    result: '',
14
+    resultId: null,
15
+    options: [100, 500]
16
+  },
17
+  {
18
+    question: '优先选择的房屋类型是?',
19
+    key: 'isNew',
20
+    type: 'checkbox',
21
+    result: '',
22
+    resultId: null,
23
+    options: [
24
+      { name: '新房', id: 1 },
25
+      { name: '二手房', id: 2 },
26
+      { name: '不限', id: 3 }
27
+    ]
28
+  },
29
+  {
30
+    question: '你的购房目的是?',
31
+    key: 'layout',
32
+    type: 'checkbox',
33
+    result: '',
34
+    resultId: null,
35
+    options: [
36
+      { name: '投资', id: 1 },
37
+      { name: '移民', id: 2 },
38
+      { name: '留学', id: 3 },
39
+      { name: '养老', id: 4 },
40
+      { name: '度假', id: 5 }
41
+    ]
42
+  },
43
+  {
44
+    question: '您还有哪些需要备注的信息?',
45
+    key: 'remark',
46
+    type: 'textarea',
47
+    result: '',
48
+    resultId: null
49
+  },
50
+]
51
+
52
+export default questions

+ 82
- 265
src/pages/index/helpToFindHouse/components/HousePurchasing/index.jsx View File

@@ -1,137 +1,59 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2
+import '@/assets/css/iconfont.css'
3
+import { Image, Slider, Textarea } from '@tarojs/components'
2 4
 import './index.scss'
3
-import '../../../../../assets/css/iconfont.css'
4
-import { Image, Input, Slider, Textarea } from '@tarojs/components'
5 5
 import SubmitBuyHouseResult from '../SubmitBuyHouseResult/index'
6
+import questions from './formData'
6 7
 
7 8
 export default function HousePurchasing (props) {
8
-  const { change = () => { } } = props
9
+  const { change = () => { }, toSubmit = () => {} } = props
9 10
 
10
-  const [SingleList] = useState([
11
-    { name: '首套', id: 1 },
12
-    { name: '二套', id: 2 }
13
-  ])
14
-  const [CurrnetSingleId, setCurrnetSingleId] = useState(null)
15
-
16
-  const [NewOldList] = useState([
17
-    { name: '新房', id: 1 },
18
-    { name: '二手房', id: 2 }
19
-  ])
20
-  const [CurrnetNewOldId, setCurrnetNewOldId] = useState(null)
21
-
22
-  const [HouseTypeList] = useState([
23
-    { name: '一室一厅', id: 1 },
24
-    { name: '二室一厅', id: 2 },
25
-    { name: '二室二厅', id: 3 },
26
-    { name: '三室一厅', id: 4 },
27
-    { name: '三室二厅', id: 5 },
28
-    { name: '四室一厅', id: 6 },
29
-    { name: '四室二厅', id: 7 },
30
-    { name: '五室及以上', id: 8 }
31
-  ])
32
-  const [CurrnetHouseTypeId, setCurrnetHouseTypeId] = useState(null)
33
-
34
-  const [AreaList] = useState([
35
-    { name: '60㎡以下', id: 1 },
36
-    { name: '60-90㎡', id: 2 },
37
-    { name: '90-110㎡', id: 3 },
38
-    { name: '110-130㎡', id: 4 },
39
-    { name: '130-150㎡', id: 5 },
40
-    { name: '150-200㎡', id: 6 },
41
-    { name: '200㎡以上', id: 7 }
42
-  ])
43
-  const [CurrnetAreaId, setCurrnetAreaId] = useState(null)
44
-
45
-  const [PreferenceList] = useState([
46
-    { name: '南北通透', id: 1 },
47
-    { name: '朝南', id: 2 },
48
-    { name: '低楼层', id: 3 },
49
-    { name: '高楼层', id: 4 },
50
-    { name: '精装修', id: 5 },
51
-    { name: '电梯房', id: 6 },
52
-    { name: '近地铁', id: 7 },
53
-    { name: '满五年', id: 8 },
54
-    { name: '满两年', id: 9 },
55
-    { name: '楼龄5年内', id: 10 },
56
-    { name: '楼龄10年内', id: 11 }
57
-  ])
58
-  const [CurrnetPreferenceId, setCurrnetPreferenceId] = useState(null)
59
-
60
-  const [GoalList] = useState([
61
-    { name: '刚需', id: 1 },
62
-    { name: '结婚', id: 2 },
63
-    { name: '养老', id: 3 },
64
-    { name: '改善', id: 4 },
65
-    { name: '教育', id: 5 },
66
-    { name: '投资', id: 6 }
67
-  ])
68
-  const [CurrnetGoalId, setCurrnetGoalId] = useState(null)
69
-
70
-  const [LongTimeList] = useState([
71
-    { name: '1月内', id: 1 },
72
-    { name: '6个月', id: 2 },
73
-    { name: '1年内', id: 3 },
74
-    { name: '1年后', id: 4 }
75
-  ])
76
-  const [CurrnetLongTimeId, setCurrnetLongTimeId] = useState(null)
11
+  const [FormData, setFormData] = useState(questions)
77 12
 
78 13
   const [StepId, setStepId] = useState(1)
14
+  const [StepRange, setStepRange] = useState([0, 5])
79 15
 
80 16
   const [ShowPopup, setShowPopup] = useState(false)
81 17
 
82 18
   useEffect(() => {
19
+    if(StepId === 1) {
20
+      setStepRange([0, 5])
21
+    }
83 22
     change(StepId)
84 23
   }, [StepId])
85 24
 
86
-  const CutSingleId = (id) => {
25
+  const CutCheckbox = (item, index) => {
87 26
     return () => {
88
-      setCurrnetSingleId(id === CurrnetSingleId ? null : id)
27
+      let newFormData = [...FormData]
28
+      newFormData[index].resultId = item.id
29
+      newFormData[index].result = item.name
30
+      setFormData([...newFormData])
89 31
     }
90 32
   }
91 33
 
92
-  const CutNewOldId = (id) => {
93
-    return () => {
94
-      setCurrnetNewOldId(id === CurrnetNewOldId ? null : id)
95
-    }
34
+  const Rangehange = (e, index) => {
35
+    let newFormData = [...FormData]
36
+    newFormData[index].result = e.detail.value
37
+    setFormData([...newFormData])
96 38
   }
97 39
 
98
-  const CutHouseTypeId = (id) => {
99
-    return () => {
100
-      setCurrnetHouseTypeId(id === CurrnetHouseTypeId ? null : id)
101
-    }
40
+  const remarkInput = (e, index) => {
41
+    let newFormData = [...FormData]
42
+    newFormData[index].remark = e.detail.value
43
+    setFormData([...newFormData])
102 44
   }
103 45
 
104
-  const CutAreaId = (id) => {
105
-    return () => {
106
-      setCurrnetAreaId(id === CurrnetAreaId ? null : id)
107
-    }
108
-  }
109
-
110
-  const CutPreferenceId = (id) => {
111
-    return () => {
112
-      setCurrnetPreferenceId(id === CurrnetPreferenceId ? null : id)
113
-    }
114
-  }
115
-
116
-  const CutGoalId = (id) => {
117
-    return () => {
118
-      setCurrnetGoalId(id === CurrnetGoalId ? null : id)
119
-    }
120
-  }
121
-
122
-  const CutLongTimeId = (id) => {
123
-    return () => {
124
-      setCurrnetLongTimeId(id === CurrnetLongTimeId ? null : id)
125
-    }
126
-  }
127
-
128
-  const PriceRangehange = (e) => {
129
-    console.log(e)
46
+  const textareaInput = (e, index) => {
47
+    let newFormData = [...FormData]
48
+    newFormData[index].result = e.detail.value
49
+    setFormData([...newFormData])
130 50
   }
131 51
 
132 52
   const NextStep = () => {
133
-    if (StepId < 4) {
53
+    if (StepId < 1) {
134 54
       setStepId(StepId + 1)
55
+    } else {
56
+      toSubmit(FormData)
135 57
     }
136 58
   }
137 59
 
@@ -142,175 +64,70 @@ export default function HousePurchasing (props) {
142 64
   }
143 65
 
144 66
   return (
145
-    <view className='components HousePurchasing'>
67
+    <view className='components BuyHouse'>
146 68
       {
147 69
         ShowPopup &&
148 70
         <SubmitBuyHouseResult></SubmitBuyHouseResult>
149 71
       }
150 72
       {
151
-        StepId === 1 &&
152
-        <view className='Step'>
153
-          <view>
154
-            <text>意向区域</text>
155
-            <view className='Area'>
156
-              <view className='flex-h'>
157
-                <text className='iconfont icon-dingwei'></text>
158
-                <text>不限</text>
159
-                <view className='flex-item'></view>
160
-                <text className='iconfont icon-jiantoudown'></text>
161
-              </view>
162
-            </view>
163
-          </view>
164
-
165
-          <view>
166
-            <text>意向楼盘</text>
167
-            <view className='Purpose'>
73
+        FormData.map((item, index) => (
74
+          <view className='Step' key={`Form-${index}`}>
75
+            {
76
+              index >= StepRange[0] && index < StepRange[1] &&
168 77
               <view>
169
-                <Input placeholder="请输入意向楼盘" />
170
-              </view>
171
-            </view>
172
-          </view>
173
-
174
-          <view>
175
-            <text>您想购买的是首套房还是二套房?</text>
176
-            <view className='CheckList'>
177
-              {
178
-                SingleList.map((item, index) => (
179
-                  <view key={`SingleItem-${index}`} className={CurrnetSingleId === item.id ? 'active' : ''} onClick={CutSingleId(item.id)}>
180
-                    {item.name}
181
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
182
-                  </view>
183
-                ))
184
-              }
185
-            </view>
186
-          </view>
187
-
188
-          <view>
189
-            <text>总价预算范围</text>
190
-            <view className='PriceRange'>
191
-              <view className='flex-h'>
192
-                <view className='flex-item'>
193
-                  <Input placeholder="最小面积㎡" />
194
-                </view>
195
-                <text>-</text>
196
-                <view className='flex-item'>
197
-                  <Input placeholder="最大面积㎡" />
198
-                </view>
199
-              </view>
200
-            </view>
201
-          </view>
202
-        </view>
203
-      }
204
-
205
-      {
206
-        StepId === 2 &&
207
-        <view className='Step'>
208
-          <view>
209
-            <text>您想购买的是二手房还是新房?</text>
210
-            <view className='CheckList'>
211
-              {
212
-                NewOldList.map((item, index) => (
213
-                  <view key={`NewOldItem-${index}`} className={CurrnetNewOldId === item.id ? 'active' : ''} onClick={CutNewOldId(item.id)}>
214
-                    {item.name}
215
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
216
-                  </view>
217
-                ))
218
-              }
219
-            </view>
220
-          </view>
221
-          <view>
222
-            <text>居室要求</text>
223
-            <view className='CheckList'>
224
-              {
225
-                HouseTypeList.map((item, index) => (
226
-                  <view key={`HouseTypeItem-${index}`} className={CurrnetHouseTypeId === item.id ? 'active' : ''} onClick={CutHouseTypeId(item.id)}>
227
-                    {item.name}
228
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
78
+                <text>{item.question}</text>
79
+                {
80
+                  item.type === 'checkbox' &&
81
+                  <view className='CheckList'>
82
+                    {
83
+                      item.options.map((subItem, subIndex) => (
84
+                        <view key={`${item.key}-${subIndex}`} className={item.resultId === subItem.id ? 'active' : ''} onClick={CutCheckbox(subItem, index)}>
85
+                          {subItem.name}
86
+                          <Image mode='heightFix' src={require('@/assets/findHouse-icon1.png')}></Image>
87
+                        </view>
88
+                      ))
89
+                    }
229 90
                   </view>
230
-                ))
231
-              }
232
-            </view>
233
-          </view>
234
-          <view>
235
-            <text>面积要求</text>
236
-            <view className='CheckList'>
237
-              {
238
-                AreaList.map((item, index) => (
239
-                  <view key={`AreaItem-${index}`} className={CurrnetAreaId === item.id ? 'active' : ''} onClick={CutAreaId(item.id)}>
240
-                    {item.name}
241
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
91
+                }
92
+                {
93
+                  item.type === 'checkbox' && item.remark !== undefined &&
94
+                  <view className='Textarea'>
95
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => {remarkInput(e, index)}} />
242 96
                   </view>
243
-                ))
244
-              }
245
-            </view>
246
-          </view>
247
-        </view>
248
-      }
249
-
250
-      {
251
-        StepId === 3 &&
252
-        <view className='Step'>
253
-          <view>
254
-            <text>价格要求</text>
255
-            <view className='RangeList flex-h'>
256
-              <view className='flex-item'>
257
-                <Slider activeColor="#193C83" block-color="#fff" change={PriceRangehange} min="50" max="200" show-value />
258
-              </view>
259
-              <text>万</text>
260
-            </view>
261
-          </view>
262
-          <view>
263
-            <text>偏好设置</text>
264
-            <view className='CheckList'>
265
-              {
266
-                PreferenceList.map((item, index) => (
267
-                  <view key={`PreferenceItem-${index}`} className={CurrnetPreferenceId === item.id ? 'active' : ''} onClick={CutPreferenceId(item.id)}>
268
-                    {item.name}
269
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
97
+                }
98
+                {
99
+                  item.type === 'range' &&
100
+                  <view className='RangeList flex-h'>
101
+                    <view className='flex-item'>
102
+                      <Slider activeColor='#193C83' block-color='#fff' onChange={(e) => { Rangehange(e, index) }} min={item.options[0]} max={item.options[1]} show-value />
103
+                    </view>
104
+                    <text>万</text>
270 105
                   </view>
271
-                ))
272
-              }
273
-            </view>
274
-          </view>
275
-          <view>
276
-            <text>购房目的</text>
277
-            <view className='CheckList'>
278
-              {
279
-                GoalList.map((item, index) => (
280
-                  <view key={`GoalItem-${index}`} className={CurrnetGoalId === item.id ? 'active' : ''} onClick={CutGoalId(item.id)}>
281
-                    {item.name}
282
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
106
+                }
107
+                {
108
+                  item.type === 'select' &&
109
+                  <view className='Area'>
110
+                    <view className='flex-h'>
111
+                      {
112
+                        item.key === 'district' &&
113
+                        <text className='iconfont icon-dingwei'></text>
114
+                      }
115
+                      <text>不限</text>
116
+                      <view className='flex-item'></view>
117
+                      <text className='iconfont icon-jiantoudown'></text>
118
+                    </view>
283 119
                   </view>
284
-                ))
285
-              }
286
-            </view>
287
-          </view>
288
-        </view>
289
-      }
290
-
291
-      {
292
-        StepId === 4 &&
293
-        <view className='Step'>
294
-          <view>
295
-            <text>计划在多久购房?</text>
296
-            <view className='CheckList'>
297
-              {
298
-                LongTimeList.map((item, index) => (
299
-                  <view key={`LongTimeItem-${index}`} className={CurrnetLongTimeId === item.id ? 'active' : ''} onClick={CutLongTimeId(item.id)}>
300
-                    {item.name}
301
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
120
+                }
121
+                {
122
+                  item.type === 'textarea' &&
123
+                  <view className='Textarea'>
124
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => {textareaInput(e, index)}} />
302 125
                   </view>
303
-                ))
304
-              }
305
-            </view>
306
-          </view>
307
-          <view>
308
-            <text>您还有哪些需要备注的信息?</text>
309
-            <view className='Textarea'>
310
-              <Textarea placeholder="请说出您的其他需求,让我们更好的为您服务!" />
311
-            </view>
126
+                }
127
+              </view>
128
+            }
312 129
           </view>
313
-        </view>
130
+        ))
314 131
       }
315 132
 
316 133
       <view className='Btn'>

+ 72
- 0
src/pages/index/helpToFindHouse/components/RentingHouse/formData.js View File

@@ -0,0 +1,72 @@
1
+const questions = [
2
+  {
3
+    question: '你的租房预算是多少/月?',
4
+    key: 'budget',
5
+    type: 'range',
6
+    result: '',
7
+    resultId: null,
8
+    options: [500, 4500]
9
+  },
10
+  {
11
+    question: '你的租房偏好?',
12
+    key: 'preference',
13
+    type: 'checkbox',
14
+    result: '',
15
+    resultId: null,
16
+    options: [
17
+      { name: '整租', id: 1 },
18
+      { name: '合租', id: 2 },
19
+      { name: '不限', id: 3 }
20
+    ]
21
+  },
22
+  {
23
+    question: '你想租几居室的房子?',
24
+    key: 'layout',
25
+    type: 'checkbox',
26
+    result: '',
27
+    resultId: null,
28
+    options: [
29
+      { name: '一室', id: 1 },
30
+      { name: '二室', id: 2 },
31
+      { name: '三室', id: 3 },
32
+      { name: '四室', id: 4 },
33
+      { name: '五室及以上', id: 5 }
34
+    ]
35
+  },
36
+  {
37
+    question: '你想在哪租房?',
38
+    key: 'intentArea',
39
+    type: 'select',
40
+    result: '',
41
+    resultId: null,
42
+    options: []
43
+  },
44
+  {
45
+    question: '其他要求?',
46
+    key: 'purpose',
47
+    type: 'checkbox',
48
+    result: '',
49
+    resultId: null,
50
+    options: [
51
+      { name: '独卫', id: 1 },
52
+      { name: '近地铁', id: 2 },
53
+      { name: '拎包入住', id: 3 },
54
+      { name: '精装修', id: 4 },
55
+      { name: '独立阳台', id: 5 },
56
+      { name: '集中供暖', id: 6 },
57
+      { name: '押一付一', id: 7 },
58
+      { name: '双卫', id: 8 },
59
+      { name: '新上', id: 9 },
60
+      { name: '认证公寓', id: 10 }
61
+    ]
62
+  },
63
+  {
64
+    question: '您还有哪些特殊要求?',
65
+    key: 'remark',
66
+    type: 'textarea',
67
+    result: '',
68
+    resultId: null
69
+  },
70
+]
71
+
72
+export default questions

+ 84
- 265
src/pages/index/helpToFindHouse/components/RentingHouse/index.jsx View File

@@ -1,137 +1,61 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2
+import '@/assets/css/iconfont.css'
3
+import { Image, Slider, Textarea } from '@tarojs/components'
2 4
 import './index.scss'
3
-import '../../../../../assets/css/iconfont.css'
4
-import { Image, Input, Slider, Textarea } from '@tarojs/components'
5 5
 import SubmitBuyHouseResult from '../SubmitBuyHouseResult/index'
6
+import questions from './formData'
6 7
 
7 8
 export default function RentingHouse (props) {
8
-  const { change = () => { } } = props
9
+  const { change = () => { }, toSubmit = () => {} } = props
9 10
 
10
-  const [SingleList] = useState([
11
-    { name: '首套', id: 1 },
12
-    { name: '二套', id: 2 }
13
-  ])
14
-  const [CurrnetSingleId, setCurrnetSingleId] = useState(null)
15
-
16
-  const [NewOldList] = useState([
17
-    { name: '新房', id: 1 },
18
-    { name: '二手房', id: 2 }
19
-  ])
20
-  const [CurrnetNewOldId, setCurrnetNewOldId] = useState(null)
21
-
22
-  const [HouseTypeList] = useState([
23
-    { name: '一室一厅', id: 1 },
24
-    { name: '二室一厅', id: 2 },
25
-    { name: '二室二厅', id: 3 },
26
-    { name: '三室一厅', id: 4 },
27
-    { name: '三室二厅', id: 5 },
28
-    { name: '四室一厅', id: 6 },
29
-    { name: '四室二厅', id: 7 },
30
-    { name: '五室及以上', id: 8 }
31
-  ])
32
-  const [CurrnetHouseTypeId, setCurrnetHouseTypeId] = useState(null)
33
-
34
-  const [AreaList] = useState([
35
-    { name: '60㎡以下', id: 1 },
36
-    { name: '60-90㎡', id: 2 },
37
-    { name: '90-110㎡', id: 3 },
38
-    { name: '110-130㎡', id: 4 },
39
-    { name: '130-150㎡', id: 5 },
40
-    { name: '150-200㎡', id: 6 },
41
-    { name: '200㎡以上', id: 7 }
42
-  ])
43
-  const [CurrnetAreaId, setCurrnetAreaId] = useState(null)
44
-
45
-  const [PreferenceList] = useState([
46
-    { name: '南北通透', id: 1 },
47
-    { name: '朝南', id: 2 },
48
-    { name: '低楼层', id: 3 },
49
-    { name: '高楼层', id: 4 },
50
-    { name: '精装修', id: 5 },
51
-    { name: '电梯房', id: 6 },
52
-    { name: '近地铁', id: 7 },
53
-    { name: '满五年', id: 8 },
54
-    { name: '满两年', id: 9 },
55
-    { name: '楼龄5年内', id: 10 },
56
-    { name: '楼龄10年内', id: 11 }
57
-  ])
58
-  const [CurrnetPreferenceId, setCurrnetPreferenceId] = useState(null)
59
-
60
-  const [GoalList] = useState([
61
-    { name: '刚需', id: 1 },
62
-    { name: '结婚', id: 2 },
63
-    { name: '养老', id: 3 },
64
-    { name: '改善', id: 4 },
65
-    { name: '教育', id: 5 },
66
-    { name: '投资', id: 6 }
67
-  ])
68
-  const [CurrnetGoalId, setCurrnetGoalId] = useState(null)
69
-
70
-  const [LongTimeList] = useState([
71
-    { name: '1月内', id: 1 },
72
-    { name: '6个月', id: 2 },
73
-    { name: '1年内', id: 3 },
74
-    { name: '1年后', id: 4 }
75
-  ])
76
-  const [CurrnetLongTimeId, setCurrnetLongTimeId] = useState(null)
11
+  const [FormData, setFormData] = useState(questions)
77 12
 
78 13
   const [StepId, setStepId] = useState(1)
14
+  const [StepRange, setStepRange] = useState([0, 4])
79 15
 
80 16
   const [ShowPopup, setShowPopup] = useState(false)
81 17
 
82 18
   useEffect(() => {
19
+    if(StepId === 1) {
20
+      setStepRange([0, 4])
21
+    } else if(StepId === 2) {
22
+      setStepRange([4, 6])
23
+    }
83 24
     change(StepId)
84 25
   }, [StepId])
85 26
 
86
-  const CutSingleId = (id) => {
27
+  const CutCheckbox = (item, index) => {
87 28
     return () => {
88
-      setCurrnetSingleId(id === CurrnetSingleId ? null : id)
29
+      let newFormData = [...FormData]
30
+      newFormData[index].resultId = item.id
31
+      newFormData[index].result = item.name
32
+      setFormData([...newFormData])
89 33
     }
90 34
   }
91 35
 
92
-  const CutNewOldId = (id) => {
93
-    return () => {
94
-      setCurrnetNewOldId(id === CurrnetNewOldId ? null : id)
95
-    }
36
+  const Rangehange = (e, index) => {
37
+    let newFormData = [...FormData]
38
+    newFormData[index].result = e.detail.value
39
+    setFormData([...newFormData])
96 40
   }
97 41
 
98
-  const CutHouseTypeId = (id) => {
99
-    return () => {
100
-      setCurrnetHouseTypeId(id === CurrnetHouseTypeId ? null : id)
101
-    }
42
+  const remarkInput = (e, index) => {
43
+    let newFormData = [...FormData]
44
+    newFormData[index].remark = e.detail.value
45
+    setFormData([...newFormData])
102 46
   }
103 47
 
104
-  const CutAreaId = (id) => {
105
-    return () => {
106
-      setCurrnetAreaId(id === CurrnetAreaId ? null : id)
107
-    }
108
-  }
109
-
110
-  const CutPreferenceId = (id) => {
111
-    return () => {
112
-      setCurrnetPreferenceId(id === CurrnetPreferenceId ? null : id)
113
-    }
114
-  }
115
-
116
-  const CutGoalId = (id) => {
117
-    return () => {
118
-      setCurrnetGoalId(id === CurrnetGoalId ? null : id)
119
-    }
120
-  }
121
-
122
-  const CutLongTimeId = (id) => {
123
-    return () => {
124
-      setCurrnetLongTimeId(id === CurrnetLongTimeId ? null : id)
125
-    }
126
-  }
127
-
128
-  const PriceRangehange = (e) => {
129
-    console.log(e)
48
+  const textareaInput = (e, index) => {
49
+    let newFormData = [...FormData]
50
+    newFormData[index].result = e.detail.value
51
+    setFormData([...newFormData])
130 52
   }
131 53
 
132 54
   const NextStep = () => {
133
-    if (StepId < 4) {
55
+    if (StepId < 2) {
134 56
       setStepId(StepId + 1)
57
+    } else {
58
+      toSubmit(FormData)
135 59
     }
136 60
   }
137 61
 
@@ -142,175 +66,70 @@ export default function RentingHouse (props) {
142 66
   }
143 67
 
144 68
   return (
145
-    <view className='components RentingHouse'>
69
+    <view className='components BuyHouse'>
146 70
       {
147 71
         ShowPopup &&
148 72
         <SubmitBuyHouseResult></SubmitBuyHouseResult>
149 73
       }
150 74
       {
151
-        StepId === 1 &&
152
-        <view className='Step'>
153
-          <view>
154
-            <text>意向区域</text>
155
-            <view className='Area'>
156
-              <view className='flex-h'>
157
-                <text className='iconfont icon-dingwei'></text>
158
-                <text>不限</text>
159
-                <view className='flex-item'></view>
160
-                <text className='iconfont icon-jiantoudown'></text>
161
-              </view>
162
-            </view>
163
-          </view>
164
-
165
-          <view>
166
-            <text>意向楼盘</text>
167
-            <view className='Purpose'>
75
+        FormData.map((item, index) => (
76
+          <view className='Step' key={`Form-${index}`}>
77
+            {
78
+              index >= StepRange[0] && index < StepRange[1] &&
168 79
               <view>
169
-                <Input placeholder="请输入意向楼盘" />
170
-              </view>
171
-            </view>
172
-          </view>
173
-
174
-          <view>
175
-            <text>您想购买的是首套房还是二套房?</text>
176
-            <view className='CheckList'>
177
-              {
178
-                SingleList.map((item, index) => (
179
-                  <view key={`SingleItem-${index}`} className={CurrnetSingleId === item.id ? 'active' : ''} onClick={CutSingleId(item.id)}>
180
-                    {item.name}
181
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
182
-                  </view>
183
-                ))
184
-              }
185
-            </view>
186
-          </view>
187
-
188
-          <view>
189
-            <text>总价预算范围</text>
190
-            <view className='PriceRange'>
191
-              <view className='flex-h'>
192
-                <view className='flex-item'>
193
-                  <Input placeholder="最小面积㎡" />
194
-                </view>
195
-                <text>-</text>
196
-                <view className='flex-item'>
197
-                  <Input placeholder="最大面积㎡" />
198
-                </view>
199
-              </view>
200
-            </view>
201
-          </view>
202
-        </view>
203
-      }
204
-
205
-      {
206
-        StepId === 2 &&
207
-        <view className='Step'>
208
-          <view>
209
-            <text>您想购买的是二手房还是新房?</text>
210
-            <view className='CheckList'>
211
-              {
212
-                NewOldList.map((item, index) => (
213
-                  <view key={`NewOldItem-${index}`} className={CurrnetNewOldId === item.id ? 'active' : ''} onClick={CutNewOldId(item.id)}>
214
-                    {item.name}
215
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
216
-                  </view>
217
-                ))
218
-              }
219
-            </view>
220
-          </view>
221
-          <view>
222
-            <text>居室要求</text>
223
-            <view className='CheckList'>
224
-              {
225
-                HouseTypeList.map((item, index) => (
226
-                  <view key={`HouseTypeItem-${index}`} className={CurrnetHouseTypeId === item.id ? 'active' : ''} onClick={CutHouseTypeId(item.id)}>
227
-                    {item.name}
228
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
80
+                <text>{item.question}</text>
81
+                {
82
+                  item.type === 'checkbox' &&
83
+                  <view className='CheckList'>
84
+                    {
85
+                      item.options.map((subItem, subIndex) => (
86
+                        <view key={`${item.key}-${subIndex}`} className={item.resultId === subItem.id ? 'active' : ''} onClick={CutCheckbox(subItem, index)}>
87
+                          {subItem.name}
88
+                          <Image mode='heightFix' src={require('@/assets/findHouse-icon1.png')}></Image>
89
+                        </view>
90
+                      ))
91
+                    }
229 92
                   </view>
230
-                ))
231
-              }
232
-            </view>
233
-          </view>
234
-          <view>
235
-            <text>面积要求</text>
236
-            <view className='CheckList'>
237
-              {
238
-                AreaList.map((item, index) => (
239
-                  <view key={`AreaItem-${index}`} className={CurrnetAreaId === item.id ? 'active' : ''} onClick={CutAreaId(item.id)}>
240
-                    {item.name}
241
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
93
+                }
94
+                {
95
+                  item.type === 'checkbox' && item.remark !== undefined &&
96
+                  <view className='Textarea'>
97
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => {remarkInput(e, index)}} />
242 98
                   </view>
243
-                ))
244
-              }
245
-            </view>
246
-          </view>
247
-        </view>
248
-      }
249
-
250
-      {
251
-        StepId === 3 &&
252
-        <view className='Step'>
253
-          <view>
254
-            <text>价格要求</text>
255
-            <view className='RangeList'>
256
-              <view className='flex-item'>
257
-                <Slider activeColor="#193C83" block-color="#fff" change={PriceRangehange} min="50" max="200" show-value />
258
-              </view>
259
-              <text>万</text>
260
-            </view>
261
-          </view>
262
-          <view>
263
-            <text>偏好设置</text>
264
-            <view className='CheckList'>
265
-              {
266
-                PreferenceList.map((item, index) => (
267
-                  <view key={`PreferenceItem-${index}`} className={CurrnetPreferenceId === item.id ? 'active' : ''} onClick={CutPreferenceId(item.id)}>
268
-                    {item.name}
269
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
99
+                }
100
+                {
101
+                  item.type === 'range' &&
102
+                  <view className='RangeList flex-h'>
103
+                    <view className='flex-item'>
104
+                      <Slider activeColor='#193C83' block-color='#fff' onChange={(e) => { Rangehange(e, index) }} min={item.options[0]} max={item.options[1]} show-value />
105
+                    </view>
106
+                    <text>元</text>
270 107
                   </view>
271
-                ))
272
-              }
273
-            </view>
274
-          </view>
275
-          <view>
276
-            <text>购房目的</text>
277
-            <view className='CheckList'>
278
-              {
279
-                GoalList.map((item, index) => (
280
-                  <view key={`GoalItem-${index}`} className={CurrnetGoalId === item.id ? 'active' : ''} onClick={CutGoalId(item.id)}>
281
-                    {item.name}
282
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
108
+                }
109
+                {
110
+                  item.type === 'select' &&
111
+                  <view className='Area'>
112
+                    <view className='flex-h'>
113
+                      {
114
+                        item.key === 'district' &&
115
+                        <text className='iconfont icon-dingwei'></text>
116
+                      }
117
+                      <text>不限</text>
118
+                      <view className='flex-item'></view>
119
+                      <text className='iconfont icon-jiantoudown'></text>
120
+                    </view>
283 121
                   </view>
284
-                ))
285
-              }
286
-            </view>
287
-          </view>
288
-        </view>
289
-      }
290
-
291
-      {
292
-        StepId === 4 &&
293
-        <view className='Step'>
294
-          <view>
295
-            <text>计划在多久购房?</text>
296
-            <view className='CheckList'>
297
-              {
298
-                LongTimeList.map((item, index) => (
299
-                  <view key={`LongTimeItem-${index}`} className={CurrnetLongTimeId === item.id ? 'active' : ''} onClick={CutLongTimeId(item.id)}>
300
-                    {item.name}
301
-                    <Image mode='heightFix' src={require('../../../../../assets/findHouse-icon1.png')}></Image>
122
+                }
123
+                {
124
+                  item.type === 'textarea' &&
125
+                  <view className='Textarea'>
126
+                    <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => {textareaInput(e, index)}} />
302 127
                   </view>
303
-                ))
304
-              }
305
-            </view>
306
-          </view>
307
-          <view>
308
-            <text>您还有哪些需要备注的信息?</text>
309
-            <view className='Textarea'>
310
-              <Textarea placeholder="请说出您的其他需求,让我们更好的为您服务!" />
311
-            </view>
128
+                }
129
+              </view>
130
+            }
312 131
           </view>
313
-        </view>
132
+        ))
314 133
       }
315 134
 
316 135
       <view className='Btn'>

+ 19
- 13
src/pages/index/helpToFindHouse/index.jsx View File

@@ -1,17 +1,16 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
+import { ScrollView, Image } from '@tarojs/components'
4
+import { fetch } from '@/utils/request'
5
+import { API_HELP_FIND_HOUSE_SUBMIT, API_CITY_LIST } from '@/constants/api'
6
+import '@/assets/css/iconfont.css'
3 7
 import './index.scss'
4
-import { ScrollView, Image, Input } from '@tarojs/components'
5
-import '../../../assets/css/iconfont.css'
6 8
 import BuyHouse from './components/BuyHouse/index'
7 9
 import RentingHouse from './components/RentingHouse/index'
8 10
 import HousePurchasing from './components/HousePurchasing/index'
9
-import { fetch } from '@/utils/request'
10
-import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
11
-
12
-export default withLayout((props) => {
13 11
 
14
-  const [PageProps] = useState(props)
12
+export default withLayout(() => {
13
+  
15 14
   const [DemandList] = useState([
16 15
     { name: '我要买房', id: 1, icon: '', spell: 'MAI FANG' },
17 16
     { name: '我要租房', id: 2, icon: '', spell: 'ZU FANG' },
@@ -19,6 +18,13 @@ export default withLayout((props) => {
19 18
   ])
20 19
   const [CurrentDemandId, setCurrentDemandId] = useState(1)
21 20
   const [ShowDemand, setShowDemand] = useState(true)
21
+  const [CityList, setCityList] = useState([])
22
+
23
+  useEffect(() => {
24
+    fetch({url: API_CITY_LIST, method: 'get'}).then((res) => {
25
+      setCityList(res || [])
26
+    })
27
+  }, [])
22 28
 
23 29
   const CutDemandId = (id) => {
24 30
     return () => {
@@ -36,7 +42,7 @@ export default withLayout((props) => {
36 42
     data.map((item) => {
37 43
       params[item.key] = item.result
38 44
     })
39
-    fetch({url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: params}).then(() => {
45
+    fetch({url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: {...params, type: CurrentDemandId}}).then(() => {
40 46
       
41 47
     })
42 48
   }
@@ -44,7 +50,7 @@ export default withLayout((props) => {
44 50
   return (
45 51
     <view className='Page helpToFindHouse'>
46 52
 
47
-      <ScrollView scroll-y={true} refresher-enabled={false}>
53
+      <ScrollView scroll-y refresher-enabled={false}>
48 54
         <view className='PageContent'>
49 55
 
50 56
           {
@@ -68,19 +74,19 @@ export default withLayout((props) => {
68 74
           {/* 买房 */}
69 75
           {
70 76
             CurrentDemandId === 1 &&
71
-            <BuyHouse change={StepChange} toSubmit={submitForm}></BuyHouse>
77
+            <BuyHouse change={StepChange} toSubmit={submitForm} CityList={CityList}></BuyHouse>
72 78
           }
73 79
 
74 80
           {/* 租房 */}
75 81
           {
76 82
             CurrentDemandId === 2 &&
77
-            <RentingHouse></RentingHouse>
83
+            <RentingHouse change={StepChange} toSubmit={submitForm} CityList={CityList}></RentingHouse>
78 84
           }
79 85
 
80 86
           {/* 置业 */}
81 87
           {
82 88
             CurrentDemandId === 3 &&
83
-            <HousePurchasing></HousePurchasing>
89
+            <HousePurchasing change={StepChange} toSubmit={submitForm} CityList={CityList}></HousePurchasing>
84 90
           }
85 91
 
86 92
         </view>

+ 40
- 6
src/pages/mine/components/MyCollectForActivity/index.jsx View File

@@ -1,14 +1,48 @@
1
-import React, { useState, useEffect } from 'react'
2
-import './index.scss'
1
+import { useState, useEffect } from 'react'
3 2
 import { ScrollView } from '@tarojs/components'
3
+import { useSelector } from 'react-redux'
4
+import { fetch } from '@/utils/request'
5
+import { API_ACTIVITY_SAVE } from '@/constants/api'
6
+import './index.scss'
4 7
 import ActivityListItem from '../../../index/components/ActivityListItem/index'
5 8
 
6
-export default function MyCollectForActivity (props) {
7
-  const { Data = {} } = props
8
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
9
+export default function MyCollectForActivity () {
10
+
11
+  const user = useSelector(state => state.user)
12
+  const [PersonId, setPersonId] = useState(null)
13
+  const [pageNumber, setPageNumber] = useState(null)
14
+  const [pageSize] = useState(10)
15
+  const [HasNextPage, setHasNextPage] = useState(true)
16
+  const [PageList, setPageList] = useState([])
9 17
   const [IsPull, setPull] = useState(false)
10 18
   const [PullTimer, setPullTimer] = useState(null)
11 19
 
20
+  useEffect(() => {
21
+    if (user?.userInfo?.person?.personId) {
22
+      setPersonId(user.userInfo.person.personId)
23
+    }
24
+  }, [user])
25
+
26
+  useEffect(() => {
27
+    if (PersonId) {
28
+      setPageNumber(1)
29
+    }
30
+  }, [PersonId])
31
+
32
+  useEffect(() => {
33
+    if (pageNumber && HasNextPage) {
34
+      fetch({ url: API_ACTIVITY_SAVE, method: 'get', payload: { mine: true, pageNumber, pageSize } }).then((res) => {
35
+        if (res !== null) {
36
+          setPageList(res.records || [])
37
+          setHasNextPage(res.current >= res.pages)
38
+        } else {
39
+          setPageList([])
40
+          setHasNextPage(false)
41
+        }
42
+      })
43
+    }
44
+  }, [pageNumber])
45
+
12 46
   const PageRefresh = () => { // 页面下拉刷新回调
13 47
     setPull(true)
14 48
   }
@@ -24,7 +58,7 @@ export default function MyCollectForActivity (props) {
24 58
 
25 59
   return (
26 60
     <view className='components MyCollectForActivity'>
27
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
61
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
28 62
         <view className='PageContent'>
29 63
           <view className='List'>
30 64
             {

+ 35
- 6
src/pages/mine/components/MyCollectForBuilding/index.jsx View File

@@ -1,14 +1,43 @@
1
-import React, { useState, useEffect } from 'react'
2
-import './index.scss'
1
+import { useState, useEffect } from 'react'
3 2
 import { ScrollView } from '@tarojs/components'
3
+import { useSelector } from 'react-redux'
4
+import { fetch } from '@/utils/request'
5
+import { API_ITEMS_LIST } from '@/constants/api'
6
+import './index.scss'
4 7
 import MyShareListItem from '../MyShareListItem/index'
5 8
 
6
-export default function MyCollectForBuilding (props) {
7
-  const { Data = {} } = props
8
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
9
+export default function MyCollectForBuilding () {
10
+  
11
+  const user = useSelector(state => state.user)
12
+  const [PersonId, setPersonId] = useState(null)
13
+  const [pageNumber, setPageNumber] = useState(null)
14
+  const [pageSize] = useState(10)
15
+  const [HasNextPage, setHasNextPage] = useState(true)
16
+  const [PageList, setPageList] = useState([])
9 17
   const [IsPull, setPull] = useState(false)
10 18
   const [PullTimer, setPullTimer] = useState(null)
11 19
 
20
+  useEffect(() => {
21
+    if(user?.userInfo?.person?.personId) {
22
+      setPersonId(user.userInfo.person.personId)
23
+    }
24
+  }, [user])
25
+
26
+  useEffect(() => {
27
+    if(PersonId) {
28
+      setPageNumber(1)
29
+    }
30
+  }, [PersonId])
31
+
32
+  useEffect(() => {
33
+    if(pageNumber && HasNextPage) {
34
+      fetch({ url: API_ITEMS_LIST, method: 'get', payload: { mine: true, pageNumber, pageSize } }).then((res) => {
35
+        setPageList(res.records || [])
36
+        setHasNextPage(res.current >= res.pages)
37
+      })
38
+    }
39
+  }, [pageNumber])
40
+
12 41
   const PageRefresh = () => { // 页面下拉刷新回调
13 42
     setPull(true)
14 43
   }
@@ -24,7 +53,7 @@ export default function MyCollectForBuilding (props) {
24 53
 
25 54
   return (
26 55
     <view className='components MyCollectForBuilding'>
27
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
56
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
28 57
         <view className='PageContent'>
29 58
           <view className='List'>
30 59
             {

+ 35
- 6
src/pages/mine/components/MyCollectForNews/index.jsx View File

@@ -1,14 +1,43 @@
1
-import React, { useState, useEffect } from 'react'
2
-import './index.scss'
1
+import { useState, useEffect } from 'react'
3 2
 import { ScrollView } from '@tarojs/components'
3
+import { useSelector } from 'react-redux'
4
+import { fetch } from '@/utils/request'
5
+import { API_NEWS_LIST } from '@/constants/api'
4 6
 import NewsListItem from '../../../index/components/NewsListItem/index'
7
+import './index.scss'
5 8
 
6
-export default function MyCollectForNews (props) {
7
-  const { Data = {} } = props
8
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
9
+export default function MyCollectForNews () {
10
+  
11
+  const user = useSelector(state => state.user)
12
+  const [PersonId, setPersonId] = useState(null)
13
+  const [pageNumber, setPageNumber] = useState(null)
14
+  const [pageSize] = useState(10)
15
+  const [HasNextPage, setHasNextPage] = useState(true)
16
+  const [PageList, setPageList] = useState([])
9 17
   const [IsPull, setPull] = useState(false)
10 18
   const [PullTimer, setPullTimer] = useState(null)
11 19
 
20
+  useEffect(() => {
21
+    if(user?.userInfo?.person?.personId) {
22
+      setPersonId(user.userInfo.person.personId)
23
+    }
24
+  }, [user])
25
+
26
+  useEffect(() => {
27
+    if(PersonId) {
28
+      setPageNumber(1)
29
+    }
30
+  }, [PersonId])
31
+
32
+  useEffect(() => {
33
+    if(pageNumber && HasNextPage) {
34
+      fetch({ url: API_NEWS_LIST, method: 'get', payload: { mine: true, pageNumber, pageSize } }).then((res) => {
35
+        setPageList(res.records || [])
36
+        setHasNextPage(res.current >= res.pages)
37
+      })
38
+    }
39
+  }, [pageNumber])
40
+
12 41
   const PageRefresh = () => { // 页面下拉刷新回调
13 42
     setPull(true)
14 43
   }
@@ -24,7 +53,7 @@ export default function MyCollectForNews (props) {
24 53
 
25 54
   return (
26 55
     <view className='components MyCollectForNews'>
27
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
56
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
28 57
         <view className='PageContent'>
29 58
           <view className='List'>
30 59
             {

+ 36
- 8
src/pages/mine/myActivity/index.jsx View File

@@ -1,16 +1,44 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
-import './index.scss'
4 3
 import { ScrollView } from '@tarojs/components'
5
-import '../../../assets/css/iconfont.css'
4
+import '@/assets/css/iconfont.css'
5
+import { useSelector } from 'react-redux'
6
+import { fetch } from '@/utils/request'
7
+import { API_ACTIVITY_LIST_CUSTOMER } from '@/constants/api'
8
+import './index.scss'
6 9
 import MyActivityListItem from '../components/MyActivityListItem/index'
7 10
 
8
-export default withLayout((props) => {
9
-
10
-  // const [PageProps] = useState(props)
11
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
11
+export default withLayout(() => {
12
+  
13
+  const user = useSelector(state => state.user)
14
+  const [PageList, setPageList] = useState([])
12 15
   const [IsPull, setPull] = useState(false)
13 16
   const [PullTimer, setPullTimer] = useState(null)
17
+  const [PersonId, setPersonId] = useState(null)
18
+  const [pageNumber, setPageNumber] = useState(null)
19
+  const [pageSize] = useState(10)
20
+  const [HasNextPage, setHasNextPage] = useState(true)
21
+
22
+  useEffect(() => {
23
+    if(user?.userInfo?.person?.personId) {
24
+      setPersonId(user.userInfo.person.personId)
25
+    }
26
+  }, [user])
27
+
28
+  useEffect(() => {
29
+    if(PersonId) {
30
+      setPageNumber(1)
31
+    }
32
+  }, [PersonId])
33
+
34
+  useEffect(() => {
35
+    if(pageNumber && HasNextPage) {
36
+      fetch({ url: API_ACTIVITY_LIST_CUSTOMER, method: 'get', payload: { customerId: PersonId, pageNumber, pageSize } }).then((res) => {
37
+        setPageList(res.records || [])
38
+        setHasNextPage(res.current >= res.pages)
39
+      })
40
+    }
41
+  }, [pageNumber])
14 42
 
15 43
   const PageRefresh = () => { // 页面下拉刷新回调
16 44
     setPull(true)
@@ -28,7 +56,7 @@ export default withLayout((props) => {
28 56
   return (
29 57
     <view className='Page myActivity'>
30 58
 
31
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
59
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
32 60
         <view className='PageContent'>
33 61
           <view className='List'>
34 62
             {

+ 9
- 11
src/pages/mine/myCollect/index.jsx View File

@@ -1,20 +1,18 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState } from 'react'
2 2
 import withLayout from '@/layout'
3
+import '@/assets/css/iconfont.css'
3 4
 import './index.scss'
4
-import '../../../assets/css/iconfont.css'
5 5
 import MyCollectForBuilding from '../components/MyCollectForBuilding/index'
6 6
 import MyCollectForNews from '../components/MyCollectForNews/index'
7 7
 import MyCollectForActivity from '../components/MyCollectForActivity/index'
8 8
 import MyCollectForCourse from '../components/MyCollectForCourse/index'
9 9
 
10
-export default withLayout((props) => {
11
-
12
-  // const [PageProps] = useState(props)
10
+export default withLayout(() => {
13 11
   const [MenuList] = useState([
14 12
     { name: '项目', id: 1 },
15
-    { name: '资讯', id: 2 },
16
-    { name: '活动', id: 3 },
17
-    { name: '课程', id: 4 }
13
+    { name: '资讯', id: 3 },
14
+    { name: '活动', id: 4 },
15
+    { name: '课程', id: 2 }
18 16
   ])
19 17
   const [CurrentMenuId, setCurrentMenuId] = useState(1)
20 18
 
@@ -50,19 +48,19 @@ export default withLayout((props) => {
50 48
 
51 49
           {/* 资讯 */}
52 50
           {
53
-            CurrentMenuId === 2 &&
51
+            CurrentMenuId === 3 &&
54 52
             <MyCollectForNews></MyCollectForNews>
55 53
           }
56 54
 
57 55
           {/* 活动 */}
58 56
           {
59
-            CurrentMenuId === 3 &&
57
+            CurrentMenuId === 4 &&
60 58
             <MyCollectForActivity></MyCollectForActivity>
61 59
           }
62 60
 
63 61
           {/* 课程 */}
64 62
           {
65
-            CurrentMenuId === 4 &&
63
+            CurrentMenuId === 2 &&
66 64
             <MyCollectForCourse></MyCollectForCourse>
67 65
           }
68 66
           

+ 35
- 7
src/pages/mine/myShare/index.jsx View File

@@ -1,16 +1,44 @@
1
-import React, { useState, useEffect } from 'react'
1
+import { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
-import './index.scss'
4 3
 import { ScrollView } from '@tarojs/components'
5
-import '../../../assets/css/iconfont.css'
4
+import '@/assets/css/iconfont.css'
5
+import { useSelector } from 'react-redux'
6
+import { fetch } from '@/utils/request'
7
+import { API_SHARE_LIST } from '@/constants/api'
8
+import './index.scss'
6 9
 import MyShareListItem from '../components/MyShareListItem/index'
7 10
 
8
-export default withLayout((props) => {
11
+export default withLayout(() => {
9 12
 
10
-  // const [PageProps] = useState(props)
11
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
13
+  const user = useSelector(state => state.user)
14
+  const [PageList, setPageList] = useState([])
12 15
   const [IsPull, setPull] = useState(false)
13 16
   const [PullTimer, setPullTimer] = useState(null)
17
+  const [PersonId, setPersonId] = useState(null)
18
+  const [pageNumber, setPageNumber] = useState(null)
19
+  const [pageSize] = useState(10)
20
+  const [HasNextPage, setHasNextPage] = useState(true)
21
+
22
+  useEffect(() => {
23
+    if(user?.userInfo?.person?.personId) {
24
+      setPersonId(user.userInfo.person.personId)
25
+    }
26
+  }, [user])
27
+
28
+  useEffect(() => {
29
+    if(pageNumber && HasNextPage) {
30
+      fetch({ url: API_SHARE_LIST, method: 'get', payload: { personId: PersonId, pageNumber, pageSize } }).then((res) => {
31
+        setPageList(res.records || [])
32
+        setHasNextPage(res.current >= res.pages)
33
+      })
34
+    }
35
+  }, [pageNumber])
36
+
37
+  useEffect(() => {
38
+    if(PersonId) {
39
+      setPageNumber(1)
40
+    }
41
+  }, [PersonId])
14 42
 
15 43
   const PageRefresh = () => { // 页面下拉刷新回调
16 44
     setPull(true)
@@ -28,7 +56,7 @@ export default withLayout((props) => {
28 56
   return (
29 57
     <view className='Page MyShare'>
30 58
 
31
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
59
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
32 60
         <view className='PageContent'>
33 61
           <view className='List'>
34 62
             {