多租户商城-商户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

280 lines
6.9 KiB

<template>
<div class="live-box">
<div class="live-ongoing" v-if="liveData.live_status === 101 || isOn">
<img class="cover-img" :src="liveData.cover_img" />
<div class="status">
<div class="status-state">
<img class="img" src="../../../static/images/live/icon-live-num.png" />直播中</div>
<div class="status-num">1000人</div>
</div>
<div class="user">
<div class="user-pic">
<img class="img" src="../../../static/images/live/huabei.png" />
</div>
<view class="user-name">{{ liveData.anchor_name }}</view>
</div>
<div class="products">
<div class="uni-padding-wrap">
<div class="page-section swiper">
<div class="page-section-spacing">
<el-carousel height="34px" direction="vertical" indicator-position="none">
<el-carousel-item v-for="item in liveData.goods" :key="item.goods_id">
<h3 class="medium">{{ item.name }}</h3>
</el-carousel-item>
</el-carousel>
</div>
</div>
</div>
</div>
</div>
<div class="live-other" v-else>
<img class="cover-img" :src="liveData.cover_img" />
<div class="user">
<div class="user-pic"><img class="img" src="../../../static/images/live/huabei.png" /></div>
<div class="user-name">{{ liveData.anchor_name }}</div>
</div>
<div class="count-down">
<div class="text">开播倒计时</div>
<div class="time">
<div class="time-item dots">{{times[0]}}</div>
<div class="time-item dots">{{times[1]}}</div>
<div class="time-item">{{times[2]}}</div>
</div>
</div>
<div class="btn-subscribe">立即预约</div>
<!-- <view class="btn-subscribe subscribed">已预约</view>-->
</div>
</div>
</template>
<script>
export default {
props: {
liveData: {
type: Object,
default: () => ({
name: '',
cover_img: ''
})
}
},
data () {
return {
background: ['color1', 'color2', 'color3'],
indicatorDots: false,
autoplay: true,
interval: 2000, // 自动播放间隔时长
duration: 500, // 幻灯片切换时长(ms)
times: [],
isOn: false
}
},
created() {
this.countTime()
},
methods: {
changeIndicatorDots(e) {
this.indicatorDots = !this.indicatorDots
},
changeAutoplay(e) {
this.autoplay = !this.autoplay
},
intervalChange(e) {
this.interval = e.target.value
},
durationChange(e) {
this.duration = e.target.value
},
countTime(){
var nowtime = new Date().getTime() //获取当前时间
var starttime = this.liveData.start_time * 1000
if(this.liveData.live_status === 102){
if(starttime > nowtime){
var lefttime = starttime - nowtime //距离结束时间的毫秒数
var leftd = Math.floor(lefttime/(1000*60*60)), //计算小时数
leftm = Math.floor(lefttime/(1000*60)%60), //计算分钟数
lefts = Math.floor(lefttime/1000%60); //计算秒数
this.times = [leftd < 10?'0'+ leftd:leftd,leftm < 10?'0'+ leftm:leftm,lefts < 10?'0'+ lefts:lefts]
setTimeout(() => {
this.countTime()
},1000)
} else {
this.isOn = true
}
}
}
}
}
</script>
<style lang="scss" scoped>
.live-box{
position: relative;
color: #fff;
.cover-img{
width: 100%;
height: 100%;
position: absolute;
z-index: 0;
}
.user{
display: flex;
line-height: 60px;
height: 64px;
&-pic{
.img{
width: 60px;
height: 60px;
border: 2px solid rgba(255, 255, 255, 0.5019607843137255);
border-radius: 50%;
overflow: hidden;
}
}
&-name{
font-size: 28px;
margin-left: 16px;
}
}
.live-ongoing{
width: 100%;
height: 100%;
position: relative;
.status{
position: absolute;
top: 22px;
left: 22px;
//width: 212upx;
height: 48px;
background: rgba(0,0,0,0.3);
border: 2px solid rgba(255,255,255,0.3);
border-radius: 24px;
font-size: 20px;
line-height: 44px;
display: flex;
padding-right: 8px;
&-state{
width: 118px;
height: 44px;
background: linear-gradient(90deg, #C83732 0%, #E25C44 100%);
opacity: 1;
border-radius: 26px;
display: flex;
align-items: center;
justify-content: center;
.img{
width: 20px;
height: 20px;
margin-right: 6px;
}
}
&-num{
min-width: 80px;
padding: 0 8px;
}
}
.user{
position: absolute;
bottom: 62px;
left: 20px;
}
.products{
position: absolute;
left: 0px;
bottom: 20px;
width: 100%;
padding:0 20px;
.swiper{
height: 34px;
line-height: 34px;
font-size: 24px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
}
}
.live-other{
position: relative;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.cover-img{
filter:blur(20px);
-webkit-filter:blur(20px);
-moz-filter:blur(20px);
-ms-filter:blur(20px);
-o-filter:blur(20px);
}
.user{
position: absolute;
top: 20px;
left: 20px;
}
.count-down{
position: relative;
.text{
font-size: 26px;
line-height: 36px;
margin-bottom: 16px;
opacity: 0.5;
text-align: center;
}
.time{
display: flex;
&-item{
min-width: 52px;
padding: 0 5px;
height: 52px;
line-height: 52px;
background: #FFFFFF;
opacity: 1;
border-radius: 4px;
font-size: 26px;
color: #C83732;
text-align: center;
&.dots{
margin-right: 22px;
position: relative;
&:before,&:after{
content:'';
width: 6px;
height: 6px;
background: #FFFFFF;
position: absolute;
right: -14px;
}
&:before{
top: 14px;
}
&:after{
bottom: 14px;
}
}
}
}
}
.btn-subscribe{
width: 200px;
height: 64px;
line-height: 64px;
background: linear-gradient(90deg, #C83732 0%, #E25C44 100%);
box-shadow: 0rpx 6px 12px rgba(233, 0, 0, 0.3);
opacity: 1;
border-radius: 8px;
color: #fff;
font-size: 24px;
text-align: center;
position: absolute;
bottom: 60px;
left: 50%;
margin-left: -100px;
&.subscribed{
background: #FFFFFF;
color: #999999;
box-shadow: none;
}
}
}
}
</style>