Browse Source

瀑布流添加广告判断

test
Enzo 4 years ago
parent
commit
c0a006041f
  1. 81
      components/lf-waterfall-my/lf-waterfall.vue
  2. 80
      components/lf-waterfall-recom/lf-waterfall.vue
  3. 80
      components/lf-waterfall/lf-waterfall.vue

81
components/lf-waterfall-my/lf-waterfall.vue

@ -2,35 +2,55 @@
<view>
<u-waterfall v-model="dataList" ref="uWaterfall">
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in leftList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in rightList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
@ -53,9 +73,10 @@
}
},
computed: {
dataList() {
return this.list
}
dataList: {
get() { return this.list; },
set(newValue) { console.log('newvalue',newValue) }
},
},
onShow(){
@ -65,10 +86,18 @@
},
methods: {
onClick(id){
console.log("aaaa");
this.$url('/pages/goodsDetail/index?goods_id='+id);
this.$emit('click');
},
goAd(type,url){
if(url) {
if(type == 0) {
this.$url(url);
}else {
this.$url('/pages/index/urlWeb?url='+url);
}
}
},
clear() {
this.$refs.uWaterfall.clear();
}

80
components/lf-waterfall-recom/lf-waterfall.vue

@ -2,35 +2,55 @@
<view>
<u-waterfall v-model="dataList" ref="uWaterfall">
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in leftList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in rightList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
@ -49,16 +69,11 @@
},
data(){
return {
}
},
computed: {
dataList: {
// let arr = [];
// if(this.list && this.list.length){
// arr = this.list;
// }
// return arr;
get() { return this.list; },
set(newValue) { console.log('newvalue',newValue) }
},
@ -74,6 +89,15 @@
this.$url('/pages/goodsDetail/index?goods_id='+id);
this.$emit('click');
},
goAd(type,url){
if(url) {
if(type == 0) {
this.$url(url);
}else {
this.$url('/pages/index/urlWeb?url='+url);
}
}
},
clear() {
this.$refs.uWaterfall.clear();
}

80
components/lf-waterfall/lf-waterfall.vue

@ -2,35 +2,55 @@
<view>
<u-waterfall v-model="dataList" ref="uWaterfall">
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in leftList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
<view class="list-warter" v-for="(item, index) in rightList" :key="index">
<view v-if="!item.is_ad" @click="onClick(item.id)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
<view v-else @click="goAd(item.type,item.url)">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
</view>
</view>
</view>
</view>
@ -53,9 +73,10 @@
}
},
computed: {
dataList() {
return this.list
}
dataList: {
get() { return this.list; },
set(newValue) { console.log('newvalue',newValue) }
},
},
onShow(){
@ -68,6 +89,15 @@
this.$url('/pages/goodsDetail/index?goods_id='+id);
this.$emit('click');
},
goAd(type,url){
if(url) {
if(type == 0) {
this.$url(url);
}else {
this.$url('/pages/index/urlWeb?url='+url);
}
}
},
clear() {
this.$refs.uWaterfall.clear();
}

Loading…
Cancel
Save