Преглед на файлове

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

Your Name преди 3 години
родител
ревизия
bf02ab6073

+ 4
- 0
src/constants/api.js Целия файл

250
 export const API_BIND_CUSTOMER = resolvePath('judgeBindCustomer')
250
 export const API_BIND_CUSTOMER = resolvePath('judgeBindCustomer')
251
 // 消息模板
251
 // 消息模板
252
 export const API_TEMPLATE_TYPE = resolvePath('template/of/')
252
 export const API_TEMPLATE_TYPE = resolvePath('template/of/')
253
+
254
+// 品牌商
255
+export const API_BRAND_LIST = resolvePath('brand')
256
+export const API_BRAND_INFO = resolvePath('brand')

+ 42
- 35
src/pages/index/activityList/index.jsx Целия файл

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import { useSelector } from 'react-redux'
2
 import { useSelector } from 'react-redux'
3
-import { useDidShow,useRouter } from '@tarojs/taro'
3
+import { useRouter } from '@tarojs/taro'
4
 import { ScrollView } from '@tarojs/components'
4
 import { ScrollView } from '@tarojs/components'
5
-import { queryActivityList, getActNewList } from '@/services/activity'
6
 import Disclaimer from '@/components/Disclaimer'
5
 import Disclaimer from '@/components/Disclaimer'
6
+import { fetch } from '@/utils/request'
7
+import { API_ACTIVITY_LIST } from '@/constants/api'
7
 
8
 
8
 import ActivityListItem from '../components/ActivityListItem/index'
9
 import ActivityListItem from '../components/ActivityListItem/index'
9
 
10
 
10
 import './index.scss'
11
 import './index.scss'
11
 
12
 
