修改视频播放形式

This commit is contained in:
2024-12-18 09:13:24 +08:00
parent a291c2f629
commit 0636654dc2

View File

@@ -1,5 +1,6 @@
<template> <template>
<view> <view>
<swiper @longpress="openBs()" :style="{height:winHeight}" :circular="true" class="swipers" @change="change" <swiper @longpress="openBs()" :style="{height:winHeight}" :circular="true" class="swipers" @change="change"
:current="current" :vertical="true" :indicator-dots="false" :autoplay="false" :interval="0" :duration="1"> :current="current" :vertical="true" :indicator-dots="false" :autoplay="false" :interval="0" :duration="1">
<swiper-item class="swipers-item" v-for="(item,index) in swiperList" :key="item.courseDetailsId"> <swiper-item class="swipers-item" v-for="(item,index) in swiperList" :key="item.courseDetailsId">
@@ -9,7 +10,7 @@
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<!-- wxUrl --> <!-- wxUrl -->
<video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" @timeupdate="timeupdate" <video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" @timeupdate="timeupdate"
@waiting="waiting()" object-fit="contain" v-if="current === index && item.videoUrl" @waiting="waiting()" object-fit="cover" v-if="current === index && item.videoUrl"
:play-strategy="2" :show-loading="true" codec="software" :muted="false" :play-strategy="2" :show-loading="true" codec="software" :muted="false"
:show-center-play-btn="true" :loop="false" @ended="ended" :show-center-play-btn="true" :loop="false" @ended="ended"
@play="videoPlay('myVideo'+item.courseDetailsId)" :enable-progress-gesture="false" @play="videoPlay('myVideo'+item.courseDetailsId)" :enable-progress-gesture="false"
@@ -20,7 +21,7 @@
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<video :show-fullscreen-btn="false" @click.stop.prevent="isSelectType" :controls="true" <video :show-fullscreen-btn="false" @click.stop.prevent="isSelectType" :controls="true"
@controlstoggle="controlstoggles" @timeupdate="timeupdate" @waiting="waiting()" @controlstoggle="controlstoggles" @timeupdate="timeupdate" @waiting="waiting()"
object-fit="contain" v-if="current === index && item.videoUrl" :play-strategy="2" object-fit="cover" v-if="current === index && item.videoUrl" :play-strategy="2"
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="false" :show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="false"
@ended="ended" @play="videoPlay('myVideo'+item.courseDetailsId)" @ended="ended" @play="videoPlay('myVideo'+item.courseDetailsId)"
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId" :enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
@@ -305,7 +306,9 @@
var videoAd = null; var videoAd = null;
// #endif // #endif
import {returnIsSafari} from '@/utils/app.js' import {
returnIsSafari
} from '@/utils/app.js'
export default { export default {
components: { components: {
@@ -456,11 +459,11 @@
}, },
computed: { computed: {
listStyle() { listStyle() {
if(this.isSafari){ // if (this.isSafari) {
return { // return {
'min-height':'540rpx' // 'min-height': '540rpx'
} // }
} // }
return '' return ''
}, },
//当前视频是否可以看广告解锁 //当前视频是否可以看广告解锁
@@ -515,6 +518,7 @@
// #endif // #endif
}, },
onLoad(e) { onLoad(e) {
//在苹果系统微信小程序是否开启支付 //在苹果系统微信小程序是否开启支付
this.isWxIosPay = uni.getStorageSync('isWxIosPay') this.isWxIosPay = uni.getStorageSync('isWxIosPay')
@@ -742,6 +746,21 @@
// #ifndef MP-WEIXIN || MP-KUAISHOU // #ifndef MP-WEIXIN || MP-KUAISHOU
this.meunTop = 37 this.meunTop = 37
// #endif // #endif
// const windowResizeCallback = (res) => {
// console.log('变化后的窗口宽度=' + res.size.windowWidth)
// console.log('变化后的窗口高度=' + res.size.windowHeight)
// this.onResize(res)
// setTimeout(()=>{
// this.onResize(res)
// },500)
// }
// uni.onWindowResize(windowResizeCallback)
// #ifdef H5
// #endif
}, },
watch: { watch: {
//监听当前播放的集数 //监听当前播放的集数
@@ -784,6 +803,16 @@
}, },
}, },
methods: { methods: {
onResize(res) {
const sysInfo = uni.getSystemInfoSync()
//获取可是区域高度
const winHeight = sysInfo.windowHeight
if (winHeight && winHeight > 0) {
this.winHeight = winHeight + 'px'
} else {
this.winHeight = '100vh'
}
},
/** /**
* 获取金币比例 * 获取金币比例
*/ */
@@ -1871,9 +1900,11 @@
page { page {
background-color: #000; background-color: #000;
} }
::v-deep .u-drawer-content { ::v-deep .u-drawer-content {
// position: fixed; // position: fixed;
} }
.videoListCurr { .videoListCurr {
background-color: #ff7581 !important; background-color: #ff7581 !important;
color: #ffffff !important; color: #ffffff !important;
@@ -2035,6 +2066,8 @@
.swipers { .swipers {
width: 100%; width: 100%;
box-sizing: border-box;
overflow: hidden;
.swipers-item { .swipers-item {
width: 100%; width: 100%;