17 changed files with 1704 additions and 1679 deletions
@ -1,207 +1,207 @@
|
||||
<template> |
||||
<view class="adv-box mx20 mb10"> |
||||
<!-- 模板1--> |
||||
<view class="x-f" v-if="detail.style == 1"> |
||||
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板2--> |
||||
<view class="type1 x-f" v-if="detail.style == 2"> |
||||
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板3--> |
||||
<view class="type2 x-bc" v-if="detail.style == 3"> |
||||
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<view class="y-f type2-box"> |
||||
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板4--> |
||||
<view class="type3 x-bc" v-if="detail.style == 4"> |
||||
<view class="type3-box y-f"> |
||||
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板5--> |
||||
<view class="type4 y-f" v-if="detail.style == 5"> |
||||
<view class="type4-box x-f"> |
||||
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板6--> |
||||
<view class="type5 y-f" v-if="detail.style == 6"> |
||||
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<view class="type5-box x-bc"> |
||||
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板7--> |
||||
<view class="type6 y-f" v-if="detail.style == 7"> |
||||
<view class="x-f type6-box1"> |
||||
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<view class="x-f type6-box2"> |
||||
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return {}; |
||||
}, |
||||
props: { |
||||
detail: {} |
||||
}, |
||||
computed: {}, |
||||
created() {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path) { |
||||
this.$tools.routerTo(path); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.adv-box { |
||||
background-color: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
.type1 { |
||||
.type1-img { |
||||
flex: 1; |
||||
height: 220rpx; |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type2 { |
||||
.type2-img1 { |
||||
width: (710rpx/2); |
||||
height: 340rpx; |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type2-box { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
|
||||
.type2-img2 { |
||||
height: (340rpx/2); |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3 { |
||||
.type3-box { |
||||
width: (710rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
.type3-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3-img2 { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
} |
||||
} |
||||
|
||||
.type4 { |
||||
.type4-box { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
.type4-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type4-img2 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
} |
||||
} |
||||
|
||||
.type5 { |
||||
.type5-img1 { |
||||
width: 710rpx; |
||||
height: (340rpx/2); |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type5-box { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
|
||||
.type5-img2 { |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6 { |
||||
.type6-box1 { |
||||
.type6-img1 { |
||||
width: (710rpx/2); |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6-box2 { |
||||
border-top: 1rpx solid #f6f6f6; |
||||
|
||||
.type6-img2 { |
||||
width: (710rpx/3); |
||||
height: (340rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
&:last-child { |
||||
border-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
image { |
||||
// background-color: #ccc; |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<view class="adv-box mx20 mb10"> |
||||
<!-- 模板1--> |
||||
<view class="x-f" v-if="detail.style == 1"> |
||||
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板2--> |
||||
<view class="type1 x-f" v-if="detail.style == 2"> |
||||
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板3--> |
||||
<view class="type2 x-bc" v-if="detail.style == 3"> |
||||
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<view class="y-f type2-box"> |
||||
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板4--> |
||||
<view class="type3 x-bc" v-if="detail.style == 4"> |
||||
<view class="type3-box y-f"> |
||||
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板5--> |
||||
<view class="type4 y-f" v-if="detail.style == 5"> |
||||
<view class="type4-box x-f"> |
||||
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板6--> |
||||
<view class="type5 y-f" v-if="detail.style == 6"> |
||||
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<view class="type5-box x-bc"> |
||||
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板7--> |
||||
<view class="type6 y-f" v-if="detail.style == 7"> |
||||
<view class="x-f type6-box1"> |
||||
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image> |
||||
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image> |
||||
</view> |
||||
<view class="x-f type6-box2"> |
||||
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return {}; |
||||
}, |
||||
props: { |
||||
detail: {} |
||||
}, |
||||
computed: {}, |
||||
created() {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path) { |
||||
this.$tools.routerTo(path); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.adv-box { |
||||
background-color: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
.type1 { |
||||
.type1-img { |
||||
flex: 1; |
||||
height: 220rpx; |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type2 { |
||||
.type2-img1 { |
||||
width: (710rpx/2); |
||||
height: 340rpx; |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type2-box { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
|
||||
.type2-img2 { |
||||
height: (340rpx/2); |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3 { |
||||
.type3-box { |
||||
width: (710rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
.type3-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3-img2 { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
} |
||||
} |
||||
|
||||
.type4 { |
||||
.type4-box { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
.type4-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type4-img2 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
} |
||||
} |
||||
|
||||
.type5 { |
||||
.type5-img1 { |
||||
width: 710rpx; |
||||
height: (340rpx/2); |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type5-box { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
|
||||
.type5-img2 { |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6 { |
||||
.type6-box1 { |
||||
.type6-img1 { |
||||
width: (710rpx/2); |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6-box2 { |
||||
border-top: 1rpx solid #f6f6f6; |
||||
|
||||
.type6-img2 { |
||||
width: (710rpx/3); |
||||
height: (340rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
&:last-child { |
||||
border-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
image { |
||||
// background-color: #ccc; |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,155 +1,155 @@
|
||||
<template> |
||||
<!-- 产品分类导航 --> |
||||
<view class="menu-category-box mb10" v-if="carousel" :style="list.length <= menu ? `height:200rpx` : `height:360rpx`"> |
||||
<swiper |
||||
class="menu-swiper-box" |
||||
:style="list.length <= menu ? `height:160rpx` : `height:320rpx`" |
||||
@change="onSwiper" |
||||
circular |
||||
:autoplay="false" |
||||
:interval="3000" |
||||
:duration="1000" |
||||
> |
||||
<swiper-item class="menu-swiper-item" v-for="(itemList, index) in carousel" :key="index" :style="list.length <= menu ? `height:200rpx` : `height:340rpx`"> |
||||
<view class="menu-tab-box"> |
||||
<view class="tab-list y-f" :style="{ width: 690 / menu + 'rpx' }" v-for="item in itemList" :key="item.name" @tap="routerTo(item)"> |
||||
<image class="tab-img Shop-selector-circular" :style="{ width: imgW + 'rpx', height: imgW + 'rpx' }" :src="item.pic"></image> |
||||
<text class="Shop-selector-rect">{{ item.name }}</text> |
||||
</view> |
||||
</view> |
||||
</swiper-item> |
||||
</swiper> |
||||
<view class="menu-category-dots" v-if="carousel.length > 1"> |
||||
<text :class="categoryCurrent === index ? 'category-dot-active' : 'category-dot'" v-for="(dot, index) in carousel.length" :key="index"></text> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
categoryCurrent: 0 //分类轮播下标 |
||||
}; |
||||
}, |
||||
props: { |
||||
list: { |
||||
type: Array, |
||||
default: [] |
||||
}, |
||||
menu: { |
||||
default: 4 |
||||
}, |
||||
imgW: { |
||||
type: Number, |
||||
default: 88 |
||||
} |
||||
}, |
||||
computed: { |
||||
carousel() { |
||||
if (this.list) { |
||||
let list = this.sortData(this.list, this.menu * 2); |
||||
return list; |
||||
} |
||||
} |
||||
}, |
||||
created() {}, |
||||
methods: { |
||||
// 数据分层 |
||||
sortData(oArr, length) { |
||||
let arr = []; |
||||
let minArr = []; |
||||
oArr.forEach(c => { |
||||
if (minArr.length === length) { |
||||
minArr = []; |
||||
} |
||||
if (minArr.length === 0) { |
||||
arr.push(minArr); |
||||
} |
||||
minArr.push(c); |
||||
}); |
||||
|
||||
return arr; |
||||
}, |
||||
// 轮播 |
||||
onSwiper(e) { |
||||
this.categoryCurrent = e.detail.current; |
||||
}, |
||||
// 路由跳转 |
||||
routerTo(item) { |
||||
this.$yrouter.push(item.uniapp_url); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
// 产品分类 |
||||
.y-f { |
||||
display: -webkit-box; |
||||
display: -webkit-flex; |
||||
display: flex; |
||||
-webkit-box-orient: vertical; |
||||
-webkit-box-direction: normal; |
||||
-webkit-flex-direction: column; |
||||
flex-direction: column; |
||||
-webkit-box-align: center; |
||||
-webkit-align-items: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
.menu-category-box { |
||||
padding: 30rpx 30rpx 0 30rpx; |
||||
background: #fff; |
||||
box-sizing: border-box; |
||||
} |
||||
.menu-category-box, |
||||
.menu-swiper-box { |
||||
position: relative; |
||||
background: #fff; |
||||
.menu-swiper-item { |
||||
background: #fff; |
||||
height: 100%; |
||||
width: 100%; |
||||
} |
||||
.menu-tab-box { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
.tab-list { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
padding-bottom: 30rpx; |
||||
|
||||
.tab-img { |
||||
border-radius: 25rpx; |
||||
margin-bottom: 10rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.menu-category-dots { |
||||
display: flex; |
||||
position: absolute; |
||||
left: 50%; |
||||
transform: translateX(-50%); |
||||
bottom: 20rpx; |
||||
|
||||
.category-dot { |
||||
width: 40rpx; |
||||
height: 3rpx; |
||||
background: #eeeeee; |
||||
margin-right: 10rpx; |
||||
} |
||||
|
||||
.category-dot-active { |
||||
width: 40rpx; |
||||
height: 3rpx; |
||||
background: #a8700d; |
||||
margin-right: 10rpx; |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<!-- 产品分类导航 --> |
||||
<view class="menu-category-box mb10" v-if="carousel" :style="list.length <= menu ? `height:200rpx` : `height:360rpx`"> |
||||
<swiper |
||||
class="menu-swiper-box" |
||||
:style="list.length <= menu ? `height:160rpx` : `height:320rpx`" |
||||
@change="onSwiper" |
||||
circular |
||||
:autoplay="false" |
||||
:interval="3000" |
||||
:duration="1000" |
||||
> |
||||
<swiper-item class="menu-swiper-item" v-for="(itemList, index) in carousel" :key="index" :style="list.length <= menu ? `height:200rpx` : `height:340rpx`"> |
||||
<view class="menu-tab-box"> |
||||
<view class="tab-list y-f" :style="{ width: 690 / menu + 'rpx' }" v-for="item in itemList" :key="item.name" @tap="routerTo(item)"> |
||||
<image class="tab-img Shop-selector-circular" :style="{ width: imgW + 'rpx', height: imgW + 'rpx' }" :src="item.pic"></image> |
||||
<text class="Shop-selector-rect">{{ item.name }}</text> |
||||
</view> |
||||
</view> |
||||
</swiper-item> |
||||
</swiper> |
||||
<view class="menu-category-dots" v-if="carousel.length > 1"> |
||||
<text :class="categoryCurrent === index ? 'category-dot-active' : 'category-dot'" v-for="(dot, index) in carousel.length" :key="index"></text> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
categoryCurrent: 0 //分类轮播下标 |
||||
}; |
||||
}, |
||||
props: { |
||||
list: { |
||||
type: Array, |
||||
default: [] |
||||
}, |
||||
menu: { |
||||
default: 4 |
||||
}, |
||||
imgW: { |
||||
type: Number, |
||||
default: 88 |
||||
} |
||||
}, |
||||
computed: { |
||||
carousel() { |
||||
if (this.list) { |
||||
let list = this.sortData(this.list, this.menu * 2); |
||||
return list; |
||||
} |
||||
} |
||||
}, |
||||
created() {}, |
||||
methods: { |
||||
// 数据分层 |
||||
sortData(oArr, length) { |
||||
let arr = []; |
||||
let minArr = []; |
||||
oArr.forEach(c => { |
||||
if (minArr.length === length) { |
||||
minArr = []; |
||||
} |
||||
if (minArr.length === 0) { |
||||
arr.push(minArr); |
||||
} |
||||
minArr.push(c); |
||||
}); |
||||
|
||||
return arr; |
||||
}, |
||||
// 轮播 |
||||
onSwiper(e) { |
||||
this.categoryCurrent = e.detail.current; |
||||
}, |
||||
// 路由跳转 |
||||
routerTo(item) { |
||||
this.$yrouter.push(item.uniapp_url); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
// 产品分类 |
||||
.y-f { |
||||
display: -webkit-box; |
||||
display: -webkit-flex; |
||||
display: flex; |
||||
-webkit-box-orient: vertical; |
||||
-webkit-box-direction: normal; |
||||
-webkit-flex-direction: column; |
||||
flex-direction: column; |
||||
-webkit-box-align: center; |
||||
-webkit-align-items: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
.menu-category-box { |
||||
padding: 30rpx 30rpx 0 30rpx; |
||||
background: #fff; |
||||
box-sizing: border-box; |
||||
} |
||||
.menu-category-box, |
||||
.menu-swiper-box { |
||||
position: relative; |
||||
background: #fff; |
||||
.menu-swiper-item { |
||||
background: #fff; |
||||
height: 100%; |
||||
width: 100%; |
||||
} |
||||
.menu-tab-box { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
.tab-list { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
padding-bottom: 30rpx; |
||||
|
||||
.tab-img { |
||||
border-radius: 25rpx; |
||||
margin-bottom: 10rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.menu-category-dots { |
||||
display: flex; |
||||
position: absolute; |
||||
left: 50%; |
||||
transform: translateX(-50%); |
||||
bottom: 20rpx; |
||||
|
||||
.category-dot { |
||||
width: 40rpx; |
||||
height: 3rpx; |
||||
background: #eeeeee; |
||||
margin-right: 10rpx; |
||||
} |
||||
|
||||
.category-dot-active { |
||||
width: 40rpx; |
||||
height: 3rpx; |
||||
background: #a8700d; |
||||
margin-right: 10rpx; |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,327 +1,327 @@
|
||||
<template> |
||||
<view class="sp-live-card" :style="{ width: wh + 'rpx' }"> |
||||
<view class="live-content" @tap="goRoom" :style="{ width: wh + 'rpx' }"> |
||||
<image class="item-cover" :src="detail.shareImge" mode="aspectFill"></image> |
||||
<view class="item-status"> |
||||
<image class="status-img" :src="liveStatus[detail.liveStatus].img" mode=""></image> |
||||
<text class="status-text">{{ liveStatus[detail.liveStatus].title }}</text> |
||||
</view> |
||||
<view class="item-title" :style="{ width: wh + 'rpx' }">{{ detail.name }}</view> |
||||
<!-- <image v-if="detail.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif" mode=""></image> --> |
||||
</view> |
||||
<view class="live-bottom" :style="{ width: wh + 'rpx' }"> |
||||
<view class="live-info"> |
||||
<view class="info-box"> |
||||
<!-- <image class="info-avatar" :src="detail.anchor_img" mode=""></image> --> |
||||
<view class="info-name">{{ detail.anchorName }}</view> |
||||
</view> |
||||
<!-- <text class="views">15W观看</text> --> |
||||
</view> |
||||
<slot name="liveGoods"> |
||||
<view class="live-goods" v-if="detail.product.length"> |
||||
<view class="live-goods__item" v-for="(goods, index) in detail.product" :key="goods.goodsId" |
||||
v-if="index < 3"> |
||||
<image class="live-goods__img" :src="goods.coverImgeUrl" mode=""></image> |
||||
<view class="live-goods__price" v-if="index < 2">¥{{ goods.price }}</view> |
||||
<view class="live-goods__mark" v-else> |
||||
<text>{{ detail.product.length }}+</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</slot> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
dataFormatL |
||||
} from "@/utils"; |
||||
let HAS_LIVE = false |
||||
// #ifdef MP-WEIXIN |
||||
HAS_LIVE = true |
||||
let livePlayer = null; |
||||
if (HAS_LIVE) { |
||||
livePlayer = requirePlugin('live-player-plugin'); |
||||
} |
||||
// #endif |
||||
let timer = null; |
||||
export default { |
||||
name: 'shopLiveCard', |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
liveStatus: { |
||||
'101': { |
||||
img: 'https://wx.yixiang.co/static/images/live.png', |
||||
title: '直播中' |
||||
}, |
||||
'102': { |
||||
img: 'https://wx.yixiang.co/static/images/prevue.png', |
||||
title: '未开始' |
||||
}, |
||||
'103': { |
||||
img: 'https://wx.yixiang.co/static/images/playback.png', |
||||
title: '已结束' |
||||
}, |
||||
'104': { |
||||
img: 'https://wx.yixiang.co/static/images/104.png', |
||||
title: '禁播' |
||||
}, |
||||
'105': { |
||||
img: 'https://wx.yixiang.co/static/images/105.png', |
||||
title: '暂停中' |
||||
}, |
||||
'106': { |
||||
img: 'https://wx.yixiang.co/static/images/106.png', |
||||
title: '异常' |
||||
}, |
||||
'107': { |
||||
img: 'https://wx.yixiang.co/static/images/past.png', |
||||
title: '已过期' |
||||
} |
||||
} |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: { |
||||
type: Object, |
||||
default: null |
||||
}, |
||||
wh: { |
||||
type: Number, |
||||
default: 345 |
||||
} |
||||
}, |
||||
|
||||
computed: {}, |
||||
created() { |
||||
this.getLiveStatus(); |
||||
}, |
||||
mounted() { |
||||
let that = this; |
||||
timer = setInterval(() => { |
||||
that.getLiveStatus(); |
||||
}, 60000); |
||||
}, |
||||
beforeDestroy() { |
||||
timer = null; |
||||
}, |
||||
methods: { |
||||
goRoom() { |
||||
let that = this; |
||||
wx.navigateTo({ |
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${that.detail.roomId}` |
||||
}); |
||||
}, |
||||
dateFormat(fmt, date) { |
||||
let ret; |
||||
const opt = { |
||||
"Y+": date.getFullYear().toString(), // 年 |
||||
"m+": (date.getMonth() + 1).toString(), // 月 |
||||
"d+": date.getDate().toString(), // 日 |
||||
"H+": date.getHours().toString(), // 时 |
||||
"M+": date.getMinutes().toString(), // 分 |
||||
"S+": date.getSeconds().toString() // 秒 |
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串 |
||||
}; |
||||
for (let k in opt) { |
||||
ret = new RegExp("(" + k + ")").exec(fmt); |
||||
if (ret) { |
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) |
||||
}; |
||||
}; |
||||
return fmt; |
||||
}, |
||||
// 轮询liveStatus |
||||
getLiveStatus() { |
||||
if (HAS_LIVE) { |
||||
let that = this; |
||||
let date = ''; |
||||
if (that.detail.liveStatus == 102) { |
||||
date = this.dateFormat('mm-dd HH:MM', new Date(that.detail.startTime * 1000)).replace('-','/'); |
||||
that.liveStatus['102'].title = '预告 ' + date; |
||||
} |
||||
// livePlayer |
||||
// .getLiveStatus({ |
||||
// room_id: that.detail.roomId |
||||
// }) |
||||
// .then(res => { |
||||
// // 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期 |
||||
// that.detail.liveStatus = res.liveStatus; |
||||
// }) |
||||
// .catch(err => { |
||||
// console.log('get live status', err); |
||||
// }); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.sp-live-card { |
||||
width: 344rpx; |
||||
box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22); |
||||
border-radius: 20rpx; |
||||
height: 100%; |
||||
overflow: auto; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
|
||||
.live-content { |
||||
position: relative; |
||||
width: 344rpx; |
||||
height: 344rpx; |
||||
overflow: hidden; |
||||
|
||||
.item-cover { |
||||
background-color: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
border-radius: 20rpx 20rpx 0 0; |
||||
} |
||||
|
||||
.item-status { |
||||
position: absolute; |
||||
top: 20rpx; |
||||
left: 10rpx; |
||||
height: 40rpx; |
||||
background: rgba(0, 0, 0, 0.4); |
||||
border-radius: 20rpx; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
.status-img { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
} |
||||
|
||||
.status-text { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
padding: 0 10rpx; |
||||
} |
||||
} |
||||
|
||||
.item-title { |
||||
width: 345rpx; |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 60rpx; |
||||
padding: 0 20rpx; |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
padding-right: 60rpx; |
||||
} |
||||
|
||||
.like-img { |
||||
position: absolute; |
||||
bottom: 20rpx; |
||||
right: 10rpx; |
||||
width: 60rpx; |
||||
height: 130rpx; |
||||
} |
||||
} |
||||
|
||||
.live-bottom { |
||||
background-color: #fff; |
||||
padding: 20rpx; |
||||
width: 345rpx; |
||||
|
||||
.live-info { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
width: 100%; |
||||
|
||||
.info-box { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
|
||||
.info-avatar { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
background: #eee; |
||||
} |
||||
|
||||
.info-name { |
||||
width: 150rpx; |
||||
font-size: 24rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
|
||||
.views { |
||||
font-size: 20rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 400; |
||||
color: rgba(153, 153, 153, 1); |
||||
} |
||||
} |
||||
|
||||
.live-goods { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-top: 20rpx; |
||||
|
||||
&__item { |
||||
position: relative; |
||||
width: 96rpx; |
||||
height: 96rpx; |
||||
border: 1rpx solid rgba(238, 238, 238, 1); |
||||
border-radius: 10rpx; |
||||
overflow: hidden; |
||||
margin-right: 8rpx; |
||||
|
||||
&:nth-child(3n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
|
||||
&__img { |
||||
background: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
|
||||
&__price { |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 40rpx; |
||||
width: 100%; |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
font-size: 20rpx; |
||||
color: #fff; |
||||
} |
||||
|
||||
&__mark { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 100%; |
||||
top: 0; |
||||
left: 0; |
||||
margin: auto; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
background: rgba(#000, 0.3); |
||||
font-size: 24rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<view class="sp-live-card" :style="{ width: wh + 'rpx' }"> |
||||
<view class="live-content" @tap="goRoom" :style="{ width: wh + 'rpx' }"> |
||||
<image class="item-cover" :src="detail.shareImge" mode="aspectFill"></image> |
||||
<view class="item-status"> |
||||
<image class="status-img" :src="liveStatus[detail.liveStatus].img" mode=""></image> |
||||
<text class="status-text">{{ liveStatus[detail.liveStatus].title }}</text> |
||||
</view> |
||||
<view class="item-title" :style="{ width: wh + 'rpx' }">{{ detail.name }}</view> |
||||
<!-- <image v-if="detail.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif" mode=""></image> --> |
||||
</view> |
||||
<view class="live-bottom" :style="{ width: wh + 'rpx' }"> |
||||
<view class="live-info"> |
||||
<view class="info-box"> |
||||
<!-- <image class="info-avatar" :src="detail.anchor_img" mode=""></image> --> |
||||
<view class="info-name">{{ detail.anchorName }}</view> |
||||
</view> |
||||
<!-- <text class="views">15W观看</text> --> |
||||
</view> |
||||
<slot name="liveGoods"> |
||||
<view class="live-goods" v-if="detail.product.length"> |
||||
<view class="live-goods__item" v-for="(goods, index) in detail.product" :key="goods.goodsId" |
||||
v-if="index < 3"> |
||||
<image class="live-goods__img" :src="goods.coverImgeUrl" mode=""></image> |
||||
<view class="live-goods__price" v-if="index < 2">¥{{ goods.price }}</view> |
||||
<view class="live-goods__mark" v-else> |
||||
<text>{{ detail.product.length }}+</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</slot> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
dataFormatL |
||||
} from "@/utils"; |
||||
let HAS_LIVE = false |
||||
// #ifdef MP-WEIXIN |
||||
HAS_LIVE = true |
||||
let livePlayer = null; |
||||
if (HAS_LIVE) { |
||||
livePlayer = requirePlugin('live-player-plugin'); |
||||
} |
||||
// #endif |
||||
let timer = null; |
||||
export default { |
||||
name: 'shopLiveCard', |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
liveStatus: { |
||||
'101': { |
||||
img: 'https://wx.yixiang.co/static/images/live.png', |
||||
title: '直播中' |
||||
}, |
||||
'102': { |
||||
img: 'https://wx.yixiang.co/static/images/prevue.png', |
||||
title: '未开始' |
||||
}, |
||||
'103': { |
||||
img: 'https://wx.yixiang.co/static/images/playback.png', |
||||
title: '已结束' |
||||
}, |
||||
'104': { |
||||
img: 'https://wx.yixiang.co/static/images/104.png', |
||||
title: '禁播' |
||||
}, |
||||
'105': { |
||||
img: 'https://wx.yixiang.co/static/images/105.png', |
||||
title: '暂停中' |
||||
}, |
||||
'106': { |
||||
img: 'https://wx.yixiang.co/static/images/106.png', |
||||
title: '异常' |
||||
}, |
||||
'107': { |
||||
img: 'https://wx.yixiang.co/static/images/past.png', |
||||
title: '已过期' |
||||
} |
||||
} |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: { |
||||
type: Object, |
||||
default: null |
||||
}, |
||||
wh: { |
||||
type: Number, |
||||
default: 345 |
||||
} |
||||
}, |
||||
|
||||
computed: {}, |
||||
created() { |
||||
this.getLiveStatus(); |
||||
}, |
||||
mounted() { |
||||
let that = this; |
||||
timer = setInterval(() => { |
||||
that.getLiveStatus(); |
||||
}, 60000); |
||||
}, |
||||
beforeDestroy() { |
||||
timer = null; |
||||
}, |
||||
methods: { |
||||
goRoom() { |
||||
let that = this; |
||||
wx.navigateTo({ |
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${that.detail.roomId}` |
||||
}); |
||||
}, |
||||
dateFormat(fmt, date) { |
||||
let ret; |
||||
const opt = { |
||||
"Y+": date.getFullYear().toString(), // 年 |
||||
"m+": (date.getMonth() + 1).toString(), // 月 |
||||
"d+": date.getDate().toString(), // 日 |
||||
"H+": date.getHours().toString(), // 时 |
||||
"M+": date.getMinutes().toString(), // 分 |
||||
"S+": date.getSeconds().toString() // 秒 |
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串 |
||||
}; |
||||
for (let k in opt) { |
||||
ret = new RegExp("(" + k + ")").exec(fmt); |
||||
if (ret) { |
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) |
||||
}; |
||||
}; |
||||
return fmt; |
||||
}, |
||||
// 轮询liveStatus |
||||
getLiveStatus() { |
||||
if (HAS_LIVE) { |
||||
let that = this; |
||||
let date = ''; |
||||
if (that.detail.liveStatus == 102) { |
||||
date = this.dateFormat('mm-dd HH:MM', new Date(that.detail.startTime * 1000)).replace('-','/'); |
||||
that.liveStatus['102'].title = '预告 ' + date; |
||||
} |
||||
// livePlayer |
||||
// .getLiveStatus({ |
||||
// room_id: that.detail.roomId |
||||
// }) |
||||
// .then(res => { |
||||
// // 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期 |
||||
// that.detail.liveStatus = res.liveStatus; |
||||
// }) |
||||
// .catch(err => { |
||||
// console.log('get live status', err); |
||||
// }); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.sp-live-card { |
||||
width: 344rpx; |
||||
box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22); |
||||
border-radius: 20rpx; |
||||
height: 100%; |
||||
overflow: auto; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
|
||||
.live-content { |
||||
position: relative; |
||||
width: 344rpx; |
||||
height: 344rpx; |
||||
overflow: hidden; |
||||
|
||||
.item-cover { |
||||
background-color: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
border-radius: 20rpx 20rpx 0 0; |
||||
} |
||||
|
||||
.item-status { |
||||
position: absolute; |
||||
top: 20rpx; |
||||
left: 10rpx; |
||||
height: 40rpx; |
||||
background: rgba(0, 0, 0, 0.4); |
||||
border-radius: 20rpx; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
.status-img { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
} |
||||
|
||||
.status-text { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
padding: 0 10rpx; |
||||
} |
||||
} |
||||
|
||||
.item-title { |
||||
width: 345rpx; |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 60rpx; |
||||
padding: 0 20rpx; |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
padding-right: 60rpx; |
||||
} |
||||
|
||||
.like-img { |
||||
position: absolute; |
||||
bottom: 20rpx; |
||||
right: 10rpx; |
||||
width: 60rpx; |
||||
height: 130rpx; |
||||
} |
||||
} |
||||
|
||||
.live-bottom { |
||||
background-color: #fff; |
||||
padding: 20rpx; |
||||
width: 345rpx; |
||||
|
||||
.live-info { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
width: 100%; |
||||
|
||||
.info-box { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
|
||||
.info-avatar { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
background: #eee; |
||||
} |
||||
|
||||
.info-name { |
||||
width: 150rpx; |
||||
font-size: 24rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
|
||||
.views { |
||||
font-size: 20rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 400; |
||||
color: rgba(153, 153, 153, 1); |
||||
} |
||||
} |
||||
|
||||
.live-goods { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-top: 20rpx; |
||||
|
||||
&__item { |
||||
position: relative; |
||||
width: 96rpx; |
||||
height: 96rpx; |
||||
border: 1rpx solid rgba(238, 238, 238, 1); |
||||
border-radius: 10rpx; |
||||
overflow: hidden; |
||||
margin-right: 8rpx; |
||||
|
||||
&:nth-child(3n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
|
||||
&__img { |
||||
background: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
|
||||
&__price { |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 40rpx; |
||||
width: 100%; |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
font-size: 20rpx; |
||||
color: #fff; |
||||
} |
||||
|
||||
&__mark { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 100%; |
||||
top: 0; |
||||
left: 0; |
||||
margin: auto; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
background: rgba(#000, 0.3); |
||||
font-size: 24rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,40 +1,40 @@
|
||||
<template> |
||||
<view class="min-goods" @tap="jump('/pages/activity/GroupDetails/index', { id: detail.id })"> |
||||
<view class="img-box"> |
||||
<view class="tag" >{{ detail.people}}人团</view> |
||||
<image class="img" :src="detail.image" mode="widthFix"></image> |
||||
</view> |
||||
<view class="price-box"> |
||||
<view class="y-f"> |
||||
<text class="seckill-current">¥{{ detail.price }}</text> |
||||
<text class="original">销量{{ detail.sales }}{{detail.unitName}}</text> |
||||
</view> |
||||
</view> |
||||
<view class="title"><slot name="titleText"></slot></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return {}; |
||||
}, |
||||
props: { |
||||
detail: Object |
||||
}, |
||||
computed: {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path, query) { |
||||
this.$yrouter.push({ |
||||
path, |
||||
query |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
</style> |
||||
<template> |
||||
<view class="min-goods" @tap="jump('/pages/activity/GroupDetails/index', { id: detail.id })"> |
||||
<view class="img-box"> |
||||
<view class="tag" >{{ detail.people}}人团</view> |
||||
<image class="img" :src="detail.image" mode="widthFix"></image> |
||||
</view> |
||||
<view class="price-box"> |
||||
<view class="y-f"> |
||||
<text class="seckill-current">¥{{ detail.price }}</text> |
||||
<text class="original">销量{{ detail.sales }}{{detail.unitName}}</text> |
||||
</view> |
||||
</view> |
||||
<view class="title"><slot name="titleText"></slot></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return {}; |
||||
}, |
||||
props: { |
||||
detail: Object |
||||
}, |
||||
computed: {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path, query) { |
||||
this.$yrouter.push({ |
||||
path, |
||||
query |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
</style> |
||||
|
@ -1,256 +1,256 @@
|
||||
<template> |
||||
<view class="adv-box mx20 mb10"> |
||||
<!-- 模板1--> |
||||
<view class="x-f" v-if="detail.style == 1"> |
||||
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板2--> |
||||
<view class="type1 x-f" v-if="detail.style == 2"> |
||||
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板3--> |
||||
<view class="type2 x-bc" v-if="detail.style == 3"> |
||||
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<view class="y-f type2-box"> |
||||
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" |
||||
style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板4--> |
||||
<view class="type3 x-bc" v-if="detail.style == 4"> |
||||
<view class="type3-box y-f"> |
||||
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板5--> |
||||
<view class="type4 y-f" v-if="detail.style == 5"> |
||||
<view class="type4-box x-f"> |
||||
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板6--> |
||||
<view class="type5 y-f" v-if="detail.style == 6"> |
||||
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<view class="type5-box x-bc"> |
||||
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" |
||||
style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板7--> |
||||
<view class="type6 y-f" v-if="detail.style == 7"> |
||||
<view class="x-f type6-box1"> |
||||
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<view class="x-f type6-box2"> |
||||
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
detail: { |
||||
"list": [{ |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index001.png", |
||||
"name": "", |
||||
"path": "/pages/user/coupon/GetCoupon/index", |
||||
"path_name": "优惠券", |
||||
"path_type": 1 |
||||
}, { |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index002.png", |
||||
"name": "", |
||||
"path": "/pages/shop/GoodsList/index", |
||||
"path_name": "商品", |
||||
"path_type": 1 |
||||
}, { |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index003.png", |
||||
"name": "", |
||||
"path": "/pages/user/signIn/Integral/index", |
||||
"path_name": "积分", |
||||
"path_type": 1 |
||||
}], |
||||
"name": "", |
||||
"style": 3 |
||||
} |
||||
}; |
||||
}, |
||||
props: {}, |
||||
computed: {}, |
||||
created() {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path) { |
||||
this.$yrouter.push({ |
||||
path |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.adv-box { |
||||
background-color: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
image{ |
||||
width: 100%; |
||||
} |
||||
.type1 { |
||||
.type1-img { |
||||
flex: 1; |
||||
height: 220rpx; |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type2 { |
||||
.type2-img1 { |
||||
width: (710rpx/2); |
||||
height: 340rpx; |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type2-box { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
|
||||
.type2-img2 { |
||||
height: (340rpx/2); |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3 { |
||||
.type3-box { |
||||
width: (710rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
.type3-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3-img2 { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
} |
||||
} |
||||
|
||||
.type4 { |
||||
.type4-box { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
|
||||
.type4-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type4-img2 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
} |
||||
} |
||||
|
||||
.type5 { |
||||
.type5-img1 { |
||||
width: 710rpx; |
||||
height: (340rpx/2); |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type5-box { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
|
||||
.type5-img2 { |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6 { |
||||
.type6-box1 { |
||||
.type6-img1 { |
||||
width: (710rpx/2); |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6-box2 { |
||||
border-top: 1rpx solid #f6f6f6; |
||||
|
||||
.type6-img2 { |
||||
width: (710rpx/3); |
||||
height: (340rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
&:last-child { |
||||
border-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
image { |
||||
// background-color: #ccc; |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<view class="adv-box mx20 mb10"> |
||||
<!-- 模板1--> |
||||
<view class="x-f" v-if="detail.style == 1"> |
||||
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<!-- 模板2--> |
||||
<view class="type1 x-f" v-if="detail.style == 2"> |
||||
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板3--> |
||||
<view class="type2 x-bc" v-if="detail.style == 3"> |
||||
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<view class="y-f type2-box"> |
||||
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" |
||||
style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板4--> |
||||
<view class="type3 x-bc" v-if="detail.style == 4"> |
||||
<view class="type3-box y-f"> |
||||
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板5--> |
||||
<view class="type4 y-f" v-if="detail.style == 5"> |
||||
<view class="type4-box x-f"> |
||||
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"> |
||||
</image> |
||||
</view> |
||||
<!-- 模板6--> |
||||
<view class="type5 y-f" v-if="detail.style == 6"> |
||||
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"> |
||||
</image> |
||||
<view class="type5-box x-bc"> |
||||
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" |
||||
style="border-bottom:1rpx solid #f6f6f6"></image> |
||||
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
<!-- 模板7--> |
||||
<view class="type6 y-f" v-if="detail.style == 7"> |
||||
<view class="x-f type6-box1"> |
||||
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
<view class="x-f type6-box2"> |
||||
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" |
||||
mode="aspectFill"></image> |
||||
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" |
||||
mode="aspectFill"></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
detail: { |
||||
"list": [{ |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index001.png", |
||||
"name": "", |
||||
"path": "/pages/user/coupon/GetCoupon/index", |
||||
"path_name": "优惠券", |
||||
"path_type": 1 |
||||
}, { |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index002.png", |
||||
"name": "", |
||||
"path": "/pages/shop/GoodsList/index", |
||||
"path_name": "商品", |
||||
"path_type": 1 |
||||
}, { |
||||
"image": "https:\/\/wx.yixiang.co\/static\/images\/index003.png", |
||||
"name": "", |
||||
"path": "/pages/user/signIn/Integral/index", |
||||
"path_name": "积分", |
||||
"path_type": 1 |
||||
}], |
||||
"name": "", |
||||
"style": 3 |
||||
} |
||||
}; |
||||
}, |
||||
props: {}, |
||||
computed: {}, |
||||
created() {}, |
||||
methods: { |
||||
// 路由跳转 |
||||
jump(path) { |
||||
this.$yrouter.push({ |
||||
path |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.adv-box { |
||||
background-color: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
image{ |
||||
width: 100%; |
||||
} |
||||
.type1 { |
||||
.type1-img { |
||||
flex: 1; |
||||
height: 220rpx; |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type2 { |
||||
.type2-img1 { |
||||
width: (710rpx/2); |
||||
height: 340rpx; |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type2-box { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
|
||||
.type2-img2 { |
||||
height: (340rpx/2); |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3 { |
||||
.type3-box { |
||||
width: (710rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
.type3-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type3-img2 { |
||||
flex: 1; |
||||
height: 340rpx; |
||||
width: (710rpx/2); |
||||
} |
||||
} |
||||
|
||||
.type4 { |
||||
.type4-box { |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
|
||||
.type4-img1 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type4-img2 { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
} |
||||
} |
||||
|
||||
.type5 { |
||||
.type5-img1 { |
||||
width: 710rpx; |
||||
height: (340rpx/2); |
||||
border-bottom: 1rpx solid #f6f6f6; |
||||
} |
||||
|
||||
.type5-box { |
||||
flex: 1; |
||||
height: (340rpx/2); |
||||
width: 710rpx; |
||||
|
||||
.type5-img2 { |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6 { |
||||
.type6-box1 { |
||||
.type6-img1 { |
||||
width: (710rpx/2); |
||||
height: (340rpx/2); |
||||
|
||||
&:first-child { |
||||
border-right: 1rpx solid #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.type6-box2 { |
||||
border-top: 1rpx solid #f6f6f6; |
||||
|
||||
.type6-img2 { |
||||
width: (710rpx/3); |
||||
height: (340rpx/2); |
||||
border-right: 1rpx solid #f6f6f6; |
||||
|
||||
&:last-child { |
||||
border-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
image { |
||||
// background-color: #ccc; |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,197 +1,197 @@
|
||||
<template> |
||||
<!-- 今日必拼 --> |
||||
<view class="group-goods pa20 mx20 mb10"> |
||||
<view class="title-box x-bc" @tap="jump('/pages/activity/GoodsGroup/index')"> |
||||
<text class="title">超值拼团</text> |
||||
<view class="group-people x-f"> |
||||
<text class="tip">更多</text> |
||||
<text class="cuIcon-right"></text> |
||||
</view> |
||||
</view> |
||||
<view class="goods-box swiper-box x-f"> |
||||
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000"> |
||||
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item"> |
||||
<view class="goods-list-box x-f"> |
||||
<block v-for="mgoods in goods" :key="mgoods.id"> |
||||
<sh-activity-goods :detail="mgoods" class="goods-item"> |
||||
<!-- <block slot="titleText">立减¥8.5</block> --> |
||||
</sh-activity-goods> |
||||
</block> |
||||
</view> |
||||
</swiper-item> |
||||
</swiper> |
||||
<view class="swiper-dots" v-if="goodsList.length > 1"> |
||||
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length" |
||||
:key="index"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import shActivityGoods from './sh-activity-goods.vue'; |
||||
export default { |
||||
name: 'shGroupon', |
||||
components: { |
||||
shActivityGoods |
||||
}, |
||||
data() { |
||||
return { |
||||
goodsList: [], |
||||
swiperCurrent: 0 |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: Array |
||||
}, |
||||
computed: {}, |
||||
created() {}, |
||||
watch: { |
||||
detail(next) { |
||||
this.goodsList = this.sortData(next, 4); |
||||
} |
||||
}, |
||||
methods: { |
||||
swiperChange(e) { |
||||
this.swiperCurrent = e.detail.current; |
||||
}, |
||||
// 数据分层 |
||||
sortData(oArr, length) { |
||||
let arr = []; |
||||
let minArr = []; |
||||
oArr.forEach(c => { |
||||
if (minArr.length === length) { |
||||
minArr = []; |
||||
} |
||||
if (minArr.length === 0) { |
||||
arr.push(minArr); |
||||
} |
||||
minArr.push(c); |
||||
}); |
||||
|
||||
return arr; |
||||
}, |
||||
jump(path, query) { |
||||
this.$yrouter.push({ |
||||
path, |
||||
query, |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.swiper-box, |
||||
.carousel { |
||||
width: 700rpx; |
||||
height: 240upx; |
||||
position: relative; |
||||
border-radius: 20rpx; |
||||
|
||||
.carousel-item { |
||||
width: 100%; |
||||
height: 100%; |
||||
// padding: 0 28upx; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.swiper-image { |
||||
width: 100%; |
||||
height: 100%; |
||||
// border-radius: 10upx; |
||||
background: #ccc; |
||||
} |
||||
} |
||||
|
||||
.swiper-dots { |
||||
display: flex; |
||||
position: absolute; |
||||
left: 50%; |
||||
transform: translateX(-50%); |
||||
bottom: 0rpx; |
||||
z-index: 66; |
||||
|
||||
.dot { |
||||
width: 45rpx; |
||||
height: 3rpx; |
||||
background: #eee; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
} |
||||
|
||||
.dot-active { |
||||
width: 45rpx; |
||||
height: 3rpx; |
||||
background: #a8700d; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
} |
||||
} |
||||
|
||||
// 今日必拼+限时抢购 |
||||
.group-goods { |
||||
background: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
|
||||
.title-box { |
||||
padding-bottom: 20rpx; |
||||
|
||||
.title { |
||||
font-size: 32rpx; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.group-people { |
||||
.time-box { |
||||
font-size: 26rpx; |
||||
color: #edbf62; |
||||
|
||||
.count-text-box { |
||||
width: 30rpx; |
||||
height: 34rpx; |
||||
background: #edbf62; |
||||
text-align: center; |
||||
line-height: 34rpx; |
||||
font-size: 24rpx; |
||||
border-radius: 6rpx; |
||||
color: rgba(#fff, 0.9); |
||||
margin: 0 8rpx; |
||||
} |
||||
} |
||||
|
||||
.head-box { |
||||
.head-img { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 50%; |
||||
background: #ccc; |
||||
} |
||||
} |
||||
|
||||
.tip { |
||||
font-size: 28rpx; |
||||
padding-left: 30rpx; |
||||
color: #666; |
||||
} |
||||
|
||||
.cuIcon-right { |
||||
font-size: 30rpx; |
||||
line-height: 28rpx; |
||||
color: #666; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.goods-box { |
||||
.goods-item { |
||||
margin-right: 22rpx; |
||||
|
||||
&:nth-child(4n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<!-- 今日必拼 --> |
||||
<view class="group-goods pa20 mx20 mb10"> |
||||
<view class="title-box x-bc" @tap="jump('/pages/activity/GoodsGroup/index')"> |
||||
<text class="title">超值拼团</text> |
||||
<view class="group-people x-f"> |
||||
<text class="tip">更多</text> |
||||
<text class="cuIcon-right"></text> |
||||
</view> |
||||
</view> |
||||
<view class="goods-box swiper-box x-f"> |
||||
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000"> |
||||
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item"> |
||||
<view class="goods-list-box x-f"> |
||||
<block v-for="mgoods in goods" :key="mgoods.id"> |
||||
<sh-activity-goods :detail="mgoods" class="goods-item"> |
||||
<!-- <block slot="titleText">立减¥8.5</block> --> |
||||
</sh-activity-goods> |
||||
</block> |
||||
</view> |
||||
</swiper-item> |
||||
</swiper> |
||||
<view class="swiper-dots" v-if="goodsList.length > 1"> |
||||
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length" |
||||
:key="index"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import shActivityGoods from './sh-activity-goods.vue'; |
||||
export default { |
||||
name: 'shGroupon', |
||||
components: { |
||||
shActivityGoods |
||||
}, |
||||
data() { |
||||
return { |
||||
goodsList: [], |
||||
swiperCurrent: 0 |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: Array |
||||
}, |
||||
computed: {}, |
||||
created() {}, |
||||
watch: { |
||||
detail(next) { |
||||
this.goodsList = this.sortData(next, 4); |
||||
} |
||||
}, |
||||
methods: { |
||||
swiperChange(e) { |
||||
this.swiperCurrent = e.detail.current; |
||||
}, |
||||
// 数据分层 |
||||
sortData(oArr, length) { |
||||
let arr = []; |
||||
let minArr = []; |
||||
oArr.forEach(c => { |
||||
if (minArr.length === length) { |
||||
minArr = []; |
||||
} |
||||
if (minArr.length === 0) { |
||||
arr.push(minArr); |
||||
} |
||||
minArr.push(c); |
||||
}); |
||||
|
||||
return arr; |
||||
}, |
||||
jump(path, query) { |
||||
this.$yrouter.push({ |
||||
path, |
||||
query, |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.swiper-box, |
||||
.carousel { |
||||
width: 700rpx; |
||||
height: 240upx; |
||||
position: relative; |
||||
border-radius: 20rpx; |
||||
|
||||
.carousel-item { |
||||
width: 100%; |
||||
height: 100%; |
||||
// padding: 0 28upx; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.swiper-image { |
||||
width: 100%; |
||||
height: 100%; |
||||
// border-radius: 10upx; |
||||
background: #ccc; |
||||
} |
||||
} |
||||
|
||||
.swiper-dots { |
||||
display: flex; |
||||
position: absolute; |
||||
left: 50%; |
||||
transform: translateX(-50%); |
||||
bottom: 0rpx; |
||||
z-index: 66; |
||||
|
||||
.dot { |
||||
width: 45rpx; |
||||
height: 3rpx; |
||||
background: #eee; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
} |
||||
|
||||
.dot-active { |
||||
width: 45rpx; |
||||
height: 3rpx; |
||||
background: #a8700d; |
||||
border-radius: 50%; |
||||
margin-right: 10rpx; |
||||
} |
||||
} |
||||
|
||||
// 今日必拼+限时抢购 |
||||
.group-goods { |
||||
background: #fff; |
||||
border-radius: 20rpx; |
||||
overflow: hidden; |
||||
|
||||
.title-box { |
||||
padding-bottom: 20rpx; |
||||
|
||||
.title { |
||||
font-size: 32rpx; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.group-people { |
||||
.time-box { |
||||
font-size: 26rpx; |
||||
color: #edbf62; |
||||
|
||||
.count-text-box { |
||||
width: 30rpx; |
||||
height: 34rpx; |
||||
background: #edbf62; |
||||
text-align: center; |
||||
line-height: 34rpx; |
||||
font-size: 24rpx; |
||||
border-radius: 6rpx; |
||||
color: rgba(#fff, 0.9); |
||||
margin: 0 8rpx; |
||||
} |
||||
} |
||||
|
||||
.head-box { |
||||
.head-img { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
border-radius: 50%; |
||||
background: #ccc; |
||||
} |
||||
} |
||||
|
||||
.tip { |
||||
font-size: 28rpx; |
||||
padding-left: 30rpx; |
||||
color: #666; |
||||
} |
||||
|
||||
.cuIcon-right { |
||||
font-size: 30rpx; |
||||
line-height: 28rpx; |
||||
color: #666; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.goods-box { |
||||
.goods-item { |
||||
margin-right: 22rpx; |
||||
|
||||
&:nth-child(4n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,249 +1,248 @@
|
||||
<template> |
||||
<view class="live-el mx20 mb10"> |
||||
<view class="head"> |
||||
<text class="head-title">热门直播</text> |
||||
<view class="head-more" @tap="$yrouter.push('/pages/shop/Live/LiveList/index')"> |
||||
<text>更多</text> |
||||
<text class="cuIcon-right"></text> |
||||
</view> |
||||
</view> |
||||
<view class="content-one"> |
||||
<view class="content-one__item" v-for="live in detail" :key="live.roomId" @tap="goRoom(live)"> |
||||
<image class="item-cover" :src="live.shareImge" mode="widthFix"></image> |
||||
<view class="item-status"> |
||||
<image class="status-img" :src="liveStatus[live.liveStatus].img" mode=""></image> |
||||
<text class="status-text">{{ liveStatus[live.liveStatus].title }}</text> |
||||
</view> |
||||
<view class="item-title">{{ live.name }}</view> |
||||
<image v-if="live.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif" |
||||
mode=""></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import ShopLiveCard from '@/components/ShopLiveCard.vue' |
||||
|
||||
let HAS_LIVE = false |
||||
// #ifdef MP-WEIXIN |
||||
HAS_LIVE = true |
||||
let livePlayer = null; |
||||
if (HAS_LIVE) { |
||||
livePlayer = requirePlugin('live-player-plugin'); |
||||
} |
||||
// #endif |
||||
import { |
||||
yxWechatLive, |
||||
getLiveReplay |
||||
} from '@/api/live'; |
||||
|
||||
let timer = null; |
||||
export default { |
||||
components: { |
||||
ShopLiveCard |
||||
}, |
||||
data() { |
||||
return { |
||||
liveList: [], |
||||
liveStatus: { |
||||
'101': { |
||||
img: 'https://wx.yixiang.co/static/images/live.png', |
||||
title: '直播中' |
||||
}, |
||||
'102': { |
||||
img: 'https://wx.yixiang.co/static/images/prevue.png', |
||||
title: '未开始' |
||||
}, |
||||
'103': { |
||||
img: 'https://wx.yixiang.co/static/images/playback.png', |
||||
title: '已结束' |
||||
}, |
||||
'104': { |
||||
img: 'https://wx.yixiang.co/static/images/104.png', |
||||
title: '禁播' |
||||
}, |
||||
'105': { |
||||
img: 'https://wx.yixiang.co/static/images/105.png', |
||||
title: '暂停中' |
||||
}, |
||||
'106': { |
||||
img: 'https://wx.yixiang.co/static/images/106.png', |
||||
title: '异常' |
||||
}, |
||||
'107': { |
||||
img: 'https://wx.yixiang.co/static/images/past.png', |
||||
title: '已过期' |
||||
} |
||||
} |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: Array |
||||
}, |
||||
created() { |
||||
}, |
||||
mounted() { |
||||
let that = this; |
||||
timer = setInterval(() => { |
||||
that.getLiveStatus(); |
||||
}, 60000); |
||||
}, |
||||
beforeDestroy() { |
||||
timer = null; |
||||
}, |
||||
computed: {}, |
||||
methods: { |
||||
// 直播列表 |
||||
getLiveList() { |
||||
// let that = this; |
||||
// yxWechatLive({ |
||||
// page: 1, |
||||
// size: 10, |
||||
// }).then(res => { |
||||
// console.log(res) |
||||
// }) |
||||
}, |
||||
// 轮询liveStatus |
||||
getLiveStatus() { |
||||
// if (HAS_LIVE) { |
||||
// let that = this; |
||||
// let date = ''; |
||||
// if (that.detail.liveStatus == 102) { |
||||
// date = that.$tools.dateFormat('mm-dd HH:MM', new Date(that.detail.starttime * 1000)).replace('-', |
||||
// '/'); |
||||
// that.liveStatus['102'].title = '预告 ' + date; |
||||
// } |
||||
// livePlayer |
||||
// .getLiveStatus({ |
||||
// room_id: that.detail.roomId |
||||
// }) |
||||
// .then(res => { |
||||
// // 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期 |
||||
// that.detail.liveStatus = res.liveStatus; |
||||
// }) |
||||
// .catch(err => { |
||||
// console.log('get live status', err); |
||||
// }); |
||||
// } |
||||
}, |
||||
goRoom(live) { |
||||
console.log(live.roomId,9999) |
||||
wx.navigateTo({ |
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${live.roomId}` |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.live-el { |
||||
background: #fff; |
||||
border-radius: 20rpx; |
||||
padding: 30rpx 20rpx 25rpx; |
||||
|
||||
.head { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
|
||||
&-title { |
||||
font-size: 32rpx; |
||||
font-weight: bold; |
||||
font-family: PingFang SC; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
|
||||
&-more { |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
} |
||||
|
||||
// 单个大图直播 |
||||
.content-one { |
||||
.content-one__item { |
||||
position: relative; |
||||
height: 280rpx; |
||||
border-radius: 20rpx; |
||||
margin-top: 25rpx; |
||||
overflow: hidden; |
||||
|
||||
.item-cover { |
||||
background-color: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
|
||||
.item-status { |
||||
position: absolute; |
||||
top: 20rpx; |
||||
left: 10rpx; |
||||
height: 40rpx; |
||||
background: rgba(0, 0, 0, 0.4); |
||||
border-radius: 20rpx; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
.status-img { |
||||
width: 38rpx; |
||||
height: 38rpx; |
||||
} |
||||
|
||||
.status-text { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
padding: 0 10rpx; |
||||
} |
||||
} |
||||
|
||||
.item-title { |
||||
width: 680rpx; |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 60rpx; |
||||
padding: 0 20rpx; |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
} |
||||
|
||||
.like-img { |
||||
position: absolute; |
||||
bottom: 20rpx; |
||||
right: 10rpx; |
||||
width: 60rpx; |
||||
height: 130rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 双图直播 |
||||
.content-two { |
||||
width: 100%; |
||||
// -moz-column-count: 2; |
||||
// -webkit-column-count: 2; |
||||
// column-count: 2; |
||||
// padding-top: 20rpx; |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
|
||||
&__item { |
||||
margin-right: 30rpx; |
||||
margin-top: 20rpx; |
||||
|
||||
&:nth-child(2n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<view class="live-el mx20 mb10"> |
||||
<view class="head"> |
||||
<text class="head-title">热门直播</text> |
||||
<view class="head-more" @tap="$yrouter.push('/pages/shop/Live/LiveList/index')"> |
||||
<text>更多</text> |
||||
<text class="cuIcon-right"></text> |
||||
</view> |
||||
</view> |
||||
<view class="content-one"> |
||||
<view class="content-one__item" v-for="live in detail" :key="live.roomId" @tap="goRoom(live)"> |
||||
<image class="item-cover" :src="live.shareImge" mode="widthFix"></image> |
||||
<view class="item-status"> |
||||
<image class="status-img" :src="liveStatus[live.liveStatus].img" mode=""></image> |
||||
<text class="status-text">{{ liveStatus[live.liveStatus].title }}</text> |
||||
</view> |
||||
<view class="item-title">{{ live.name }}</view> |
||||
<image v-if="live.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif" |
||||
mode=""></image> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import ShopLiveCard from '@/components/ShopLiveCard.vue' |
||||
|
||||
let HAS_LIVE = false |
||||
// #ifdef MP-WEIXIN |
||||
HAS_LIVE = true |
||||
let livePlayer = null; |
||||
if (HAS_LIVE) { |
||||
livePlayer = requirePlugin('live-player-plugin'); |
||||
} |
||||
// #endif |
||||
import { |
||||
yxWechatLive, |
||||
getLiveReplay |
||||
} from '@/api/live'; |
||||
|
||||
let timer = null; |
||||
export default { |
||||
components: { |
||||
ShopLiveCard |
||||
}, |
||||
data() { |
||||
return { |
||||
liveList: [], |
||||
liveStatus: { |
||||
'101': { |
||||
img: 'https://wx.yixiang.co/static/images/live.png', |
||||
title: '直播中' |
||||
}, |
||||
'102': { |
||||
img: 'https://wx.yixiang.co/static/images/prevue.png', |
||||
title: '未开始' |
||||
}, |
||||
'103': { |
||||
img: 'https://wx.yixiang.co/static/images/playback.png', |
||||
title: '已结束' |
||||
}, |
||||
'104': { |
||||
img: 'https://wx.yixiang.co/static/images/104.png', |
||||
title: '禁播' |
||||
}, |
||||
'105': { |
||||
img: 'https://wx.yixiang.co/static/images/105.png', |
||||
title: '暂停中' |
||||
}, |
||||
'106': { |
||||
img: 'https://wx.yixiang.co/static/images/106.png', |
||||
title: '异常' |
||||
}, |
||||
'107': { |
||||
img: 'https://wx.yixiang.co/static/images/past.png', |
||||
title: '已过期' |
||||
} |
||||
} |
||||
}; |
||||
}, |
||||
props: { |
||||
detail: Array |
||||
}, |
||||
created() { |
||||
}, |
||||
mounted() { |
||||
let that = this; |
||||
timer = setInterval(() => { |
||||
that.getLiveStatus(); |
||||
}, 60000); |
||||
}, |
||||
beforeDestroy() { |
||||
timer = null; |
||||
}, |
||||
computed: {}, |
||||
methods: { |
||||
// 直播列表 |
||||
getLiveList() { |
||||
// let that = this; |
||||
// yxWechatLive({ |
||||
// page: 1, |
||||
// size: 10, |
||||
// }).then(res => { |
||||
// console.log(res) |
||||
// }) |
||||
}, |
||||
// 轮询liveStatus |
||||
getLiveStatus() { |
||||
// if (HAS_LIVE) { |
||||
// let that = this; |
||||
// let date = ''; |
||||
// if (that.detail.liveStatus == 102) { |
||||
// date = that.$tools.dateFormat('mm-dd HH:MM', new Date(that.detail.starttime * 1000)).replace('-', |
||||
// '/'); |
||||
// that.liveStatus['102'].title = '预告 ' + date; |
||||
// } |
||||
// livePlayer |
||||
// .getLiveStatus({ |
||||
// room_id: that.detail.roomId |
||||
// }) |
||||
// .then(res => { |
||||
// // 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常,107:已过期 |
||||
// that.detail.liveStatus = res.liveStatus; |
||||
// }) |
||||
// .catch(err => { |
||||
// console.log('get live status', err); |
||||
// }); |
||||
// } |
||||
}, |
||||
goRoom(live) { |
||||
wx.navigateTo({ |
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${live.roomId}` |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.live-el { |
||||
background: #fff; |
||||
border-radius: 20rpx; |
||||
padding: 30rpx 20rpx 25rpx; |
||||
|
||||
.head { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
|
||||
&-title { |
||||
font-size: 32rpx; |
||||
font-weight: bold; |
||||
font-family: PingFang SC; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
|
||||
&-more { |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
} |
||||
|
||||
// 单个大图直播 |
||||
.content-one { |
||||
.content-one__item { |
||||
position: relative; |
||||
height: 280rpx; |
||||
border-radius: 20rpx; |
||||
margin-top: 25rpx; |
||||
overflow: hidden; |
||||
|
||||
.item-cover { |
||||
background-color: #eee; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
|
||||
.item-status { |
||||
position: absolute; |
||||
top: 20rpx; |
||||
left: 10rpx; |
||||
height: 40rpx; |
||||
background: rgba(0, 0, 0, 0.4); |
||||
border-radius: 20rpx; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
.status-img { |
||||
width: 38rpx; |
||||
height: 38rpx; |
||||
} |
||||
|
||||
.status-text { |
||||
font-size: 22rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
padding: 0 10rpx; |
||||
} |
||||
} |
||||
|
||||
.item-title { |
||||
width: 680rpx; |
||||
position: absolute; |
||||
bottom: 0; |
||||
line-height: 60rpx; |
||||
padding: 0 20rpx; |
||||
font-size: 26rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: 500; |
||||
color: rgba(255, 255, 255, 1); |
||||
background: linear-gradient(transparent, rgba(#000, 0.5)); |
||||
} |
||||
|
||||
.like-img { |
||||
position: absolute; |
||||
bottom: 20rpx; |
||||
right: 10rpx; |
||||
width: 60rpx; |
||||
height: 130rpx; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 双图直播 |
||||
.content-two { |
||||
width: 100%; |
||||
// -moz-column-count: 2; |
||||
// -webkit-column-count: 2; |
||||
// column-count: 2; |
||||
// padding-top: 20rpx; |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
|
||||
&__item { |
||||
margin-right: 30rpx; |
||||
margin-top: 20rpx; |
||||
|
||||
&:nth-child(2n) { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -1,182 +1,182 @@
|
||||
<template> |
||||
<view class="page_box"> |
||||
<view class="head_box"> |
||||
<view class="live-tab"> |
||||
<view class="live-tab__item" v-for="tab in liveTab" :key="tab.title" @tap="selTab(tab)"> |
||||
<view class="live-tab__item-name">{{ tab.name }}</view> |
||||
<text class="live-tab__item--link" :class="{ 'live-tab__item--active': tabCur == tab.title }"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="content_box"> |
||||
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box"> |
||||
<view class="list-box"> |
||||
<block v-for="live in liveList" :key="live.roomId"> |
||||
<shop-live-card :detail="live"></shop-live-card> |
||||
</block> |
||||
</view> |
||||
<view v-if="liveList.length" class="cu-load text-gray" :class="loadStatus"></view> |
||||
</scroll-view> |
||||
</view> |
||||
<Loading :loaded="loaded" :loading="loading"></Loading> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
yxWechatLive |
||||
} from "@/api/live"; |
||||
import ShopLiveCard from '@/components/ShopLiveCard.vue' |
||||
import Loading from "@/components/Loading"; |
||||
|
||||
export default { |
||||
components: { |
||||
ShopLiveCard, |
||||
Loading |
||||
}, |
||||
data() { |
||||
return { |
||||
tabCur: 'all', |
||||
liveStatus: '', |
||||
loaded: false, |
||||
loading: false, |
||||
liveTab: [{ |
||||
title: 'all', |
||||
name: '全部', |
||||
code: '' |
||||
}, |
||||
{ |
||||
title: 'prevue', |
||||
name: '预告', |
||||
code: '102' |
||||
|
||||
}, |
||||
{ |
||||
title: 'living', |
||||
name: '直播中', |
||||
code: '101' |
||||
|
||||
}, |
||||
{ |
||||
title: 'lived', |
||||
name: '已结束', |
||||
code: '103' |
||||
|
||||
} |
||||
], |
||||
liveList: [], |
||||
loadStatus: '', //loading,over |
||||
currentPage: 0, |
||||
size: 10, |
||||
lastPage: 0 |
||||
}; |
||||
}, |
||||
computed: {}, |
||||
onLoad() { |
||||
this.getLiveList(); |
||||
}, |
||||
onHide() {}, |
||||
methods: { |
||||
// 切换tab |
||||
selTab(tab) { |
||||
console.log(tab) |
||||
this.tabCur = tab.title; |
||||
this.liveStatus = tab.code; |
||||
this.liveList = []; |
||||
this.loaded=false; |
||||
this.loading=false; |
||||
this.getLiveListTab(); |
||||
}, |
||||
|
||||
// 直播列表 |
||||
getLiveListTab() { |
||||
let that = this; |
||||
yxWechatLive({ |
||||
liveStatus: that.liveStatus, |
||||
page: 0, |
||||
size: that.size |
||||
}).then(res => { |
||||
that.liveList = [...that.liveList, ...res.data.content]; |
||||
that.lastPage = res.data.lastPage; |
||||
this.loaded = res.data.content.length < that.size; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 直播列表 |
||||
getLiveList() { |
||||
let that = this; |
||||
if (this.loading || this.loaded) return; |
||||
this.loading = true; |
||||
yxWechatLive({ |
||||
liveStatus: this.liveStatus, |
||||
page: this.currentPage, |
||||
size: this.size |
||||
}).then(res => { |
||||
that.liveList = that.liveList.concat(res.data.content) |
||||
this.currentPage++; |
||||
this.loaded = res.data.content.length < that.size; |
||||
this.loading = false; |
||||
}); |
||||
} |
||||
}, |
||||
onReachBottom() { |
||||
!this.loading && this.getLiveList(); |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
// tab |
||||
.live-tab { |
||||
width: 100%; |
||||
height: 96rpx; |
||||
background: #fff; |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
&__item { |
||||
flex: 1; |
||||
height: 100%; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
|
||||
&__item-name { |
||||
font-size: 28rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: bold; |
||||
color: rgba(51, 51, 51, 1); |
||||
flex: 1; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
&__item--link { |
||||
width: 68rpx; |
||||
height: 4rpx; |
||||
background: transparent; |
||||
border-radius: 2rpx; |
||||
} |
||||
|
||||
&__item--active { |
||||
width: 68rpx; |
||||
height: 4rpx; |
||||
background: rgba(213, 166, 90, 1); |
||||
border-radius: 2rpx; |
||||
} |
||||
} |
||||
|
||||
// 瀑布流 list |
||||
.scroll-box { |
||||
.list-box { |
||||
width: 100%; |
||||
-moz-column-count: 2; |
||||
-webkit-column-count: 2; |
||||
column-count: 2; |
||||
padding: 25rpx; |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<view class="page_box"> |
||||
<view class="head_box"> |
||||
<view class="live-tab"> |
||||
<view class="live-tab__item" v-for="tab in liveTab" :key="tab.title" @tap="selTab(tab)"> |
||||
<view class="live-tab__item-name">{{ tab.name }}</view> |
||||
<text class="live-tab__item--link" :class="{ 'live-tab__item--active': tabCur == tab.title }"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="content_box"> |
||||
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box"> |
||||
<view class="list-box"> |
||||
<block v-for="live in liveList" :key="live.roomId"> |
||||
<shop-live-card :detail="live"></shop-live-card> |
||||
</block> |
||||
</view> |
||||
<view v-if="liveList.length" class="cu-load text-gray" :class="loadStatus"></view> |
||||
</scroll-view> |
||||
</view> |
||||
<Loading :loaded="loaded" :loading="loading"></Loading> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
yxWechatLive |
||||
} from "@/api/live"; |
||||
import ShopLiveCard from '@/components/ShopLiveCard.vue' |
||||
import Loading from "@/components/Loading"; |
||||
|
||||
export default { |
||||
components: { |
||||
ShopLiveCard, |
||||
Loading |
||||
}, |
||||
data() { |
||||
return { |
||||
tabCur: 'all', |
||||
liveStatus: '', |
||||
loaded: false, |
||||
loading: false, |
||||
liveTab: [{ |
||||
title: 'all', |
||||
name: '全部', |
||||
code: '' |
||||
}, |
||||
{ |
||||
title: 'prevue', |
||||
name: '预告', |
||||
code: '102' |
||||
|
||||
}, |
||||
{ |
||||
title: 'living', |
||||
name: '直播中', |
||||
code: '101' |
||||
|
||||
}, |
||||
{ |
||||
title: 'lived', |
||||
name: '已结束', |
||||
code: '103' |
||||
|
||||
} |
||||
], |
||||
liveList: [], |
||||
loadStatus: '', //loading,over |
||||
currentPage: 0, |
||||
size: 10, |
||||
lastPage: 0 |
||||
}; |
||||
}, |
||||
computed: {}, |
||||
onLoad() { |
||||
this.getLiveList(); |
||||
}, |
||||
onHide() {}, |
||||
methods: { |
||||
// 切换tab |
||||
selTab(tab) { |
||||
console.log(tab) |
||||
this.tabCur = tab.title; |
||||
this.liveStatus = tab.code; |
||||
this.liveList = []; |
||||
this.loaded=false; |
||||
this.loading=false; |
||||
this.getLiveListTab(); |
||||
}, |
||||
|
||||
// 直播列表 |
||||
getLiveListTab() { |
||||
let that = this; |
||||
yxWechatLive({ |
||||
liveStatus: that.liveStatus, |
||||
page: 0, |
||||
size: that.size |
||||
}).then(res => { |
||||
that.liveList = [...that.liveList, ...res.data.content]; |
||||
that.lastPage = res.data.lastPage; |
||||
this.loaded = res.data.content.length < that.size; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 直播列表 |
||||
getLiveList() { |
||||
let that = this; |
||||
if (this.loading || this.loaded) return; |
||||
this.loading = true; |
||||
yxWechatLive({ |
||||
liveStatus: this.liveStatus, |
||||
page: this.currentPage, |
||||
size: this.size |
||||
}).then(res => { |
||||
that.liveList = that.liveList.concat(res.data.content) |
||||
this.currentPage++; |
||||
this.loaded = res.data.content.length < that.size; |
||||
this.loading = false; |
||||
}); |
||||
} |
||||
}, |
||||
onReachBottom() { |
||||
!this.loading && this.getLiveList(); |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
// tab |
||||
.live-tab { |
||||
width: 100%; |
||||
height: 96rpx; |
||||
background: #fff; |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
&__item { |
||||
flex: 1; |
||||
height: 100%; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
|
||||
&__item-name { |
||||
font-size: 28rpx; |
||||
font-family: PingFang SC; |
||||
font-weight: bold; |
||||
color: rgba(51, 51, 51, 1); |
||||
flex: 1; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
&__item--link { |
||||
width: 68rpx; |
||||
height: 4rpx; |
||||
background: transparent; |
||||
border-radius: 2rpx; |
||||
} |
||||
|
||||
&__item--active { |
||||
width: 68rpx; |
||||
height: 4rpx; |
||||
background: rgba(213, 166, 90, 1); |
||||
border-radius: 2rpx; |
||||
} |
||||
} |
||||
|
||||
// 瀑布流 list |
||||
.scroll-box { |
||||
.list-box { |
||||
width: 100%; |
||||
-moz-column-count: 2; |
||||
-webkit-column-count: 2; |
||||
column-count: 2; |
||||
padding: 25rpx; |
||||
} |
||||
} |
||||
</style> |
||||
|
Loading…
Reference in new issue