12
-export default function MyCollectForActivity (props) {
13
+export default function MyCollectForActivity () {
13
 
14
 
14
  const router=useRouter()
15
  const router=useRouter()
15
    const { type,buildingId } = router.params;
16
    const { type,buildingId } = router.params;
16
   const city = useSelector(state => state.city)
17
   const city = useSelector(state => state.city)
17
- 
18
+  
19
+  const user = useSelector(state => state.user)
18
   const [PageList, setPageList] = useState([])
20
   const [PageList, setPageList] = useState([])
19
   const [IsPull, setPull] = useState(false)
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
   const PageRefresh = () => { // 页面下拉刷新回调
38
   const PageRefresh = () => { // 页面下拉刷新回调
23
     setPull(true)
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
   useEffect(() => { // 下拉刷新触发
57
   useEffect(() => { // 下拉刷新触发
27
     if (IsPull) {
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
   }, [IsPull])
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
   return (
67
   return (
61
     <view className='components activityList'>
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
         <view className='PageContent'>
70
         <view className='PageContent'>
64
           <view className='List'>
71
           <view className='List'>
65
             {
72
             {

+ 142
- 0
src/pages/index/addedValueService/formData.js Целия файл

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 Целия файл

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
 import '@/assets/css/iconfont.css'
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
         </view>
143
         </view>
41
       </ScrollView>
144
       </ScrollView>
42
-
43
     </view>
145
     </view>
44
   )
146
   )
45
-})
147
+}

+ 163
- 3
src/pages/index/addedValueService/index.scss Целия файл

1
-.Page.addedValueService {
2
-  background: #fff;
1
+.components.AddedValueService {
2
+  width: 100%;
3
+  height: 100%;
4
+  position: relative;
5
+  overflow: hidden;
3
   > scroll-view {
6
   > scroll-view {
4
     width: 100%;
7
     width: 100%;
5
     height: 100%;
8
     height: 100%;
9
+    position: relative;
6
     .PageContent {
10
     .PageContent {
7
       position: relative;
11
       position: relative;
8
       overflow: hidden;
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
 }

+ 41
- 7
src/pages/index/brandDetail/index.jsx Целия файл

1
-import { useState } from 'react'
1
+import { useEffect, useState } from 'react'
2
 import withLayout from '@/layout'
2
 import withLayout from '@/layout'
3
 import Taro from '@tarojs/taro'
3
 import Taro from '@tarojs/taro'
4
 import { ScrollView, Image } from '@tarojs/components'
4
 import { ScrollView, Image } from '@tarojs/components'
5
 import ProjectListItem from '@/components/ProjectListItem/index'
5
 import ProjectListItem from '@/components/ProjectListItem/index'
6
+import { queryBrandInfo } from '@/services/common';
7
+import { getItemList } from '@/services/item';
8
+import { getImgURL } from '@/utils/image'
6
 import '@/assets/css/iconfont.css'
9
 import '@/assets/css/iconfont.css'
7
-import './index.scss'
8
 import ColumnTitle from '../components/ColumnTitle/index'
10
 import ColumnTitle from '../components/ColumnTitle/index'
11
+import './index.scss'
12
+
13
+export default withLayout((props) => {
14
+  const { router } = props
15
+  const { id } = router.params
9
 
16
 
10
-export default withLayout(() => {
11
   const [ProjectList, setProjectList] = useState([{}, {}])
17
   const [ProjectList, setProjectList] = useState([{}, {}])
18
+  const [brandInfo, setBrandInfo] = useState({})
19
+
20
+  const getList = (params) => {
21
+    Taro.showLoading()
22
+    getItemList({
23
+      brandId: id,
24
+      ...(params || {}),
25
+    }).then((res) => {
26
+      const { records } = res
27
+      setProjectList(records || {})
28
+      Taro.hideLoading()
29
+    }).catch((err) => {
30
+      console.error(err)
31
+      Taro.hideLoading()
32
+    })
33
+  }
34
+
35
+  useEffect(() => {
36
+    if (id) {
37
+      queryBrandInfo(id).then((res) => {
38
+        setBrandInfo(res || {})
39
+      }).catch((err) => {
40
+        console.error(err)
41
+      })
42
+
43
+      getList({ pageNumber: 1 })
44
+    }
45
+  }, [id])
46
+
12
   return (
47
   return (
13
     <view className='brandDetail'>
48
     <view className='brandDetail'>
14
       <ScrollView scroll-y>
49
       <ScrollView scroll-y>
16
 
51
 
17
           {/* 主图 */}
52
           {/* 主图 */}
18
           <view className='Top'>
53
           <view className='Top'>
19
-            <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
54
+            <Image mode='scaleToFill' src={getImgURL(brandInfo.brandImg)} className='centerLabel'></Image>
20
           </view>
55
           </view>
21
 
56
 
22
           {/* 简介 */}
57
           {/* 简介 */}
23
           <view className='Desc'>
58
           <view className='Desc'>
24
             <view>
59
             <view>
25
-              <Image mode='heightFix' src={null} className='Logo'></Image>
60
+              <Image mode='heightFix' src={getImgURL(brandInfo.brandLogo)} className='Logo'></Image>
26
               <view>
61
               <view>
27
-                <text>“东原”</text>
28
-                <text>是一家以地产开发、商业运营、物业服务为核心的大型综合企业。始终坚持稳健创进的发展战略,深耕精选,布局全国一线及强二线城市,位列2020中国房地产开发企业TOP44。</text>
62
+                <text>{brandInfo.brandRemark}</text>
29
               </view>
63
               </view>
30
             </view>
64
             </view>
31
           </view>
65
           </view>

+ 5
- 5
src/pages/index/brandDetail/index.scss Целия файл

47
             >text {
47
             >text {
48
               font-size: 22px;
48
               font-size: 22px;
49
               line-height: 48px;
49
               line-height: 48px;
50
-              &:first-child {
51
-                font-size: 48px;
52
-                font-weight: bold;
53
-                line-height: 1;
54
-              }
50
+              // &:first-child {
51
+              //   font-size: 48px;
52
+              //   font-weight: bold;
53
+              //   line-height: 1;
54
+              // }
55
             }
55
             }
56
           }
56
           }
57
         }
57
         }

+ 14
- 18
src/pages/index/brandList/index.jsx Целия файл

2
 import Taro from '@tarojs/taro';
2
 import Taro from '@tarojs/taro';
3
 import withLayout from '@/layout';
3
 import withLayout from '@/layout';
4
 import { ScrollView, View, Block, Image } from '@tarojs/components';
4
 import { ScrollView, View, Block, Image } from '@tarojs/components';
5
+import { queryBrandList } from '@/services/common';
6
+import { getImgURL } from '@/utils/image';
5
 import '@/assets/css/iconfont.css';
7
 import '@/assets/css/iconfont.css';
6
-import { queryCityList } from '@/services/common';
7
-import { dispatchCitySelected } from '@/actions/city';
8
-import { useDispatch } from 'react-redux';
9
 import './index.scss';
8
 import './index.scss';
10
 
9
 
11
 export default withLayout(() => {
10
 export default withLayout(() => {
12
-  const dispatch = useDispatch();
13
   const [list, setList] = useState({});
11
   const [list, setList] = useState({});
14
 
12
 
15
   useEffect(() => {
13
   useEffect(() => {
17
   }, [])
15
   }, [])
18
 
16
 
19
   function initData () {
17
   function initData () {
20
-    queryCityList().then((cityList) => {
21
-      console.log(`ttt`, cityList)
22
-      const t = cityList.reduce((prev, cur) => {
23
-        if (prev[cur.initial]) {
24
-          prev[cur.initial].push(cur)
18
+    queryBrandList({ pageSize: 500 }).then((res) => {
19
+      const { records } = res
20
+      const lst = (records || []).reduce((prev, cur) => {
21
+        if (prev[cur.indexLetter]) {
22
+          prev[cur.indexLetter].push(cur)
25
         } else {
23
         } else {
26
-          prev[cur.initial] = [cur]
24
+          prev[cur.indexLetter] = [cur]
27
         }
25
         }
28
         return prev
26
         return prev
29
       }, {})
27
       }, {})
30
 
28
 
31
-      setList(t)
29
+      setList(lst)
32
     })
30
     })
33
   }
31
   }
34
 
32
 
35
   function handleSelected (item) {
33
   function handleSelected (item) {
36
-    dispatchCitySelected(item)(dispatch).then(() => {
37
-      Taro.navigateBack({
38
-        delta: 1,
39
-      })
34
+    Taro.navigateTo({
35
+      url: `/pages/index/brandDetail/index?id=${item.brandId}`,
40
     })
36
     })
41
   }
37
   }
42
 
38
 
56
               <Block key={key}>
52
               <Block key={key}>
57
                 <View className='city-initial'>{key}</View>
53
                 <View className='city-initial'>{key}</View>
58
                 {list[key].map((item) => (
54
                 {list[key].map((item) => (
59
-                  <View key={item.id} className='city-item' onClick={() => handleSelected(item)}>
60
-                    <Image mode='heightFix' src={null}></Image>
61
-                    <text>{item.shortname}</text>
55
+                  <View key={item.brandId} className='city-item' onClick={() => handleSelected(item)}>
56
+                    <Image mode='heightFix' src={getImgURL(item.brandLogo)}></Image>
57
+                    <text>{item.brandName}</text>
62
                   </View>
58
                   </View>
63
                 ))}
59
                 ))}
64
               </Block>
60
               </Block>

+ 3
- 0
src/pages/index/brandList/index.scss Целия файл

14
   .city-item {
14
   .city-item {
15
     padding: 30px 50px;
15
     padding: 30px 50px;
16
     background: white;
16
     background: white;
17
+
17
     >image {
18
     >image {
18
       width: auto;
19
       width: auto;
19
       height: 44px;
20
       height: 44px;
20
       margin-right: 10px;
21
       margin-right: 10px;
22
+      vertical-align: middle;
21
     }
23
     }
22
     >text {
24
     >text {
23
       font-size: 34px;
25
       font-size: 34px;
24
       font-weight: bold;
26
       font-weight: bold;
27
+      vertical-align: middle;
25
     }
28
     }
26
   }
29
   }
27
 }
30
 }

+ 1
- 5
src/pages/index/buildingDetail/components/DetailBottom/index.jsx Целия файл

2
 import Taro from '@tarojs/taro'
2
 import Taro from '@tarojs/taro'
3
 import { useSelector } from 'react-redux'
3
 import { useSelector } from 'react-redux'
4
 import { Image } from '@tarojs/components'
4
 import { Image } from '@tarojs/components'
5
-import AuthRole from '@/components/auth/AuthRole'
5
+import AuthRole from '@/components/Auth/AuthRole'
6
 // import Poster from '@/components/Poster'
6
 // import Poster from '@/components/Poster'
7
 import { queryActivityList } from '@/services/activity'
7
 import { queryActivityList } from '@/services/activity'
8
 import { ROLE_CODE } from '@/constants/user'
8
 import { ROLE_CODE } from '@/constants/user'
88
               <Image mode='heightFix' src={require('@/assets/buildingDetail-icon2.png')}></Image>
88
               <Image mode='heightFix' src={require('@/assets/buildingDetail-icon2.png')}></Image>
89
               <text>一键推荐</text>
89
               <text>一键推荐</text>
90
             </view>
90
             </view>
91
-            <view className='Item'>
92
-              <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
93
-              <text>一键带看</text>
94
-            </view>
95
           </AuthRole>
91
           </AuthRole>
96
         </view>
92
         </view>
97
         <view className='Btn'>
93
         <view className='Btn'>

+ 2
- 1
src/pages/index/buildingDetail/components/Periphery/index.jsx Целия файл

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

+ 4
- 1
src/pages/index/buildingDetail/index.jsx Целия файл

64
 
64
 
65
   }, [id, router.path])
65
   }, [id, router.path])
66
 
66
 
67
+  // 户型图
68
+  const houseTypeImages = (DetailInfo?.buildingApartment || []).filter(x => x.apartmentType === 'apart')
69
+
67
   return (
70
   return (
68
     <view className='Page buildingDetail flex-v'>
71
     <view className='Page buildingDetail flex-v'>
69
       <view className='flex-item'>
72
       <view className='flex-item'>
110
 
113
 
111
                 {/* 户型介绍 */}
114
                 {/* 户型介绍 */}
112
                 <view className='HouseTypeIntro' style={{minHeight: 0}}>
115
                 <view className='HouseTypeIntro' style={{minHeight: 0}}>
113
-                  <HouseTypeIntro Info={DetailInfo?.buildingApartment}></HouseTypeIntro>
116
+                  <HouseTypeIntro Info={houseTypeImages}></HouseTypeIntro>
114
                 </view>
117
                 </view>
115
 
118
 
116
                 {/* 营销活动 */}
119
                 {/* 营销活动 */}

+ 19
- 7
src/pages/index/buildingDynamic/index.jsx Целия файл

1
-
1
+import { useState, useEffect } from 'react'
2
+import Taro from '@tarojs/taro'
2
 import withLayout from '@/layout'
3
 import withLayout from '@/layout'
4
+import { fetch } from '@/utils/request'
5
+import { API_ITEMS_DETAIL } from '@/constants/api'
3
 import { ScrollView } from '@tarojs/components'
6
 import { ScrollView } from '@tarojs/components'
4
 import '@/assets/css/iconfont.css'
7
 import '@/assets/css/iconfont.css'
5
 import './index.scss'
8
 import './index.scss'
6
 
9
 
7
 export default withLayout((props) => {
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
   return (
22
   return (
11
     <view className='Page buildingDynamic'>
23
     <view className='Page buildingDynamic'>
15
           <view className='Top'>
27
           <view className='Top'>
16
             <text className='iconfont icon-shengming'></text>
28
             <text className='iconfont icon-shengming'></text>
17
             <text>楼盘资讯</text>
29
             <text>楼盘资讯</text>
18
-            <text className='active'>免责声明》</text>
30
+            <text className='active' onClick={() => {Taro.navigateTo({url: '/pages/index/disclaimer/index'})}}>免责声明》</text>
19
           </view>
31
           </view>
20
 
32
 
21
           <view className='List'>
33
           <view className='List'>
22
             {
34
             {
23
-              List.map((item, index) => (
35
+              PageList.map((item, index) => (
24
                 <view key={`ListItem-${index}`}>
36
                 <view key={`ListItem-${index}`}>
25
-                  <text className='Time'>2019年7月12日</text>
37
+                  <text className='Time'>{item.trendTime}</text>
26
                   <view className='ItemContent'>
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
                     <view className='Line'></view>
41
                     <view className='Line'></view>
30
                   </view>
42
                   </view>
31
                 </view>
43
                 </view>

+ 1
- 0
src/pages/index/buildingInfo/index.jsx Целия файл

22
       { name: '均价', value: Info.price || '待定', key: '' },
22
       { name: '均价', value: Info.price || '待定', key: '' },
23
       { name: '销售状态', value: Info.marketStatus || '待定', key: '' },
23
       { name: '销售状态', value: Info.marketStatus || '待定', key: '' },
24
       { name: '开盘日期', value: formateDate(Info.openingDate) || '待定', key: '' },
24
       { name: '开盘日期', value: formateDate(Info.openingDate) || '待定', key: '' },
25
+      { name: '交房时间', value: formateDate(Info.receivedDate) || '待定', key: '' },
25
       { name: '楼盘地址', value: Info.address || '暂无', key: '' },
26
       { name: '楼盘地址', value: Info.address || '暂无', key: '' },
26
     ],
27
     ],
27
     [
28
     [

+ 7
- 7
src/pages/index/components/HotRecommend/index.jsx Целия файл

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import { useSelector } from 'react-redux'
2
 import { useSelector } from 'react-redux'
3
 import Taro from '@tarojs/taro'
3
 import Taro from '@tarojs/taro'
4
-import { fetch } from '@/utils/request'
5
-import { API_ACTIVITY_LIST } from '@/constants/api'
6
-import { queryActivityList, getActNewList } from '@/services/activity'
7
-import './index.scss'
4
+import { queryActivityList } from '@/services/activity'
8
 import '@/assets/css/iconfont.css'
5
 import '@/assets/css/iconfont.css'
6
+import './index.scss'
9
 
7
 
10
-export default function HotRecommend () {
8
+export default function HotRecommend (props) {
11
 
9
 
10
+  const { change = () => {} } = props
12
   const city = useSelector(state => state.city)
11
   const city = useSelector(state => state.city)
13
   const [MenuList] = useState([{ name: '热门活动', id: 'dymic' }, { name: '热门团房', id: 'house' }])
12
   const [MenuList] = useState([{ name: '热门活动', id: 'dymic' }, { name: '热门团房', id: 'house' }])
14
   const [CurrentId, setCurrentId] = useState('dymic')
13
   const [CurrentId, setCurrentId] = useState('dymic')
24
   const GetRecommendActivity = () => {
23
   const GetRecommendActivity = () => {
25
     
24
     
26
       queryActivityList({home:1,cityId: city.curCity.id}).then((res)=>{
25
       queryActivityList({home:1,cityId: city.curCity.id}).then((res)=>{
27
-        console.log(res,'-----------------')
28
-        setList(res.list)
26
+        const resArr = res.list || []
27
+        setList(resArr)
28
+        change(!!resArr.length)
29
       })
29
       })
30
   }
30
   }
31
 
31
 

+ 4
- 2
src/pages/index/components/LiveSale/index.jsx Целия файл

5
 import { fetch } from '@/utils/request'
5
 import { fetch } from '@/utils/request'
6
 import { getImgURL } from '@/utils/image'
6
 import { getImgURL } from '@/utils/image'
7
 import { API_LIVE_LIST } from '@/constants/api'
7
 import { API_LIVE_LIST } from '@/constants/api'
8
-import './index.scss'
9
 import '@/assets/css/iconfont.css'
8
 import '@/assets/css/iconfont.css'
9
+import './index.scss'
10
 
10
 
11
-export default function LiveSale () {
11
+export default function LiveSale (props) {
12
 
12
 
13
+  const { change = () => {} } = props
13
   const city = useSelector(state => state.city)
14
   const city = useSelector(state => state.city)
14
   const [MenuList] = useState([{ name: '全部', id: 1 }, { name: '预告', id: 2 }, { name: '直播中', id: 3 }, { name: '新房推荐', id: 4 }])
15
   const [MenuList] = useState([{ name: '全部', id: 1 }, { name: '预告', id: 2 }, { name: '直播中', id: 3 }, { name: '新房推荐', id: 4 }])
15
   const [CurrentId, setCurrentId] = useState(1)
16
   const [CurrentId, setCurrentId] = useState(1)
24
   const GetLiveList = () => {
25
   const GetLiveList = () => {
25
     fetch({url: API_LIVE_LIST, method: 'get', payload: {cityId: city.curCity.id, pageNum: 1, pageSize: 20}}).then((res) => {
26
     fetch({url: API_LIVE_LIST, method: 'get', payload: {cityId: city.curCity.id, pageNum: 1, pageSize: 20}}).then((res) => {
26
       setPageList(res.records || [])
27
       setPageList(res.records || [])
28
+      change(!!(res.records || []).length)
27
     })
29
     })
28
   }
30
   }
29
 
31
 

+ 1
- 1
src/pages/index/components/Menu/index.jsx Целия файл

7
   const List = [
7
   const List = [
8
     { name: '全部楼盘', id: 1, icon: require('../../../../assets/index-icon9.png'), router: '/pages/index/buildingList/index' },
8
     { name: '全部楼盘', id: 1, icon: require('../../../../assets/index-icon9.png'), router: '/pages/index/buildingList/index' },
9
     { name: '品牌地产', id: 2, icon: require('../../../../assets/index-icon8.png'), router: '/pages/index/brandList/index' },
9
     { name: '品牌地产', id: 2, icon: require('../../../../assets/index-icon8.png'), router: '/pages/index/brandList/index' },
10
-    { name: '近期开盘', id: 3, icon: require('../../../../assets/index-icon6.png'), router: `/pages/index/buildingList/index?type=2` },
10
+    { name: '近期开盘', id: 3, icon: require('../../../../assets/index-icon6.png'), router: `/pages/index/buildingList/index?isRecentOpening=1` },
11
     { name: '帮我找房', id: 4, icon: require('../../../../assets/index-icon1.png'), router: '/pages/index/helpToFindHouse/index' },
11
     { name: '帮我找房', id: 4, icon: require('../../../../assets/index-icon1.png'), router: '/pages/index/helpToFindHouse/index' },
12
     { name: '增值服务', id: 5, icon: require('../../../../assets/index-icon16.png'), router: '/pages/index/addedValueService/index' },
12
     { name: '增值服务', id: 5, icon: require('../../../../assets/index-icon16.png'), router: '/pages/index/addedValueService/index' },
13
     { name: '地图找房', id: 6, icon: require('../../../../assets/index-icon2.png'), router: '/pages/index/findHouseFromMap/index' },
13
     { name: '地图找房', id: 6, icon: require('../../../../assets/index-icon2.png'), router: '/pages/index/findHouseFromMap/index' },

+ 7
- 6
src/pages/index/helpToFindHouse/components/SubmitBuyHouseResult/index.jsx Целия файл

1
 
1
 
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
 import { Image, Block } from '@tarojs/components'
3
 import { Image, Block } from '@tarojs/components'
4
+import Taro from '@tarojs/taro'
4
 import './index.scss'
5
 import './index.scss'
5
 
6
 
6
 export default function SubmitBuyHouseResult (props) {
7
 export default function SubmitBuyHouseResult (props) {
39
                 {
40
                 {
40
                   List.map((item, index) => (
41
                   List.map((item, index) => (
41
                     <Block key={`ListItem-${index}`}>
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
                         <view>
45
                         <view>
45
                           <view className='Img'>
46
                           <view className='Img'>
46
-                            <Image mode='aspectFill' src={null} className='centerLabel'></Image>
47
+                            <Image mode='aspectFill' src={item.poster} className='centerLabel'></Image>
47
                           </view>
48
                           </view>
48
                           <view className='Title flex-h'>
49
                           <view className='Title flex-h'>
49
                             <view className='flex-item'>
50
                             <view className='flex-item'>
50
-                              <text>奥园金基天著尚居</text>
51
+                              <text>{item.name}</text>
51
                             </view>
52
                             </view>
52
-                            <view className='Price'>约<text>20000/㎡</text></view>
53
+                            <view className='Price'><text>{item.price}</text></view>
53
                           </view>
54
                           </view>
54
-                          <text className='Address'>江宁禄口云熙99路号(诚信大道)</text>
55
+                          <text className='Address'>{item.address}</text>
55
                         </view>
56
                         </view>
56
                       </view>
57
                       </view>
57
                     </Block>
58
                     </Block>

+ 14
- 4
src/pages/index/index.jsx Целия файл

23
   const [ProjectList, setProjectList] = useState([])
23
   const [ProjectList, setProjectList] = useState([])
24
   const [IsPull, setPull] = useState(false)
24
   const [IsPull, setPull] = useState(false)
25
   const [PullTimer, setPullTimer] = useState(null)
25
   const [PullTimer, setPullTimer] = useState(null)
26
+  const [ShowHotRecommend, setShowHotRecommend] = useState(false)
27
+  const [ShowLive, setShowLive] = useState(false)
26
 
28
 
27
   useEffect(() => {
29
   useEffect(() => {
28
     if (city.curCity.name) {
30
     if (city.curCity.name) {
47
     setPull(true)
49
     setPull(true)
48
   }
50
   }
49
 
51
 
52
+  const HotRecommendChange = (e) => {
53
+    setShowHotRecommend(e)
54
+  }
55
+
56
+  const LiveChange = (e) => {
57
+    setShowLive(e)
58
+  }
59
+
50
   useEffect(() => { // 下拉刷新触发
60
   useEffect(() => { // 下拉刷新触发
51
     if (IsPull) {
61
     if (IsPull) {
52
       clearTimeout(PullTimer)
62
       clearTimeout(PullTimer)
82
           </view>
92
           </view>
83
 
93
 
84
           {/* 热门推荐 */}
94
           {/* 热门推荐 */}
85
-          <view className='HotRecommend'>
95
+          <view className='HotRecommend' style={{display: ShowHotRecommend ? 'block' : 'none'}}>
86
             <ColumnTitle Name='热门推荐' Icon='icon-shoucang'></ColumnTitle>
96
             <ColumnTitle Name='热门推荐' Icon='icon-shoucang'></ColumnTitle>
87
-            <HotRecommend></HotRecommend>
97
+            <HotRecommend change={HotRecommendChange}></HotRecommend>
88
           </view>
98
           </view>
89
 
99
 
90
           {/* 直播购房 */}
100
           {/* 直播购房 */}
91
-          <view className='LiveSale'>
101
+          <view className='LiveSale' style={{display: ShowLive ? 'block' : 'none'}}>
92
             <ColumnTitle Name='直播购房' Icon='icon-yinpin' ShowMore ToMore={() => { Taro.switchTab({ url: `/pages/video/index` }) }}></ColumnTitle>
102
             <ColumnTitle Name='直播购房' Icon='icon-yinpin' ShowMore ToMore={() => { Taro.switchTab({ url: `/pages/video/index` }) }}></ColumnTitle>
93
-            <LiveSale></LiveSale>
103
+            <LiveSale change={LiveChange}></LiveSale>
94
           </view>
104
           </view>
95
 
105
 
96
           {/* 全部项目 */}
106
           {/* 全部项目 */}

+ 57
- 101
src/pages/index/newsList/index.jsx Целия файл

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
   useEffect(() => {
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
   return (
61
   return (
107
-    <view className="Page newsList">
62
+    <view className='Page newsList'>
108
       <ScrollView
63
       <ScrollView
109
-        scroll-y={true}
110
-        refresher-enabled={true}
64
+        scroll-y
65
+        refresher-enabled
111
         refresher-triggered={IsPull}
66
         refresher-triggered={IsPull}
112
         onrefresherrefresh={PageRefresh}
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
           {PageList.map((item, index) => (
72
           {PageList.map((item, index) => (
117
-            <NewsListItem data={item}></NewsListItem>
73
+            <NewsListItem data={item} key={`ListItem-${index}`}></NewsListItem>
118
           ))}
74
           ))}
119
 
75
 
120
           {/* bottom */}
76
           {/* bottom */}
121
-          <view className="PageBottom">
77
+          <view className='PageBottom'>
122
             <text>已经到底了~</text>
78
             <text>已经到底了~</text>
123
           </view>
79
           </view>
124
         </view>
80
         </view>

+ 15
- 0
src/services/common.js Целия файл

7
   API_BURIED_POINT,
7
   API_BURIED_POINT,
8
   API_CITY_LIST,
8
   API_CITY_LIST,
9
   API_TEMPLATE_TYPE,
9
   API_TEMPLATE_TYPE,
10
+  API_BRAND_LIST,
11
+  API_BRAND_INFO,
10
   API_INDEX_ICONS
12
   API_INDEX_ICONS
11
 } from "@/constants/api";
13
 } from "@/constants/api";
12
 
14
 
88
  */
90
  */
89
 export const queryMessageTPL = type =>
91
 export const queryMessageTPL = type =>
90
   fetch({ url: `${API_TEMPLATE_TYPE}/${type}` });
92
   fetch({ url: `${API_TEMPLATE_TYPE}/${type}` });
93
+
94
+
95
+/**
96
+ * 获取品牌房企列表
97
+ * @param {*}
98
+ */
99
+export const queryBrandList = (params) => fetch({ url: API_BRAND_LIST, params });
100
+
101
+/**
102
+ * 获取品牌房企列表
103
+ * @param {*}
104
+ */
105
+ export const queryBrandInfo = (id) => fetch({ url: `${API_BRAND_INFO}/${id}`});