Commit 4ca10570 authored by jyx's avatar jyx

代码优化

parent d939f3ae
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<swiper-item v-for="(list, index) in displaySwiperList" :key="index" :style="'width:100%; height:100%;'"> <swiper-item v-for="(list, index) in displaySwiperList" :key="index" :style="'width:100%; height:100%;'">
<view :style="'width:100%; height:100%;'"> <view :style="'width:100%; height:100%;'">
<video v-if="Math.abs(displayIndex-index)==0 && list.vedioUrl" :id="list.vedioIndex" <video v-if="Math.abs(displayIndex-index)==0 && list.vedioUrl" :id="list.vedioIndex"
:controls="isqp" :loop="!isplay" :enable-progress-gesture="false" :auto-play="true" :controls="isqp" :loop="!isplay" :enable-progress-gesture="false" :show-progress="true"
:show-play-btn="isqp" :show-loading="true" :show-fullscreen-btn="false" @ended="ended" :show-play-btn="isqp" :show-loading="true" :show-fullscreen-btn="false" @ended="ended"
@controlstoggle="controlstoggle" @click="tapVides()" @timeupdate="timeupdate" @controlstoggle="controlstoggle" @click="tapVides()" @timeupdate="timeupdate"
:style="'width:100%; height:100%;'" :src="list.vedioUrl" :poster="data.coverImage" :style="'width:100%; height:100%;'" :src="list.vedioUrl" :poster="data.coverImage"
...@@ -270,13 +270,13 @@ ...@@ -270,13 +270,13 @@
data data
}) => { }) => {
this.originList = data.list this.originList = data.list
if (this.isPlayNext == 0) { if (this.isPlayNext == 1) {
this.originIndex = this.data.seeIndex - 1
} else {
this.originIndex = this.data.recommendIndex - 1 this.originIndex = this.data.recommendIndex - 1
if (this.originIndex >= this.data.unlockIndex - 1) { if (this.originIndex >= this.data.unlockIndex - 1) {
this.originIndex = this.data.unlockIndex - 1 this.originIndex = this.data.unlockIndex - 1
} }
} else {
this.originIndex = this.data.seeIndex - 1
} }
if (this.originIndex >= this.data.vedioTotal || this.originIndex < 0) { if (this.originIndex >= this.data.vedioTotal || this.originIndex < 0) {
this.originIndex = 0 this.originIndex = 0
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
} else { } else {
this.current = 0 this.current = 0
} }
this.isqp = false this.isqp = true
console.log('显示swiper Index:', this.displayIndex) console.log('显示swiper Index:', this.displayIndex)
} }
}, },
...@@ -305,7 +305,6 @@ ...@@ -305,7 +305,6 @@
* @originIndex 从源数据的哪个开始显示默认0,如从其他页面跳转进来,要显示第n个,这个参数就是他的下标 * @originIndex 从源数据的哪个开始显示默认0,如从其他页面跳转进来,要显示第n个,这个参数就是他的下标
*/ */
initSwiperData(originIndex = this.originIndex) { initSwiperData(originIndex = this.originIndex) {
this.isqp = false
console.log('--------当前数据 Index:', originIndex) console.log('--------当前数据 Index:', originIndex)
const originListLength = this.originList.length; // 源数据长度 const originListLength = this.originList.length; // 源数据长度
const displayList = []; const displayList = [];
...@@ -332,12 +331,12 @@ ...@@ -332,12 +331,12 @@
uni.createVideoContext("" + this.originList[this.oid].vedioIndex, this).stop(); uni.createVideoContext("" + this.originList[this.oid].vedioIndex, this).stop();
if (this.originList[originIndex].vedioIndex > this.data.unlockIndex) { if (this.originList[originIndex].vedioIndex > this.data.unlockIndex) {
this.isqp = false this.isqp = true
this.fenji = 2 this.fenji = 2
this.$refs.select.open('bottom'); this.$refs.select.open('bottom');
} else { } else {
setTimeout(() => { setTimeout(() => {
this.isqp = false this.isqp = true
console.log('qqqqqq:', this.originList[originIndex].vedioIndex) console.log('qqqqqq:', this.originList[originIndex].vedioIndex)
// audo.play() // audo.play()
uni.createVideoContext("" + this.originList[originIndex].vedioIndex, this).play(); uni.createVideoContext("" + this.originList[originIndex].vedioIndex, this).play();
......
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