|
@@ -20,52 +20,33 @@ import News from './components/News/index'
|
20
|
20
|
import Pictures from './components/Pictures/index'
|
21
|
21
|
|
22
|
22
|
export default withLayout((props) => {
|
|
23
|
+ const { id } = props.router.params
|
23
|
24
|
|
24
|
|
- const user = useSelector(state => state.user)
|
25
|
|
- const [PersonId, setPersonId] = useState(null)
|
26
|
25
|
const [DetailInfo, setDetailInfo] = useState({})
|
27
|
26
|
const [ActivityList, setActivityList] = useState([])
|
28
|
27
|
const [PictureList, setPictureList] = useState([])
|
29
|
28
|
const [NewsList, setNewsList] = useState([])
|
30
|
|
- const [LiveList, setLiveList] = useState([])
|
31
|
29
|
|
32
|
30
|
const [IsPull, setPull] = useState(false)
|
33
|
31
|
const [PullTimer, setPullTimer] = useState(null)
|
34
|
32
|
|
35
|
33
|
useEffect(() => {
|
36
|
|
- if (user?.userInfo?.person?.personId) {
|
37
|
|
- setPersonId(user.userInfo.person.personId)
|
38
|
|
- }
|
39
|
|
- }, [user])
|
40
|
|
-
|
41
|
|
- useEffect(() => {
|
42
|
|
- if (PersonId) {
|
43
|
|
- GetBuildingDetail()
|
44
|
|
- GetProjectTrendList()
|
45
|
|
- GetActivityList()
|
46
|
|
- GetLiveList()
|
47
|
|
- GetNewsList()
|
48
|
|
- }
|
49
|
|
- }, [PersonId])
|
50
|
|
-
|
51
|
|
- useEffect(() => {
|
52
|
|
- if (DetailInfo.buildingApartment) {
|
53
|
|
- const List = DetailInfo.buildingApartment.filter(item => item.apartmentType === 'photo')
|
54
|
|
- setPictureList(List.filter(item => item.buildingImgList.length > 0))
|
55
|
|
- }
|
56
|
|
- }, [DetailInfo])
|
57
|
|
-
|
58
|
|
- const GetBuildingDetail = () => { // 获取楼盘信息
|
59
|
|
- fetch({ url: `${API_ITEMS_DETAIL}/${props.router.params.id}`, method: 'get' }).then((res) => {
|
|
34
|
+ // 获取楼盘信息
|
|
35
|
+ fetch({ url: `${API_ITEMS_DETAIL}/${id}` }).then((res) => {
|
60
|
36
|
setDetailInfo(res || {})
|
|
37
|
+
|
|
38
|
+ if (res?.buildingApartment) {
|
|
39
|
+ const List = res.buildingApartment.filter(item => item.apartmentType === 'photo')
|
|
40
|
+ setPictureList(List.filter(item => item.buildingImgList.length > 0))
|
|
41
|
+ }
|
61
|
42
|
})
|
62
|
|
- }
|
63
|
43
|
|
64
|
|
- const GetProjectTrendList = () => { // 获取项目动态
|
65
|
|
- fetch({ url: API_PROJECT_TREND_LIST, method: 'get' }).then((res) => {
|
66
|
|
- console.log(res)
|
|
44
|
+ // 获取资讯列表
|
|
45
|
+ fetch({ url: API_NEWS_LIST, params: { buildingId: id, pageSize: 2, pageNum: 1 } }).then((res) => {
|
|
46
|
+ setNewsList(res.records || [])
|
67
|
47
|
})
|
68
|
|
- }
|
|
48
|
+ GetActivityList()
|
|
49
|
+ }, [id])
|
69
|
50
|
|
70
|
51
|
const GetActivityList = () => { // 获取活动列表
|
71
|
52
|
fetch({ url: `${API_ACTIVITY_GROUP}?buildingId=${props.router.params.id}`, method: 'get' }).then((res) => {
|
|
@@ -74,26 +55,6 @@ export default withLayout((props) => {
|
74
|
55
|
})
|
75
|
56
|
}
|
76
|
57
|
|
77
|
|
- const GetLiveList = () => { // 获取直播列表
|
78
|
|
- fetch({ url: `${API_LIVE_LIST}?buildingId=${props.router.params.id}`, method: 'get' }).then((res) => {
|
79
|
|
- let ResArr = res.records.slice(0, 2)
|
80
|
|
- if (ResArr.length === 1) {
|
81
|
|
- ResArr.push({})
|
82
|
|
- }
|
83
|
|
- setLiveList(ResArr || [])
|
84
|
|
- })
|
85
|
|
- }
|
86
|
|
-
|
87
|
|
- const GetNewsList = () => { // 获取资讯列表
|
88
|
|
- fetch({ url: `${API_NEWS_LIST}?buildingId=${props.router.params.id}&pageSize=2&pageNum=1`, method: 'get' }).then((res) => {
|
89
|
|
- let ResArr = res.records.slice(0, 2)
|
90
|
|
- if (ResArr.length === 1) {
|
91
|
|
- ResArr.push({})
|
92
|
|
- }
|
93
|
|
- setNewsList(ResArr || [])
|
94
|
|
- })
|
95
|
|
- }
|
96
|
|
-
|
97
|
58
|
const PageRefresh = () => { // 页面下拉刷新回调
|
98
|
59
|
setPull(true)
|
99
|
60
|
}
|
|
@@ -143,32 +104,32 @@ export default withLayout((props) => {
|
143
|
104
|
</view>
|
144
|
105
|
|
145
|
106
|
{/* 置业顾问 */}
|
146
|
|
- <view className='PropertyConsultant' style={{ display: DetailInfo?.consultants?.length ? 'block' : 'none' }}>
|
|
107
|
+ <view className='PropertyConsultant' style={{minHeight: 0}}>
|
147
|
108
|
<PropertyConsultant List={DetailInfo?.consultants}></PropertyConsultant>
|
148
|
109
|
</view>
|
149
|
110
|
|
150
|
111
|
{/* 位置及周边 */}
|
151
|
|
- <view className='Periphery'>
|
|
112
|
+ <view className='Periphery' style={{minHeight: 0}}>
|
152
|
113
|
<Periphery Info={DetailInfo}></Periphery>
|
153
|
114
|
</view>
|
154
|
115
|
|
155
|
116
|
{/* 户型介绍 */}
|
156
|
|
- <view className='HouseTypeIntro'>
|
|
117
|
+ <view className='HouseTypeIntro' style={{minHeight: 0}}>
|
157
|
118
|
<HouseTypeIntro Info={DetailInfo?.buildingApartment}></HouseTypeIntro>
|
158
|
119
|
</view>
|
159
|
120
|
|
160
|
121
|
{/* 营销活动 */}
|
161
|
|
- <view className='MarketingActivity' style={{ display: ActivityList.length ? 'block' : 'none' }}>
|
|
122
|
+ <view className='MarketingActivity' style={{minHeight: 0}}>
|
162
|
123
|
<MarketingActivity List={ActivityList}></MarketingActivity>
|
163
|
124
|
</view>
|
164
|
125
|
|
165
|
126
|
{/* 直播活动 */}
|
166
|
|
- <view className='LivingActivity' style={{ display: LiveList.length ? 'block' : 'none' }}>
|
167
|
|
- <LivingActivity List={LiveList}></LivingActivity>
|
|
127
|
+ <view className='LivingActivity' style={{minHeight: 0}}>
|
|
128
|
+ <LivingActivity List={DetailInfo?.liveActivityList}></LivingActivity>
|
168
|
129
|
</view>
|
169
|
130
|
|
170
|
131
|
{/* 新鲜资讯 */}
|
171
|
|
- <view className='News' style={{ display: NewsList.length ? 'block' : 'none' }}>
|
|
132
|
+ <view className='News' style={{minHeight: 0}}>
|
172
|
133
|
<News List={NewsList}></News>
|
173
|
134
|
</view>
|
174
|
135
|
|