修复h5默认值错误问题
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
:show-play-btn="false"
|
:show-play-btn="false"
|
||||||
:controls="true"
|
:controls="true"
|
||||||
@click.stop="videoClick()"
|
@click.stop="videoClick()"
|
||||||
|
@loadedmetadata="loadedmetadata"
|
||||||
@timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" @pause="onpause"
|
@timeupdate="timeupdate" @waiting="waiting()" object-fit="cover" @pause="onpause"
|
||||||
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
@play="videoPlay('myVideo'+item.courseDetailsId,item.courseDetailsId)" :play-strategy="2"
|
||||||
:show-loading="true" codec="software" :muted="false" :loop="loop"
|
:show-loading="true" codec="software" :muted="false" :loop="loop"
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
mode="aspectFill">
|
mode="aspectFill">
|
||||||
</image>
|
</image>
|
||||||
|
|
||||||
<view class="play-icon" v-if="showVideo&&!isPlying" @click.stop="videoClick()" :style="playStyle">
|
<view class="play-icon" v-if="videoIsLoadedmetadata&&showVideo&&!isPlying" @click.stop="videoClick()" :style="playStyle">
|
||||||
<image class="icon" src="@/static/images/play.png" mode=""></image>
|
<image class="icon" src="@/static/images/play.png" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -182,6 +183,11 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let videoIsLoadedmetadata=ref(false)
|
||||||
|
function loadedmetadata(){
|
||||||
|
videoIsLoadedmetadata.value=true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let isPlying = ref(false)
|
let isPlying = ref(false)
|
||||||
watch(() => isPlying.value, (newval) => {
|
watch(() => isPlying.value, (newval) => {
|
||||||
@@ -211,9 +217,7 @@
|
|||||||
|
|
||||||
function timeupdate(e) {
|
function timeupdate(e) {
|
||||||
//隐藏loding
|
//隐藏loding
|
||||||
// #ifdef H5
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
// #endif
|
|
||||||
if (isPlayFinish) {
|
if (isPlayFinish) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -308,7 +312,9 @@
|
|||||||
}
|
}
|
||||||
const showVideo = computed(() => {
|
const showVideo = computed(() => {
|
||||||
if(props.isAndriod){
|
if(props.isAndriod){
|
||||||
return props.nowIndex === props.index && props.item.videoUrl ?true :false
|
console.log('props.nowIndex === props.index ');
|
||||||
|
console.log(props.nowIndex,props.index );
|
||||||
|
return (props.nowIndex === props.index && props.item.videoUrl) ?true :false
|
||||||
}else{
|
}else{
|
||||||
return props.current === props.index && props.item.videoUrl
|
return props.current === props.index && props.item.videoUrl
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="isH5||isIos" class=" w-full box" style="width: 100vw;">
|
<list v-if="showAndriod" :bounce="false" :loadmoreoffset="wHeight*3" :show-scrollbar="false" ref="listBox"
|
||||||
<swiper @longpress="popupShow('speed')" :style="{height:wHeight+'px'}" v-if="videoList.length"
|
:pagingEnabled="true" @loadmore="loadmore" :scrollable="true">
|
||||||
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
|
|
||||||
@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" :height="wHeight"
|
|
||||||
:isAndriod="isAndriod"
|
|
||||||
:isTabbar="isTabbar" @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)" @zhuijuClick="zhuijuClick(item)"
|
|
||||||
@popupShow="popupShow($event,item,index)"></list-item-vue>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<list v-if="showAndriod" :bounce="false" :loadmoreoffset="wHeight*3" :show-scrollbar="false" ref="listBox" :pagingEnabled="true"
|
|
||||||
@loadmore="loadmore" :scrollable="true">
|
|
||||||
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
|
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
|
||||||
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
|
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
|
||||||
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
|
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
|
||||||
:isAndriod="isAndriod"
|
:isAndriod="isAndriod" :isTabbar="isTabbar" @playStatusChange="playStatusChange" :height="wHeight"
|
||||||
:isTabbar="isTabbar" @playStatusChange="playStatusChange" :height="wHeight" :isCommand="isCommand"
|
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)"
|
||||||
:showControls="control.showControls" @toDetail="toDetail(item,index)" @itemMounted="itemMounted"
|
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance"
|
||||||
@controlstoggles="controlstoggles" :index="index" :instance="instance" :nowIndex="nowIndex"
|
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds"
|
||||||
@appear="appear($event,item,index)" :playSpeeds="playSpeeds"
|
|
||||||
@disappear="disappear($event, item,index)" @dianzanClick="dianzanClick(item,index)"
|
@disappear="disappear($event, item,index)" @dianzanClick="dianzanClick(item,index)"
|
||||||
@share="share(item)" @zhuijuClick="zhuijuClick(item)"
|
@share="share(item)" @zhuijuClick="zhuijuClick(item)"
|
||||||
@popupShow="popupShow($event,item,index)"></list-item-vue>
|
@popupShow="popupShow($event,item,index)"></list-item-vue>
|
||||||
</view>
|
</view>
|
||||||
</cell>
|
</cell>
|
||||||
</list>
|
</list>
|
||||||
|
<view v-if="isH5||isIos" class=" w-full box" style="width: 100vw;">
|
||||||
|
<swiper @longpress="popupShow('speed')" :style="{height:wHeight+'px'}" v-if="videoList.length"
|
||||||
|
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
|
||||||
|
@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" :height="wHeight"
|
||||||
|
:isAndriod="isAndriod" :isTabbar="isTabbar" @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)"
|
||||||
|
@zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 返回按钮 -->
|
<!-- 返回按钮 -->
|
||||||
<view class="back-icon" v-if="!isTabbar&&control.showBack">
|
<view class="back-icon" v-if="!isTabbar&&control.showBack">
|
||||||
@@ -263,16 +262,14 @@
|
|||||||
onUnmounted
|
onUnmounted
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
let isH5=true
|
let isH5 = false
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
isH5=false
|
isH5 = true
|
||||||
// #endif
|
// #endif
|
||||||
const sysinfo=uni.getSystemInfoSync()
|
const sysinfo = uni.getSystemInfoSync()
|
||||||
const isIos=sysinfo.platform=='ios'?true:false
|
const isIos = sysinfo.platform == 'ios' ? true : false
|
||||||
const isAndriod=sysinfo.platform=='android'?true:false
|
const isAndriod = sysinfo.platform == 'android' ? true : false
|
||||||
|
const showAndriod = !isH5 && isAndriod ? true : false
|
||||||
const showAndriod=!isH5&&isAndriod
|
|
||||||
|
|
||||||
let initing = true
|
let initing = true
|
||||||
const refPoster = ref(null)
|
const refPoster = ref(null)
|
||||||
|
|
||||||
@@ -465,25 +462,6 @@
|
|||||||
$mountedComponents[index] = true
|
$mountedComponents[index] = true
|
||||||
}
|
}
|
||||||
console.log('appear:' + index);
|
console.log('appear:' + index);
|
||||||
// if($common.isIos&&!initing){
|
|
||||||
// console.log('appear:'+index);
|
|
||||||
// nowIndex.value = index
|
|
||||||
// const item = props.list[nowIndex.value]
|
|
||||||
// if (!item.videoUrl) {
|
|
||||||
// popupShow('pay', item, nowIndex.value)
|
|
||||||
// }
|
|
||||||
// cacheIndex = null
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if($common.isIos){
|
|
||||||
nowIndex.value = index
|
|
||||||
const item = props.list[nowIndex.value]
|
|
||||||
if (!item.videoUrl) {
|
|
||||||
popupShow('pay', item, nowIndex.value)
|
|
||||||
}
|
|
||||||
cacheIndex = null
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!initing) {
|
if (!initing) {
|
||||||
cacheIndex = index
|
cacheIndex = index
|
||||||
}
|
}
|
||||||
@@ -491,14 +469,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function disappear(e, item, index) {
|
function disappear(e, item, index) {
|
||||||
if ($common.isIos) {
|
|
||||||
if(e.direction=='up'){
|
|
||||||
cacheIndex=nowIndex.value-1<0?0:nowIndex.value-1
|
|
||||||
}else{
|
|
||||||
cacheIndex=(nowIndex.value+1>(props.list.length-1)) ? props.list.length-1:nowIndex.value+1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (index == nowIndex.value && cacheIndex !== null && !initing) {
|
if (index == nowIndex.value && cacheIndex !== null && !initing) {
|
||||||
console.log('disappear' + index);
|
console.log('disappear' + index);
|
||||||
console.log('disappear nowIndex' + nowIndex.value);
|
console.log('disappear nowIndex' + nowIndex.value);
|
||||||
@@ -606,9 +576,9 @@
|
|||||||
videoList.value[newCurrent] = item;
|
videoList.value[newCurrent] = item;
|
||||||
current.value = newCurrent;
|
current.value = newCurrent;
|
||||||
popupClose('show')
|
popupClose('show')
|
||||||
// #ifdef APP
|
if (showAndriod) {
|
||||||
goListPosition(index)
|
goListPosition(index)
|
||||||
// #endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let refList = ref([])
|
let refList = ref([])
|
||||||
@@ -726,12 +696,12 @@
|
|||||||
let item = props.list.find(v => props.options.courseDetailsId == v.courseDetailsId)
|
let item = props.list.find(v => props.options.courseDetailsId == v.courseDetailsId)
|
||||||
item = item ? item : props.info.current;
|
item = item ? item : props.info.current;
|
||||||
if (JSON.stringify(item) !== '{}') {
|
if (JSON.stringify(item) !== '{}') {
|
||||||
if(showAndriod){
|
if (showAndriod) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const index = props.list.findIndex(v => v.courseDetailsId == item.courseDetailsId)
|
const index = props.list.findIndex(v => v.courseDetailsId == item.courseDetailsId)
|
||||||
goListPosition(index)
|
goListPosition(index)
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
setVideoList(item)
|
setVideoList(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -916,7 +886,7 @@
|
|||||||
})
|
})
|
||||||
watch(() => props.list.length, (newval) => {
|
watch(() => props.list.length, (newval) => {
|
||||||
console.log('props.list.length change' + newval);
|
console.log('props.list.length change' + newval);
|
||||||
if(!showAndriod){
|
if (!showAndriod) {
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user