tianyi 3 weeks ago
parent
commit
9e02802b99
  1. 15
      pages/index/index.vue

15
pages/index/index.vue

@ -20,7 +20,7 @@
:interval="interval" :duration="duration"> :interval="interval" :duration="duration">
<swiper-item v-for="(item,index) in adList" :key="index" <swiper-item v-for="(item,index) in adList" :key="index"
@tap="goAdPage(item)"> @tap="goAdPage(item)">
<img class="hero-bg-img" :src="item.pic" alt="" /> <img class="hero-bg-img" :src="item.adImage" alt="" />
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="hero-bg-mask"></view> <view class="hero-bg-mask"></view>
@ -1123,17 +1123,12 @@
that.mallAds = res.result.mallAds that.mallAds = res.result.mallAds
for(let i=0;i<that.mallAds.length;i++){ for(let i=0;i<that.mallAds.length;i++){
if(that.mallAds[i].position == 'home_top'){ if(that.mallAds[i].position == 'home_top'){
that.adList.push(that.mallAds[i])
// //
if (that.mallAds[i].adImage.indexOf(',') !== -1) { if (that.mallAds[i].adImage.indexOf(',') !== -1) {
// {pic: url} if (that.mallAds[i].adImage.endsWith(',')) {
that.adList = that.mallAds[i].adImage.split(',').filter(item => item.trim() !== '').map(url => ({ that.mallAds[i].adImage = that.mallAds[i].adImage.slice(0, -1);
pic: url.trim() }
}));
} else {
//
that.adList = [{
pic: that.mallAds[i].adImage.trim()
}];
} }
}else{ }else{
if (that.mallAds[i].adImage.endsWith(',')) { if (that.mallAds[i].adImage.endsWith(',')) {

Loading…
Cancel
Save