mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-04 22:59:49 +08:00
【新增】优化广告组件,表【CoreCmsAdvertPosition】新增【platform】广告平台字段,【type】广告位类型两个字段,用于区分pc,h5,小程序多端,以及图片还是轮播图展示形式。
This commit is contained in:
@@ -2,8 +2,15 @@
|
||||
<view>
|
||||
<!--提示框组件-->
|
||||
<u-toast ref="uToast" />
|
||||
<view v-for="(item, index) in advert" :key="index">
|
||||
<u--image :showLoading="true" :src="item.imageUrl" mode="widthFix" width="100%" height="auto" @click="showSliderInfo(item.type, item.val)"></u--image>
|
||||
<view v-if="position && advert">
|
||||
<view v-if="position.type==1">
|
||||
<view v-for="(item, index) in advert" :key="index">
|
||||
<u--image :showLoading="true" :src="item.imageUrl" mode="widthFix" width="100%" height="auto" @click="showSliderInfo(item.type, item.val)"></u--image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<u-swiper :list="advert" indicator indicatorMode="line" circular keyName="imageUrl" :showTitle="showTitle" @click="clickSwiper"></u-swiper>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -11,29 +18,47 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
codes: {
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'tpl1_class_banner1'
|
||||
}
|
||||
},
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
position: {},
|
||||
advert: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
//console.log(this.codes);
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.$u.api.advert({
|
||||
codes: this.codes
|
||||
code: this.code,
|
||||
platform: 3
|
||||
}).then(res => {
|
||||
this.advert = res.data;
|
||||
if (res.status) {
|
||||
this.advert = res.data.childs;
|
||||
this.position = res.data.position;
|
||||
if (this.advert) {
|
||||
for (var i = 0; i < this.advert.length; i++) {
|
||||
this.advert[i].title = this.advert[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
clickSwiper(index) {
|
||||
console.log(index);
|
||||
this.showSliderInfo(this.advert[index].type, this.advert[index].val)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -69,7 +69,12 @@
|
||||
</view>
|
||||
</u-sticky>
|
||||
|
||||
<view class="coreshop-padding-10">
|
||||
<coreshop-advert code="TplIndexBanner1" showTitle="true"></coreshop-advert>
|
||||
</view>
|
||||
|
||||
<view class="wrapper">
|
||||
|
||||
<view class="list">
|
||||
<view class="category" v-for="(good, key) in goodsList" :key="key" :id="`cate-${good.id}`">
|
||||
<view class="items">
|
||||
|
||||
Reference in New Issue
Block a user