Feat(趣味):轮播广告位对接

This commit is contained in:
lifizer
2024-09-18 11:40:20 +08:00
parent 9b0216c857
commit b3f85d807d
+61
View File
@@ -31,6 +31,36 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="type-banner-wrap">
<view v-if="currType.titleImage" class="title">
<image
:src="currType.titleImage"
mode="heightFix"
class="img"
/>
</view>
<view v-if="currType.carousel" class="slider-wrap">
<swiper
indicatorDots="true"
indicator-color="rgba(255, 255, 255, .3)"
indicator-active-color="#ffffff"
autoplay
circular
style="height: 330rpx;"
>
<block
v-for="(item, bannerIndex) in currType.carousel"
:key="bannerIndex"
>
<swiper-item>
<view class="swiper-item" @click="typeBannerItemClick(item)">
<image :src="item.carouselImage" class="img" />
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<view class="body"> <view class="body">
<view class="flex jc-end"> <view class="flex jc-end">
<view class="city-box" @click="goCity('cloud')"> <view class="city-box" @click="goCity('cloud')">
@@ -95,6 +125,8 @@ export default {
page: 1, page: 1,
typeList: [], typeList: [],
typeIndex: 0, typeIndex: 0,
// 当前选中的类型
currType: {},
cityName: '', cityName: '',
hotelList: [], hotelList: [],
isLoad: false, isLoad: false,
@@ -119,6 +151,7 @@ export default {
onLoad() { onLoad() {
getHotelTypeList().then(({data}) => { getHotelTypeList().then(({data}) => {
this.typeList = data this.typeList = data
this.currType = data[this.typeIndex]
this.getMapData() this.getMapData()
}) })
}, },
@@ -154,6 +187,7 @@ export default {
tapType(index) { tapType(index) {
if (this.typeIndex === index) return if (this.typeIndex === index) return
this.typeIndex = index this.typeIndex = index
this.currType = this.typeList[index]
this.name = '' this.name = ''
this.search() this.search()
}, },
@@ -192,6 +226,10 @@ export default {
}).finally(() => { }).finally(() => {
this.isLoad = true this.isLoad = true
}) })
},
typeBannerItemClick(item) {
if (!item.hotelId) return
uni.navigateTo({ url: `/pagesInn/inn/innHome?id=${item.hotelId}` })
} }
} }
} }
@@ -297,4 +335,27 @@ export default {
.tabbar-page { .tabbar-page {
padding: 0 0 180rpx 0; padding: 0 0 180rpx 0;
} }
.type-banner-wrap {
padding: 0 20rpx;
background-color: #f0f0f0;
.title {
padding: 20rpx 0;
.img {
display: block;
height: 48rpx;
}
}
.slider-wrap {
width: 100%;
height: 330rpx;
padding: 0 0 20rpx 0;
.swiper-item {
.img {
display: block;
width: 100%;
height: 330rpx;
}
}
}
}
</style> </style>