|
@@ -1,9 +1,10 @@
|
1
|
|
-import React, { useState } from 'react'
|
|
1
|
+import React, { useState, useEffect } from 'react'
|
2
|
2
|
import Taro from '@tarojs/taro'
|
3
|
3
|
import { useSelector } from 'react-redux'
|
4
|
4
|
import { Image } from '@tarojs/components'
|
5
|
5
|
import AuthRole from '@/components/auth/AuthRole'
|
6
|
6
|
import Poster from '@/components/Poster'
|
|
7
|
+import { queryActivityList } from '@/services/activity'
|
7
|
8
|
import { ROLE_CODE } from '@/constants/user'
|
8
|
9
|
import './index.scss'
|
9
|
10
|
|
|
@@ -13,6 +14,7 @@ export default function DetailBottom (props) {
|
13
|
14
|
// 当前推荐置业
|
14
|
15
|
const { consultant } = useSelector(s => s.system)
|
15
|
16
|
const [showPoster, setShowPoster] = useState(false)
|
|
17
|
+ const [actList, setActList] = useState([])
|
16
|
18
|
|
17
|
19
|
const handleCall = () => {
|
18
|
20
|
if (Info.tel) {
|
|
@@ -45,6 +47,25 @@ export default function DetailBottom (props) {
|
45
|
47
|
})
|
46
|
48
|
}
|
47
|
49
|
|
|
50
|
+ const handleTuanfang = () => {
|
|
51
|
+ const id = actList[0].dynamicId
|
|
52
|
+
|
|
53
|
+ Taro.navigateTo({
|
|
54
|
+ url: `/pages/index/activityDetail/index?id=${id}`
|
|
55
|
+ })
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ useEffect(() => {
|
|
59
|
+ if (Info.buildingId) {
|
|
60
|
+ queryActivityList({ buildingId: Info.buildingId, pageSize: 1, type: 'house' }).then((res) => {
|
|
61
|
+ const { list } = res || {}
|
|
62
|
+
|
|
63
|
+ // 只保留已发布的活动
|
|
64
|
+ setActList((list || []))
|
|
65
|
+ })
|
|
66
|
+ }
|
|
67
|
+ }, [Info.buildingId])
|
|
68
|
+
|
48
|
69
|
return (
|
49
|
70
|
<view>
|
50
|
71
|
<view className='components DetailBottom flex-h'>
|
|
@@ -52,10 +73,14 @@ export default function DetailBottom (props) {
|
52
|
73
|
<Image mode='heightFix' src={require('@/assets/buildingDetail-icon3.png')}></Image>
|
53
|
74
|
<text>一键海报</text>
|
54
|
75
|
</view>
|
55
|
|
- <view className='Item'>
|
56
|
|
- <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
|
57
|
|
- <text>一键带看</text>
|
58
|
|
- </view>
|
|
76
|
+ {
|
|
77
|
+ actList.length > 0 && (
|
|
78
|
+ <view className='Item' onClick={handleTuanfang}>
|
|
79
|
+ <Image mode='heightFix' src={require('@/assets/buildingDetail-icon1.png')}></Image>
|
|
80
|
+ <text>一键带看</text>
|
|
81
|
+ </view>
|
|
82
|
+ )
|
|
83
|
+ }
|
59
|
84
|
<AuthRole role={ROLE_CODE.CONSULTANT}>
|
60
|
85
|
<view className='Item' onClick={handleRecommender}>
|
61
|
86
|
<Image mode='heightFix' src={require('@/assets/buildingDetail-icon2.png')}></Image>
|