Commit fb5e0046 authored by ziyu's avatar ziyu

合并

parents 2f5706ae 3c3f216e
...@@ -16,8 +16,17 @@ function getClass (status) { ...@@ -16,8 +16,17 @@ function getClass (status) {
console.log(status) console.log(status)
return cls[index] return cls[index]
}; };
function showVideo(item,current,index) {
if(item.showType && item.showType.value ==2) {
if(current === index) {
return true
} else {
return false;
}
}
}
module.exports = { module.exports = {
computClass:computClass, computClass:computClass,
getClass:getClass getClass:getClass,
showVideo:showVideo
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
height:100%; height:100%;
width:100%; width:100%;
position: absolute; position: absolute;
background-color: #000;
z-index: 1; z-index: 1;
} }
...@@ -65,6 +66,7 @@ ...@@ -65,6 +66,7 @@
width: 100%; width: 100%;
} }
</style> </style>
<wxs module="video" src="../../common/common.wxs"></wxs>
<template> <template>
<view class="container"> <view class="container">
<swiper <swiper
...@@ -74,6 +76,7 @@ ...@@ -74,6 +76,7 @@
vertical vertical
current="0" current="0"
bindanimationfinish="bindanimationfinish" bindanimationfinish="bindanimationfinish"
bindchange="moveSwiper"
> >
<swiper-item :class="{'image-item': item.showType && item.showType.value === 1}" v-for="(item, idx) in curQueue" :key="item.id"> <swiper-item :class="{'image-item': item.showType && item.showType.value === 1}" v-for="(item, idx) in curQueue" :key="item.id">
<view class="video-wrapper"> <view class="video-wrapper">
...@@ -84,20 +87,20 @@ ...@@ -84,20 +87,20 @@
show-center-play-btn="{{false}}" show-center-play-btn="{{false}}"
enable-progress-gesture="{{false}}" enable-progress-gesture="{{false}}"
controls="{{false}}" controls="{{false}}"
src="{{item.videoUrl}}" src="{{video.showVideo(item,currentIndex,idx)?item.videoUrl:null}}"
data-id="{{item.id}}" data-id="{{item.id}}"
object-fit="{{item.objectFit || 'contain'}}"
data-index="{{idx}}" data-index="{{idx}}"
binderror="onError" binderror="onError"
bindtimeupdate="onTimeUpdate" bindtimeupdate="onTimeUpdate"
@tap="videoTap" @tap="videoTap"
custom-cache="{{false}}" custom-cache="{{false}}"
v-if="item.showType && item.showType.value === 2" object-fit="contain"
wx:if="{{item.showType && item.showType.value ==2}}"
> >
<video-loading v-if="item.time === 0" :snapshot="item.videoSnapUrl"/> <video-loading v-if="item.time === 0" :snapshot="item.videoSnapUrl"/>
<video-pause :pause="pause"></video-pause> <video-pause :pause="pause"></video-pause>
</video> </video>
<image v-if="item.showType && item.showType.value === 1" lazy-load class="images" :src="item.photoUrl" mode="widthFix" bindload="imageLoad(item.id)"> <image wx:if="{{item.showType && item.showType.value ==1}}" lazy-load class="images" :src="item.photoUrl" mode="widthFix" bindload="imageLoad(item.id)">
<image-loading v-if="item.time === 0"/> <image-loading v-if="item.time === 0"/>
</image> </image>
<view class="rightcont" v-show="item.id > 0"> <view class="rightcont" v-show="item.id > 0">
...@@ -132,6 +135,7 @@ ...@@ -132,6 +135,7 @@
data: { data: {
pause: false, pause: false,
curQueue: [], curQueue: [],
currentIndex:0,
}, },
watch: { watch: {
videoList () { videoList () {
...@@ -155,6 +159,12 @@ ...@@ -155,6 +159,12 @@
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
this.updateAwardsInfo(videoCurrent); this.updateAwardsInfo(videoCurrent);
}, },
moveSwiper(e) {
if (e.$wx.detail.source === 'touch') {
let current = e.$wx.detail.current;
this.currentIndex = current;
}
},
async getProgress(id) { async getProgress(id) {
if (id <= 0) return; if (id <= 0) return;
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
...@@ -223,6 +233,8 @@ ...@@ -223,6 +233,8 @@
if (index !== current) { if (index !== current) {
ctx && ctx.pause(); ctx && ctx.pause();
} else { } else {
//将视频重置到最开始的位置并播放
// ctx && ctx.seek(0);
ctx && ctx.play(); ctx && ctx.play();
} }
}); });
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
share: '/static/images/share@2x.png', share: '/static/images/share@2x.png',
lottery: '/static/images/lottery@2x.png' lottery: '/static/images/lottery@2x.png'
}; };
let isFirst = true;
let addGoldTimer = null; let addGoldTimer = null;
wepy.component({ wepy.component({
store, store,
...@@ -74,6 +73,7 @@ ...@@ -74,6 +73,7 @@
lotteryUrl: '/static/images/lottery@2x.png', lotteryUrl: '/static/images/lottery@2x.png',
containerStyle: '', containerStyle: '',
flyAnimation: false, flyAnimation: false,
isFirst:true,
}, },
props: { props: {
title: '', title: '',
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
if (v) { if (v) {
this.addCount = 0; this.addCount = 0;
} }
if (isFirst) { if (this.isFirst) {
isFirst = false; this.isFirst = false;
return; return;
} }
setTimeout(() => { setTimeout(() => {
...@@ -153,11 +153,11 @@ ...@@ -153,11 +153,11 @@
}, 1500); }, 1500);
}, },
sign(v) { sign(v) {
if (isFirst) { if (this.isFirst) {
this.signComplete = false; this.signComplete = false;
this.flyAnimation = false; this.flyAnimation = false;
this.addsunshine = false; this.addsunshine = false;
isFirst = false; this.isFirst = false;
return; return;
} }
if (v) { if (v) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment