优化播放开始请求接口增加防抖
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
|
||||
<swiper-item v-for="(item,index) in videoList" :key="index">
|
||||
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand"
|
||||
@playStatusChange="playStatusChange"
|
||||
:showControls="control.showControls" :current="current" :isCollect="isCollect"
|
||||
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds"
|
||||
:index="index" :nowIndex="nowIndex" @dianzanClick="dianzanClick(item,index)" @share="share(item)"
|
||||
@@ -21,6 +22,7 @@
|
||||
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
|
||||
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
|
||||
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
|
||||
@playStatusChange="playStatusChange"
|
||||
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
|
||||
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
|
||||
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
|
||||
@@ -47,14 +49,11 @@
|
||||
</view>
|
||||
<up-icon name="close" :size="16" color="#333" bold @click="popupClose('show')"></up-icon>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="u-m-t-30 xuanji-scroll"
|
||||
ref="refXuanjiList"
|
||||
:style="{height:xuanjiData.height+'px'}"
|
||||
@scroll="xuanjiScroll"
|
||||
:scroll-top="xuanjiData.scrollTop" scroll-with-animation :show-scrollbar="false">
|
||||
<scroll-view scroll-y="true" class="u-m-t-30 xuanji-scroll" ref="refXuanjiList"
|
||||
:style="{height:xuanjiData.height+'px'}" @scroll="xuanjiScroll" :scroll-top="xuanjiData.scrollTop"
|
||||
scroll-with-animation :show-scrollbar="false">
|
||||
<view class="ji-list u-flex u-flex-row u-flex-wrap">
|
||||
<view class="ji-item u-flex-xy-center u-text-center" @click="jiClick(item,index)"
|
||||
|
||||
:class="[nowIndex==index?'active':'',(index+1)%3==0?'mr-0':'','ji-item'+index]"
|
||||
v-for="(item,index) in list" :key="index">
|
||||
<text class="u-font-28" :class="{'color-fff':nowIndex==index}">第{{index+1}}集</text>
|
||||
@@ -321,42 +320,45 @@
|
||||
scrollTop: 0,
|
||||
items: [],
|
||||
scrollHeight: 0,
|
||||
height:400
|
||||
height: 400
|
||||
})
|
||||
const refXuanjiList=ref(null)
|
||||
function xuanjiScroll(e){
|
||||
const refXuanjiList = ref(null)
|
||||
|
||||
function xuanjiScroll(e) {
|
||||
console.log(e);
|
||||
}
|
||||
async function xuanjiInit() {
|
||||
// #ifdef APP
|
||||
const height=44
|
||||
const marginBottom=10
|
||||
const oneItemHeight=height+marginBottom
|
||||
xuanjiData.scrollTop=Math.ceil((nowIndex.value+1)/3) * oneItemHeight - (xuanjiData.height)/2+oneItemHeight/2
|
||||
const height = 44
|
||||
const marginBottom = 10
|
||||
const oneItemHeight = height + marginBottom
|
||||
xuanjiData.scrollTop = Math.ceil((nowIndex.value + 1) / 3) * oneItemHeight - (xuanjiData.height) / 2 +
|
||||
oneItemHeight / 2
|
||||
return
|
||||
// #endif
|
||||
|
||||
|
||||
if (!xuanjiData.items[props.list.length - 1]) {
|
||||
const res = await getElRect('ji-list', instance, {
|
||||
rect: true
|
||||
})
|
||||
xuanjiData.scrollHeight = res.height
|
||||
let firstItemTop=0
|
||||
let firstItemTop = 0
|
||||
for (let i in props.list) {
|
||||
const res1 = await getElRect('ji-item' + i, instance, {
|
||||
rect: true
|
||||
})
|
||||
if(i==0){
|
||||
firstItemTop=res1.top
|
||||
if (i == 0) {
|
||||
firstItemTop = res1.top
|
||||
}
|
||||
xuanjiData.items[i] = {
|
||||
height: res1.height,
|
||||
top: i==0?0: res1.top-firstItemTop
|
||||
top: i == 0 ? 0 : res1.top - firstItemTop
|
||||
}
|
||||
}
|
||||
}
|
||||
xuanjiData.scrollTop =xuanjiData.items[nowIndex.value].top-(xuanjiData.height)/2+(xuanjiData.items[nowIndex.value].height)/2
|
||||
console.log(xuanjiData);
|
||||
xuanjiData.scrollTop = xuanjiData.items[nowIndex.value].top - (xuanjiData.height) / 2 + (xuanjiData.items[
|
||||
nowIndex.value].height) / 2
|
||||
console.log(xuanjiData);
|
||||
}
|
||||
|
||||
|
||||
@@ -549,7 +551,7 @@
|
||||
// #ifdef APP
|
||||
xuanjiInit()
|
||||
// #endif
|
||||
|
||||
|
||||
}
|
||||
popup[key] = true
|
||||
if (item) {
|
||||
@@ -811,6 +813,19 @@
|
||||
return item ? item : v
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param {type} = [start,end]
|
||||
*/
|
||||
const playStatusChange = debounce((data) => {
|
||||
Api.playStatus(data)
|
||||
}, 2000)
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
videoListUpdata
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user