1002884655 před 3 roky
rodič
revize
386fe4c4a6

+ 2
- 2
config/dev.js Zobrazit soubor

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"http://127.0.0.1:8081"',
6
+    HOST: '"https://xlk.njyz.tech"',
7
+    // HOST: '"http://127.0.0.1:8081"',
8 8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9 9
     OSS_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://zhiyun-image.oss-accelerate.aliyuncs.com/"',

+ 42
- 35
src/pages/index/activityList/index.jsx Zobrazit soubor

@@ -1,65 +1,72 @@
1 1
 import { useState, useEffect } from 'react'
2 2
 import { useSelector } from 'react-redux'
3
-import { useDidShow,useRouter } from '@tarojs/taro'
3
+import { useRouter } from '@tarojs/taro'
4 4
 import { ScrollView } from '@tarojs/components'
5
-import { queryActivityList, getActNewList } from '@/services/activity'
6 5
 import Disclaimer from '@/components/Disclaimer'
6
+import { fetch } from '@/utils/request'
7
+import { API_ACTIVITY_LIST } from '@/constants/api'
7 8
 
8 9
 import ActivityListItem from '../components/ActivityListItem/index'
9 10
 
10 11
 import './index.scss'
11 12
 
12
-export default function MyCollectForActivity (props) {
13
+export default function MyCollectForActivity () {
13 14
 
14 15
  const router=useRouter()
15 16
    const { type,buildingId } = router.params;
16 17
   const city = useSelector(state => state.city)
17
- 
18
+  
19
+  const user = useSelector(state => state.user)
18 20
   const [PageList, setPageList] = useState([])
19 21
   const [IsPull, setPull] = useState(false)
20
-  const [PullTimer, setPullTimer] = useState(null)
22
+  const [PersonId, setPersonId] = useState(null)
23
+  const [pageNumber, setPageNumber] = useState(1)
24
+  const [HasNextPage, setHasNextPage] = useState(true)
25
+
26
+  useEffect(() => {
27
+    if(user?.userInfo?.person?.personId) {
28
+      setPersonId(user.userInfo.person.personId)
29
+    }
30
+  }, [user])
31
+
32
+  useEffect(() => {
33
+    if(PersonId) {
34
+      GetPageList()
35
+    }
36
+  }, [pageNumber, PersonId])
21 37
 
22 38
   const PageRefresh = () => { // 页面下拉刷新回调
23 39
     setPull(true)
24 40
   }
25 41
 
42
+  const GetPageList = () => {
43
+    setHasNextPage(false)
44
+    fetch({ url: API_ACTIVITY_LIST, method: 'get', payload: { city: city?.curCity?.id, buildingId, type, pageNumber, pageSize: 10 } }).then((res) => {
45
+      setPageList(pageNumber === 1 ? res.list || [] : PageList.concat(res.list || []))
46
+      setHasNextPage(res.current < res.pages)
47
+      setPull(false)
48
+    })
49
+  }
50
+
51
+  const PageLoadMore = () => { // 页面上拉加载更多
52
+    if(HasNextPage) {
53
+      setPageNumber(pageNumber + 1)
54
+    }
55
+  }
56
+
26 57
   useEffect(() => { // 下拉刷新触发
27 58
     if (IsPull) {
28
-      clearTimeout(PullTimer)
29
-      setPullTimer(setTimeout(() => {
30
-        setPull(false)
31
-      }, 2000))
59
+      if(pageNumber === 1) {
60
+        GetPageList()
61
+      } else {
62
+        setPageNumber(1)
63
+      }
32 64
     }
33 65
   }, [IsPull])
34 66
 
35
-  
36
-
37
- const getList = (params) => {
38
-  params.cityId = city.curCity.id;
39
-  if(buildingId){
40
-    params.buildingId = buildingId;
41
-  }else{
42
-    params.cityId = city?.curCity?.id;
43
-  }
44
-  queryActivityList({...params,type}).then((res)=>{
45
-    setPageList(res.list)
46
-  })
47
-  }
48
-  useEffect(()=>{
49
- 
50
-      getList({page :0, pageSize : 10})
51
-
52
-   
53
-  },[])
54
-  // useDidShow(() => {
55
-  //   getList({page :0, pageSize : 10})
56
-  // })
57
-
58
- 
59
-
60 67
   return (
61 68
     <view className='components activityList'>
62
-      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
69
+      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} onscrolltolower={PageLoadMore} refresher-background='#f8f8f8'>
63 70
         <view className='PageContent'>
64 71
           <view className='List'>
65 72
             {

+ 142
- 0
src/pages/index/addedValueService/formData.js Zobrazit soubor

@@ -0,0 +1,142 @@
1
+const questions = [
2
+  {
3
+    question: '你的装修预算是多少?',
4
+    key: 'budget',
5
+    type: 'range',
6
+    result: '',
7
+    resultId: null,
8
+    options: [100, 500]
9
+  },
10
+  {
11
+    question: '房屋现状?',
12
+    key: 'status',
13
+    type: 'checkbox',
14
+    result: '',
15
+    resultId: null,
16
+    options: [
17
+      { name: '毛坯', id: 1 },
18
+      { name: '旧房装修5年以内', id: 2 },
19
+      { name: '旧房装修5-10年', id: 3 },
20
+      { name: '旧房装修10年以上', id: 4 }
21
+    ]
22
+  },
23
+  {
24
+    question: '你想买多大面积?',
25
+    key: 'area',
26
+    type: 'checkbox',
27
+    result: '',
28
+    resultId: null,
29
+    options: [
30
+      { name: '50㎡以下', id: 1 },
31
+      { name: '50-70㎡', id: 2 },
32
+      { name: '70-90㎡', id: 3 },
33
+      { name: '90-110㎡', id: 4 },
34
+      { name: '110-130㎡', id: 5 },
35
+      { name: '130-150㎡', id: 6 },
36
+      { name: '150-200㎡', id: 7 },
37
+      { name: '200㎡以上', id: 8 }
38
+    ]
39
+  },
40
+  {
41
+    question: '你喜欢哪种家装模式?',
42
+    key: 'type',
43
+    type: 'checkbox',
44
+    result: '',
45
+    resultId: null,
46
+    options: [
47
+      { name: '只做设计', id: 1 },
48
+      { name: '材料全包', id: 2 },
49
+      { name: '包施工 不包材料', id: 3 },
50
+      { name: '施工包辅材 不包主材', id: 4 },
51
+      { name: '全包(设计/施工/主材..)', id: 5 }
52
+    ]
53
+  },
54
+  {
55
+    question: '你较为看重家装的哪些方面?',
56
+    key: 'important',
57
+    type: 'checkbox',
58
+    result: '',
59
+    resultId: null,
60
+    options: [
61
+      { name: '家装价格', id: 1 },
62
+      { name: '施工品质', id: 2 },
63
+      { name: '设计感', id: 3 },
64
+      { name: '环保', id: 4 },
65
+      { name: '舒适度', id: 5 },
66
+      { name: '实用度', id: 5 }
67
+    ]
68
+  },
69
+  {
70
+    question: '你理想的家装风格是哪些?',
71
+    key: 'style',
72
+    type: 'checkbox',
73
+    result: '',
74
+    resultId: null,
75
+    options: [
76
+      { name: '北欧风格', id: 1 },
77
+      { name: '简欧风格', id: 2 },
78
+      { name: '欧式古典', id: 3 },
79
+      { name: '现代简约', id: 4 },
80
+      { name: '田园风格', id: 5 },
81
+      { name: '新中式风格', id: 6 },
82
+      { name: '地中海风格', id: 7 },
83
+      { name: '东南亚风格', id: 8 },
84
+      { name: '美式风格', id: 9 },
85
+      { name: '日式风格', id: 10 },
86
+      { name: '混搭风格', id: 11 }
87
+    ]
88
+  },
89
+  {
90
+    question: '你最关键的家装诉求是什么?',
91
+    key: 'mostImportant',
92
+    type: 'checkbox',
93
+    result: '',
94
+    resultId: null,
95
+    options: [
96
+      { name: '设计凸显个性', id: 1 },
97
+      { name: '智能家居齐全', id: 2 },
98
+      { name: '强大的收纳功能', id: 3 },
99
+      { name: '方便清洁和整理', id: 4 },
100
+      { name: '温馨舒适', id: 5 },
101
+      { name: '品质生活', id: 6 },
102
+      { name: '其他', id: 7 }
103
+    ]
104
+  },
105
+  {
106
+    question: '你理想中的家应该包含哪些特殊功能区域?',
107
+    key: 'special',
108
+    type: 'checkbox',
109
+    result: '',
110
+    resultId: null,
111
+    options: [
112
+      { name: '衣帽间', id: 1 },
113
+      { name: '书房', id: 2 },
114
+      { name: '宠物生活区', id: 3 },
115
+      { name: '超大浴缸', id: 4 },
116
+      { name: '超大衣柜', id: 5 },
117
+      { name: '开放式厨房', id: 6 },
118
+      { name: '种绿植阳台', id: 7 },
119
+      { name: '健身区', id: 8 },
120
+      { name: '婴儿房', id: 9 },
121
+      { name: '其他', id: 10 }
122
+    ]
123
+  },
124
+  {
125
+    question: '你的家装是否会选择智能家居?',
126
+    key: 'samrt',
127
+    type: 'checkbox',
128
+    result: '',
129
+    resultId: null,
130
+    options: [
131
+      { name: '会', id: 1 },
132
+      { name: '非常实用高效', id: 2 },
133
+      { name: '会选择感兴趣部分', id: 3 },
134
+      { name: '不会选择', id: 4 },
135
+      { name: '新奇过多实用', id: 5 },
136
+      { name: '暂时不了解智能家居', id: 6 },
137
+      { name: '其他', id: 7 }
138
+    ]
139
+  }
140
+]
141
+
142
+export default questions

+ 131
- 29
src/pages/index/addedValueService/index.jsx Zobrazit soubor

@@ -1,45 +1,147 @@
1
-import React, { useState, useEffect } from 'react'
2
-import withLayout from '@/layout'
3
-import './index.scss'
4
-import { ScrollView } from '@tarojs/components'
1
+import { useState, useEffect } from 'react'
5 2
 import '@/assets/css/iconfont.css'
3
+import { Image, Slider, Textarea, ScrollView } from '@tarojs/components'
4
+import { fetch } from '@/utils/request'
5
+import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
6
+import './index.scss'
7
+import questions from './formData'
8
+import SubmitBuyHouseResult from '../helpToFindHouse/components/SubmitBuyHouseResult/index'
9
+
10
+export default function AddedValueService () {
6 11
 
7
-export default withLayout((props) => {
12
+  const [FormData, setFormData] = useState(questions)
8 13
 
9
-  // const [PageProps] = useState(props)
10
-  const [PageList, setPageList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', ''])
11
-  const [IsPull, setPull] = useState(false)
12
-  const [PullTimer, setPullTimer] = useState(null)
14
+  const [StepId, setStepId] = useState(1)
15
+  const [StepRange, setStepRange] = useState([0, 3])
16
+  const [ResultList, setResultList] = useState([])
17
+  const [ShowPopup, setShowPopup] = useState(false)
13 18
 
14
-  const PageRefresh = () => { // 页面下拉刷新回调
15
-    setPull(true)
19
+  useEffect(() => {
20
+    if (StepId === 1) {
21
+      setStepRange([0, 3])
22
+    } else if (StepId === 2) {
23
+      setStepRange([3, 6])
24
+    } else if (StepId === 3) {
25
+      setStepRange([6, 8])
26
+    } else if (StepId === 4) {
27
+      setStepRange([8, 9])
28
+    }
29
+  }, [StepId])
30
+
31
+  const SubmitForm = (data) => {
32
+    data = data || []
33
+    let params = {}
34
+    data.map((item) => {
35
+      params[item.key] = item.result
36
+    })
37
+    fetch({ url: API_HELP_FIND_HOUSE_SUBMIT, method: 'post', payload: { ...params, type: 4 } }).then((res) => {
38
+      setResultList(res.taBuildingList || [])
39
+      setShowPopup(true)
40
+    })
16 41
   }
17 42
 
18
-  useEffect(() => { // 下拉刷新触发
19
-    if (IsPull) {
20
-      clearTimeout(PullTimer)
21
-      setPullTimer(setTimeout(() => {
22
-        setPull(false)
23
-      }, 2000))
43
+  const CutCheckbox = (item, index) => {
44
+    return () => {
45
+      let newFormData = [...FormData]
46
+      newFormData[index].resultId = item.id
47
+      newFormData[index].result = item.name
48
+      setFormData([...newFormData])
24 49
     }
25
-  }, [IsPull])
50
+  }
26 51
 
27
-  return (
28
-    <view className='Page addedValueService'>
52
+  const Rangehange = (e, index) => {
53
+    let newFormData = [...FormData]
54
+    newFormData[index].result = e.detail.value
55
+    setFormData([...newFormData])
56
+  }
29 57
 
30
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
31
-        <view className='PageContent'>
58
+  const remarkInput = (e, index) => {
59
+    let newFormData = [...FormData]
60
+    newFormData[index].remark = e.detail.value
61
+    setFormData([...newFormData])
62
+  }
63
+
64
+  const textareaInput = (e, index) => {
65
+    let newFormData = [...FormData]
66
+    newFormData[index].result = e.detail.value
67
+    setFormData([...newFormData])
68
+  }
32 69
 
33
-          增值服务
70
+  const NextStep = () => {
71
+    if (StepId < 4) {
72
+      setStepId(StepId + 1)
73
+    } else {
74
+      SubmitForm(FormData)
75
+    }
76
+  }
34 77
 
35
-          {/* bottom */}
36
-          <view className='PageBottom'>
37
-            <text>已经到底了~</text>
38
-          </view>
78
+  const PrevStep = () => {
79
+    if (StepId > 1) {
80
+      setStepId(StepId - 1)
81
+    }
82
+  }
39 83
 
84
+  return (
85
+    <view className='components AddedValueService'>
86
+      {
87
+        ShowPopup &&
88
+        <SubmitBuyHouseResult List={ResultList.slice(0, 1)}></SubmitBuyHouseResult>
89
+      }
90
+      <ScrollView scroll-y>
91
+        <view className='PageContent'>
92
+          {
93
+            FormData.map((item, index) => (
94
+              <view className='Step' key={`Form-${index}`}>
95
+                {
96
+                  index >= StepRange[0] && index < StepRange[1] &&
97
+                  <view>
98
+                    <text>{item.question}</text>
99
+                    {
100
+                      item.type === 'checkbox' &&
101
+                      <view className='CheckList'>
102
+                        {
103
+                          item.options.map((subItem, subIndex) => (
104
+                            <view key={`${item.key}-${subIndex}`} className={item.resultId === subItem.id ? 'active' : ''} onClick={CutCheckbox(subItem, index)}>
105
+                              {subItem.name}
106
+                              <Image mode='heightFix' src={require('@/assets/findHouse-icon1.png')}></Image>
107
+                            </view>
108
+                          ))
109
+                        }
110
+                      </view>
111
+                    }
112
+                    {
113
+                      item.type === 'checkbox' && item.remark !== undefined &&
114
+                      <view className='Textarea'>
115
+                        <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => { remarkInput(e, index) }} />
116
+                      </view>
117
+                    }
118
+                    {
119
+                      item.type === 'range' &&
120
+                      <view className='RangeList flex-h'>
121
+                        <view className='flex-item'>
122
+                          <Slider activeColor='#193C83' block-color='#fff' onChange={(e) => { Rangehange(e, index) }} min={item.options[0]} max={item.options[1]} show-value />
123
+                        </view>
124
+                        <text>万</text>
125
+                      </view>
126
+                    }
127
+                    {
128
+                      item.type === 'textarea' &&
129
+                      <view className='Textarea'>
130
+                        <Textarea placeholder='请说出您的其他需求,让我们更好的为您服务!' onInput={(e) => { textareaInput(e, index) }} />
131
+                      </view>
132
+                    }
133
+                  </view>
134
+                }
135
+              </view>
136
+            ))
137
+          }
138
+
139
+          <view className='Btn'>
140
+            <text className='active' onClick={NextStep}>下一步</text>
141
+            <text onClick={PrevStep}>返回</text>
142
+          </view>
40 143
         </view>
41 144
       </ScrollView>
42
-
43 145
     </view>
44 146
   )
45
-})
147
+}

+ 163
- 3
src/pages/index/addedValueService/index.scss Zobrazit soubor

@@ -1,12 +1,172 @@
1
-.Page.addedValueService {
2
-  background: #fff;
1
+.components.AddedValueService {
2
+  width: 100%;
3
+  height: 100%;
4
+  position: relative;
5
+  overflow: hidden;
3 6
   > scroll-view {
4 7
     width: 100%;
5 8
     height: 100%;
9
+    position: relative;
6 10
     .PageContent {
7 11
       position: relative;
8 12
       overflow: hidden;
9
-      min-height: 100vh;
13
+      padding: 0 30px;
14
+      > .Step {
15
+        position: relative;
16
+        overflow: hidden;
17
+        > view {
18
+          position: relative;
19
+          overflow: hidden;
20
+          margin-top: 30px;
21
+          > text {
22
+            display: block;
23
+            font-size: 34px;
24
+            font-weight: bold;
25
+            color: #333;
26
+            line-height: 40px;
27
+            letter-spacing: 4px;
28
+          }
29
+          > view {
30
+            position: relative;
31
+            overflow: hidden;
32
+            margin-top: 20px;
33
+          }
34
+          > .Area {
35
+            > view {
36
+              align-items: center;
37
+              background: #f8f8f8;
38
+              border-radius: 12px;
39
+              padding: 24px 20px;
40
+              > text {
41
+                font-size: 26px;
42
+                color: #333;
43
+                line-height: 40px;
44
+                margin-left: 20px;
45
+                &:first-child {
46
+                  margin-left: 0;
47
+                  color: #193c83;
48
+                }
49
+              }
50
+            }
51
+          }
52
+          > .Purpose {
53
+            > view {
54
+              align-items: center;
55
+              background: #f8f8f8;
56
+              border-radius: 12px;
57
+              padding: 24px 20px;
58
+              > input {
59
+                font-size: 26px;
60
+                color: #333;
61
+                line-height: 40px;
62
+                display: block;
63
+                width: 100%;
64
+                background: none;
65
+              }
66
+            }
67
+          }
68
+          > .CheckList {
69
+            font-size: 0;
70
+            margin-top: 0;
71
+            > view {
72
+              display: inline-block;
73
+              vertical-align: middle;
74
+              font-size: 30px;
75
+              font-weight: 600;
76
+              color: #333;
77
+              line-height: 40px;
78
+              padding: 20px 0;
79
+              min-width: 194px;
80
+              box-sizing: border-box;
81
+              white-space: nowrap;
82
+              text-align: center;
83
+              border: 2px solid #193c83;
84
+              border-radius: 4px;
85
+              margin-right: 54px;
86
+              position: relative;
87
+              overflow: hidden;
88
+              margin-top: 20px;
89
+              // &:nth-child(3n + 3) {
90
+              //   margin-right: 0;
91
+              // }
92
+              &.active {
93
+                > image {
94
+                  display: block;
95
+                }
96
+              }
97
+              > image {
98
+                display: none;
99
+                width: 36px;
100
+                height: 36px;
101
+                position: absolute;
102
+                right: -2px;
103
+                bottom: -2px;
104
+              }
105
+            }
106
+          }
107
+          > .RangeList {
108
+            align-items: center;
109
+            > text {
110
+              color: #999;
111
+              font-size: 28px;
112
+              transform: translateX(-30px);
113
+            }
114
+          }
115
+          > .PriceRange {
116
+            > view {
117
+              align-items: center;
118
+              background: #f8f8f8;
119
+              border-radius: 12px;
120
+              padding: 24px 0;
121
+              > view {
122
+                > input {
123
+                  font-size: 26px;
124
+                  color: #333;
125
+                  line-height: 40px;
126
+                  display: block;
127
+                  width: 100%;
128
+                  background: none;
129
+                  text-align: center;
130
+                }
131
+              }
132
+            }
133
+          }
134
+          > .Textarea {
135
+            background: #f8f8f8;
136
+            border-radius: 12px;
137
+            padding: 20px;
138
+            > textarea {
139
+              font-size: 26px;
140
+              color: #333;
141
+              line-height: 40px;
142
+              display: block;
143
+              width: 100%;
144
+              background: none;
145
+            }
146
+          }
147
+        }
148
+      }
149
+      > .Btn {
150
+        padding: 0 30px;
151
+        margin: 150px auto 60px;
152
+        > text {
153
+          display: block;
154
+          text-align: center;
155
+          font-size: 32px;
156
+          line-height: 92px;
157
+          box-sizing: border-box;
158
+          border: 2px solid #193c83;
159
+          color: #193c83;
160
+          border-radius: 92px;
161
+          margin-top: 20px;
162
+          text-indent: 0;
163
+          font-weight: normal;
164
+          &.active {
165
+            background: #193c83;
166
+            color: #fff;
167
+          }
168
+        }
169
+      }
10 170
     }
11 171
   }
12 172
 }

+ 2
- 1
src/pages/index/buildingDetail/components/Periphery/index.jsx Zobrazit soubor

@@ -1,5 +1,6 @@
1 1
 
2 2
 import { useCallback, useContext, useEffect, useMemo, useState } from 'react'
3
+import Taro from '@tarojs/taro'
3 4
 import { Map, CoverView } from '@tarojs/components'
4 5
 import '@/assets/css/iconfont.css'
5 6
 import './index.scss'
@@ -31,7 +32,7 @@ export default function Periphery (props) {
31 32
 
32 33
   const CutTab = () => {
33 34
     return () => {
34
-      
35
+      Taro.navigateTo({url: `/pages/index/buildingAround/index?id=${Info.buildingId}`})
35 36
     }
36 37
   }
37 38
 

+ 19
- 7
src/pages/index/buildingDynamic/index.jsx Zobrazit soubor

@@ -1,11 +1,23 @@
1
-
1
+import { useState, useEffect } from 'react'
2
+import Taro from '@tarojs/taro'
2 3
 import withLayout from '@/layout'
4
+import { fetch } from '@/utils/request'
5
+import { API_ITEMS_DETAIL } from '@/constants/api'
3 6
 import { ScrollView } from '@tarojs/components'
4 7
 import '@/assets/css/iconfont.css'
5 8
 import './index.scss'
6 9
 
7 10
 export default withLayout((props) => {
8
-  const { List = [{}, {}, {}, {}, {}, {}] } = props
11
+  const { router } = props
12
+  const { id } = router.params
13
+  const [PageList, setPageList] = useState([])
14
+  
15
+  useEffect(() => {
16
+    // 获取楼盘信息
17
+    fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
18
+      setPageList(res?.trendList || [])
19
+    })
20
+  }, [id, router.path])
9 21
 
10 22
   return (
11 23
     <view className='Page buildingDynamic'>
@@ -15,17 +27,17 @@ export default withLayout((props) => {
15 27
           <view className='Top'>
16 28
             <text className='iconfont icon-shengming'></text>
17 29
             <text>楼盘资讯</text>
18
-            <text className='active'>免责声明》</text>
30
+            <text className='active' onClick={() => {Taro.navigateTo({url: '/pages/index/disclaimer/index'})}}>免责声明》</text>
19 31
           </view>
20 32
 
21 33
           <view className='List'>
22 34
             {
23
-              List.map((item, index) => (
35
+              PageList.map((item, index) => (
24 36
                 <view key={`ListItem-${index}`}>
25
-                  <text className='Time'>2019年7月12日</text>
37
+                  <text className='Time'>{item.trendTime}</text>
26 38
                   <view className='ItemContent'>
27
-                    <text className='Title'>山和九著府预计5月加推5号楼</text>
28
-                    <text className='desc'>山和九著府预计5月加推5号楼,目前在售房源位于89号楼,均价26400元/㎡,户型建筑面积82、89、112㎡,预计2023年6月交付。</text>
39
+                    <text className='Title'>{item.trendTitle}</text>
40
+                    <text className='desc'>{item.trendContent}</text>
29 41
                     <view className='Line'></view>
30 42
                   </view>
31 43
                 </view>

+ 7
- 6
src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.jsx Zobrazit soubor

@@ -1,6 +1,7 @@
1 1
 
2 2
 import '@/assets/css/iconfont.css'
3 3
 import { Image, Block } from '@tarojs/components'
4
+import Taro from '@tarojs/taro'
4 5
 import './index.scss'
5 6
 
6 7
 export default function SubmitBuyHouseResult (props) {
@@ -39,19 +40,19 @@ export default function SubmitBuyHouseResult (props) {
39 40
                 {
40 41
                   List.map((item, index) => (
41 42
                     <Block key={`ListItem-${index}`}>
42
-                      <view className='PlanTitle'>“方案一:综合匹配度<text>99%</text>”</view>
43
-                      <view className='RecommendBuildingItem'>
43
+                      <view className='PlanTitle'>“方案一”</view>
44
+                      <view className='RecommendBuildingItem' onClick={() => {Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${item.buildingId}` })}}>
44 45
                         <view>
45 46
                           <view className='Img'>
46
-                            <Image mode='aspectFill' src={null} className='centerLabel'></Image>
47
+                            <Image mode='aspectFill' src={item.poster} className='centerLabel'></Image>
47 48
                           </view>
48 49
                           <view className='Title flex-h'>
49 50
                             <view className='flex-item'>
50
-                              <text>奥园金基天著尚居</text>
51
+                              <text>{item.name}</text>
51 52
                             </view>
52
-                            <view className='Price'>约<text>20000/㎡</text></view>
53
+                            <view className='Price'><text>{item.price}</text></view>
53 54
                           </view>
54
-                          <text className='Address'>江宁禄口云熙99路号(诚信大道)</text>
55
+                          <text className='Address'>{item.address}</text>
55 56
                         </view>
56 57
                       </view>
57 58
                     </Block>

+ 57
- 101
src/pages/index/newsList/index.jsx Zobrazit soubor

@@ -1,124 +1,80 @@
1
-import React, { useState, useEffect } from "react";
2
-import { useRouter } from "@tarojs/taro";
3
-import { useSelector } from "react-redux";
4
-import withLayout from "@/layout";
5
-import "./index.scss";
6
-import { ScrollView } from "@tarojs/components";
7
-import "@/assets/css/iconfont.css";
8
-import NewsListItem from "../components/NewsListItem/index";
9
-import { useDidShow } from "@tarojs/taro";
10
-import { queryNewsList } from "@/services/news";
1
+import { useState, useEffect } from 'react'
2
+import { useSelector } from 'react-redux'
3
+import withLayout from '@/layout'
4
+import { ScrollView } from '@tarojs/components'
5
+import '@/assets/css/iconfont.css'
6
+import { fetch } from '@/utils/request'
7
+import { API_NEWS_LIST } from '@/constants/api'
8
+import './index.scss'
9
+import NewsListItem from '../components/NewsListItem/index'
11 10
 
12
-export default withLayout((props) => {
13
-  const router = useRouter();
14
-  const { buildingId, from } = router.params;
15
-  const city = useSelector((state) => state.city);
16
-  // const [PageProps] = useState(props)
17
-  const [PageList, setPageList] = useState([]);
18
-  const [IsPull, setPull] = useState(false);
19
-  const [PullTimer, setPullTimer] = useState(null);
20
-
21
-  const PageRefresh = () => {
22
-    // 页面下拉刷新回调
23
-    setPull(true);
24
-  };
11
+export default withLayout(() => {
12
+  
13
+  const user = useSelector(state => state.user)
14
+  const [PageList, setPageList] = useState([])
15
+  const [IsPull, setPull] = useState(false)
16
+  const [PersonId, setPersonId] = useState(null)
17
+  const [pageNumber, setPageNumber] = useState(1)
18
+  const [HasNextPage, setHasNextPage] = useState(true)
25 19
 
26 20
   useEffect(() => {
27
-    // 下拉刷新触发
28
-    if (IsPull) {
29
-      clearTimeout(PullTimer);
30
-      setPullTimer(
31
-        setTimeout(() => {
32
-          setPull(false);
33
-        }, 2000)
34
-      );
21
+    if(user?.userInfo?.person?.personId) {
22
+      setPersonId(user.userInfo.person.personId)
35 23
     }
36
-  }, [IsPull]);
37
-
38
-  // componentDidShow() {
39
-  //   // // this.onPullDownRefresh()
40
-  //   // console.log('----', this)
41
-  //   const pageSize = (Taro.getStorageSync('newsPageIndex') || 1) * 10
42
-  //   loadData(1, pageSize)
43
-  // }
24
+  }, [user])
44 25
 
45
-  // loadList(pageNumber, pageSize = 10) {
46
-  //   const { curCity: { id: cityId } } = this.props
47
-  //   const payload = { pageSize, pageNumber }
26
+  useEffect(() => {
27
+    if(PersonId) {
28
+      GetPageList()
29
+    }
30
+  }, [pageNumber, PersonId])
48 31
 
49
-  //   const { params: { buildingId, from } } = this.$router
50
-  //   if (cityId) {
51
-  //     payload.cityId = cityId
52
-  //   }
53
-  //   // 从个人中心过来
54
-  //   console.log(this.router, "from")
55
-  //   if (from === 'mine') {
56
-  //     payload.mine = true
57
-  //   }
58
-  //   // // 从项目详情过来
59
-  //   if (buildingId) {
60
-  //     payload.buildingId = buildingId
61
-  //   }
62
-  //   // return queryActivityList(payload)
63
-  //   return queryNewsList(payload)
64
-  // }
32
+  const PageRefresh = () => { // 页面下拉刷新回调
33
+    setPull(true)
34
+  }
65 35
 
66
-  const loadData = (params) => {
67
-    // const currentPage = page || this.state.pageIndex
68
-    // const { curCity: { id: cityId } } = this.props
36
+  const GetPageList = () => {
37
+    setHasNextPage(false)
38
+    fetch({ url: API_NEWS_LIST, method: 'get', payload: { pageNumber, pageSize: 10 } }).then((res) => {
39
+      setPageList(pageNumber === 1 ? res.records || [] : PageList.concat(res.records || []))
40
+      setHasNextPage(res.current < res.pages)
41
+      setPull(false)
42
+    })
43
+  }
69 44
 
70
- 
71
-    // if (from === "mine") {
72
-    //   params.mine = true;
73
-    // }
74
-    // // 从项目详情过来
75
-    if (buildingId) {
76
-      params.buildingId = buildingId;
77
-    }else if(city?.curCity?.id){
78
-      params.cityId = city.curCity.id;
45
+  const PageLoadMore = () => { // 页面上拉加载更多
46
+    if(HasNextPage) {
47
+      setPageNumber(pageNumber + 1)
79 48
     }
49
+  }
80 50
 
81
-    queryNewsList(params).then((res) => {
82
-      const { records, list, total, current, pages, size } = res || {};
83
-      setPageList([...PageList, ...records]);
84
-    });
85
-
86
-    // this.loadList(currentPage, pageSize).then(res => {
87
-    //   const { records, list, total, current, pages, size } = res || {}
88
-    //   const _list = records || list || []
89
-    //   const newList = current <= 1 ? _list : this.state.list.concat(_list)
90
-    //   console.log(res, '---res-------')
91
-    //   const pageNum = Math.max(Taro.getStorageSync('newsPageIndex'), current)
92
-    //   setPageList
93
-    //   this.setState({
94
-    //     list: newList,
95
-    //     isEmpty: total == 0,
96
-    //     hasMore: current * size < total,
97
-    //     pageIndex: pageNum,
98
-    //     // pageIndex: current >= pages ? pages : current,
99
-    //   })
100
-    // })
101
-  };
102
-  useEffect(() => {
103
-    loadData({ page: 0, pageSize: 10 });
104
-  }, []);
51
+  useEffect(() => { // 下拉刷新触发
52
+    if (IsPull) {
53
+      if(pageNumber === 1) {
54
+        GetPageList()
55
+      } else {
56
+        setPageNumber(1)
57
+      }
58
+    }
59
+  }, [IsPull])
105 60
 
106 61
   return (
107
-    <view className="Page newsList">
62
+    <view className='Page newsList'>
108 63
       <ScrollView
109
-        scroll-y={true}
110
-        refresher-enabled={true}
64
+        scroll-y
65
+        refresher-enabled
111 66
         refresher-triggered={IsPull}
112 67
         onrefresherrefresh={PageRefresh}
113
-        refresher-background="#fff"
68
+        refresher-background='#fff'
69
+        onscrolltolower={PageLoadMore}
114 70
       >
115
-        <view className="PageContent">
71
+        <view className='PageContent'>
116 72
           {PageList.map((item, index) => (
117
-            <NewsListItem data={item}></NewsListItem>
73
+            <NewsListItem data={item} key={`ListItem-${index}`}></NewsListItem>
118 74
           ))}
119 75
 
120 76
           {/* bottom */}
121
-          <view className="PageBottom">
77
+          <view className='PageBottom'>
122 78
             <text>已经到底了~</text>
123 79
           </view>
124 80
         </view>