20261008
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<view class="component" v-if="list.length">
|
||||
<view :style="{padding: padding, height : height}">
|
||||
<swiper class="swiper-box" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
|
||||
<swiper-item v-for="(item, index) in list" :key="index">
|
||||
<view class="swiper-item">
|
||||
<image class="full" :src="item.swiper" mode="" @click="onClick(item)"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
ad: {
|
||||
type: Number,
|
||||
default: () => {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
padding: {
|
||||
type: String,
|
||||
default: '10rpx 30rpx'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '115rpx'
|
||||
},
|
||||
categoryId: {
|
||||
type: [String, Number],
|
||||
default: null
|
||||
},
|
||||
categoryIds: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
categoryName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
categoryNames: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
region: {
|
||||
type: [Object, Array, String, Number],
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getAd() {
|
||||
const res = await vk.callFunction({
|
||||
url: 'client/ad/pub/getList',
|
||||
data: {
|
||||
adKey: this.ad,
|
||||
categoryId: this.categoryId || null,
|
||||
categoryIds: this.categoryIds && this.categoryIds.length ? this.categoryIds : null,
|
||||
categoryName: this.categoryName || null,
|
||||
categoryNames: this.categoryNames && this.categoryNames.length ? this.categoryNames : null,
|
||||
region: this.region || null,
|
||||
}
|
||||
})
|
||||
this.list = res.data || []
|
||||
},
|
||||
onClick(item){
|
||||
if ((item.type === 'company' || !item.type) && item.companyId)
|
||||
vk.navigateTo(`/pages/yellow/detail?id=${item.companyId}`)
|
||||
else if (item.type === 'goods' && item.goodsId)
|
||||
vk.navigateTo(`/pages/shop/detail?id=${item.goodsId}`)
|
||||
// vk.navigateTo(`/pages/yellow/detail?id=${item.companyId}`)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getAd()
|
||||
},
|
||||
watch: {
|
||||
categoryId() {
|
||||
this.getAd()
|
||||
},
|
||||
categoryName() {
|
||||
this.getAd()
|
||||
},
|
||||
categoryIds: {
|
||||
handler() {
|
||||
this.getAd()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
categoryNames: {
|
||||
handler() {
|
||||
this.getAd()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
region: {
|
||||
handler() {
|
||||
this.getAd()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
.swiper-box, .swiper-item {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user