|
@@ -1,19 +1,36 @@
|
1
|
|
-
|
|
1
|
+import { useEffect, useState } from 'react'
|
|
2
|
+import Taro from '@tarojs/taro'
|
2
|
3
|
import { Swiper, SwiperItem, Image } from '@tarojs/components'
|
3
|
4
|
import { getImgURL } from '@/utils/image'
|
|
5
|
+import { queryActivityList } from '@/services/activity'
|
4
|
6
|
import '@/assets/css/iconfont.css'
|
5
|
7
|
import './index.scss'
|
6
|
8
|
|
7
|
9
|
export default function MarketingActivity (props) {
|
8
|
|
- const { List = [] } = props
|
9
|
|
- return (
|
|
10
|
+ const { Info } = props
|
|
11
|
+ const { buildingId } = Info || {}
|
|
12
|
+
|
|
13
|
+ const [dataList, setDataList] = useState([])
|
|
14
|
+
|
|
15
|
+ const goMore = () => Taro.navigateTo({ url: `/pages/index/activityList/index?type=house&buildingId=${buildingId}` })
|
|
16
|
+
|
|
17
|
+ useEffect(() => {
|
|
18
|
+ queryActivityList({ buildingId, pageSize: 3 }).then((res) => {
|
|
19
|
+ const { list } = res || {}
|
|
20
|
+ setDataList(list || [])
|
|
21
|
+ })
|
|
22
|
+ }, [buildingId])
|
|
23
|
+
|
|
24
|
+ console.log('----------->', dataList)
|
|
25
|
+
|
|
26
|
+ return dataList.length > 0 && (
|
10
|
27
|
<view className='components MarketingActivity'>
|
11
|
28
|
|
12
|
29
|
<view className='Title flex-h'>
|
13
|
30
|
<view className='flex-item'>
|
14
|
31
|
<text>营销活动</text>
|
15
|
32
|
</view>
|
16
|
|
- <text>更多</text>
|
|
33
|
+ <text onClick={goMore}>更多</text>
|
17
|
34
|
<text className='iconfont icon-jiantouright'></text>
|
18
|
35
|
</view>
|
19
|
36
|
|
|
@@ -21,7 +38,7 @@ export default function MarketingActivity (props) {
|
21
|
38
|
<view>
|
22
|
39
|
<Swiper autoplay interval={2000} indicator-dots>
|
23
|
40
|
{
|
24
|
|
- List.map((item, index) => (
|
|
41
|
+ dataList.map((item, index) => (
|
25
|
42
|
<SwiperItem key={`Banner-${index}`}>
|
26
|
43
|
<view className='swiper-item'>
|
27
|
44
|
<Image mode='aspectFill' className='centerLabel' src={getImgURL(item.bannerListImg || item.image || item.url || item.img || item.imgUrl || item.detailImg)} />
|