Commit 5d7865eb authored by 郭志伟's avatar 郭志伟

"fix: 问题修复

1、视频切换闪一下;2、swiper不从第一个开始;3、circular改变导致swiper刷
新问题预解决"
parent 1140bf69
This diff is collapsed.
...@@ -5,31 +5,31 @@ ...@@ -5,31 +5,31 @@
duration="500" duration="500"
circular="{{circular}}" circular="{{circular}}"
vertical vertical
current="1" current="0"
bindchange="moveSwiper"> bindchange="moveSwiper">
<swiper-item wx:for="{{curQueue}}" wx:key="index"> <swiper-item wx:for="{{curQueue}}" wx:key="index">
<view class="video-swiper"> <view class="video-swiper">
<video <video
class="video-item" class="video-item"
:class="{ show: item.showType && item.showType.value == 2 }"
id="video_{{index}}" id="video_{{index}}"
loop loop
enable-progress-gesture="{{false}}" enable-progress-gesture="{{false}}"
show-center-play-btn="{{false}}" show-center-play-btn="{{false}}"
controls="{{false}}" controls="{{false}}"
src="{{currentIndex == index ?item.videoUrl :null}}" src="{{item.videoUrl}}"
data-id="{{item.id}}" data-id="{{item.id}}"
object-fit="contain" object-fit="contain"
data-index="{{index}}" data-index="{{index}}"
@tap="videoTap" @tap="videoTap"
custom-cache="{{false}}" custom-cache="{{false}}"
wx:if="{{item.showType && item.showType.value ==2}}"
bindplay="loadMedia" bindplay="loadMedia"
bindloadedmetadata="loadMedia" bindloadedmetadata="loadMedia"
> >
<video-pause :pause="videoPause"></video-pause> <video-pause :pause="videoPause"></video-pause>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
</video> </video>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!-- <video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/> -->
<van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{item.photoUrl || item.videoSnapUrl}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%"> <van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{item.photoUrl || item.videoSnapUrl}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
<van-loading slot="loading" type="spinner" size="20" vertical/> <van-loading slot="loading" type="spinner" size="20" vertical/>
</van-image> </van-image>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
prevQueue: [], prevQueue: [],
curQueue: [], curQueue: [],
circular: false, circular: false,
_last: 1, _last: -1,
_invalidUp: 0, _invalidUp: 0,
_invalidDown: 0, _invalidDown: 0,
_videoContexts: [], _videoContexts: [],
...@@ -214,12 +214,12 @@ ...@@ -214,12 +214,12 @@
circular = false; circular = false;
} }
this.curQueue = [...curQueue]; this.curQueue = [...curQueue];
setTimeout(() => {
this.circular = circular; this.circular = circular;
}, 600);
}, },
playCurrent (current) { playCurrent (current) {
this.$nextTick(() => { this.$nextTick(() => {
if (playTimer) clearTimeout(500);
playTimer = setTimeout(() => {
this.curQueue[current] && this.getProgress(this.curQueue[current].id); this.curQueue[current] && this.getProgress(this.curQueue[current].id);
// 滑动到当前元素时,其他video都暂停,只播放当前video // 滑动到当前元素时,其他video都暂停,只播放当前video
this._videoContexts.forEach(function (ctx, index) { this._videoContexts.forEach(function (ctx, index) {
...@@ -232,7 +232,6 @@ ...@@ -232,7 +232,6 @@
} }
}); });
this.updateAwardsInfo(current); this.updateAwardsInfo(current);
}, 500);
}); });
}, },
videoTap(e) { videoTap(e) {
...@@ -307,6 +306,10 @@ ...@@ -307,6 +306,10 @@
position: absolute; position: absolute;
background-color: #000; background-color: #000;
z-index: 1; z-index: 1;
display: none;
&.show {
display: block;
}
} }
.video-loading { .video-loading {
position: absolute; position: absolute;
......
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