修改视频播放形式

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"
@@ -188,7 +189,7 @@
<!-- 购买视频 --> <!-- 购买视频 -->
<u-popup :closeable="true" :custom-style="customStyle" :safe-area-inset-bottom="true" close-icon="close" <u-popup :closeable="true" :custom-style="customStyle" :safe-area-inset-bottom="true" close-icon="close"
close-icon-size="30" close-icon-color="#333333" :mask-custom-style="maskCustomStyle" v-model="showPay" close-icon-size="30" close-icon-color="#333333" :mask-custom-style="maskCustomStyle" v-model="showPay"
border-radius="24" mode="bottom" > border-radius="24" mode="bottom">
<view class="list" :style="listStyle"> <view class="list" :style="listStyle">
<view class="list-title flex align-center"> <view class="list-title flex align-center">
<!-- <u-icon name="lock" class="list-title-icon" color="#efbb6b" size="40"></u-icon> --> <!-- <u-icon name="lock" class="list-title-icon" color="#efbb6b" size="40"></u-icon> -->
@@ -304,8 +305,10 @@
// #ifdef MP-WEIXIN || MP-TOUTIAO // #ifdef MP-WEIXIN || MP-TOUTIAO
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: {
@@ -314,7 +317,7 @@
}, },
data() { data() {
return { return {
isSafari:returnIsSafari(), isSafari: returnIsSafari(),
//记录未购买视频索引 //记录未购买视频索引
noBuyVideoIndex: null, noBuyVideoIndex: null,
//奖品列表 //奖品列表
@@ -455,12 +458,12 @@
} }
}, },
computed: { computed: {
listStyle(){ listStyle() {
if(this.isSafari){ // if (this.isSafari) {
return { // return {
'min-height':'540rpx' // 'min-height': '540rpx'
} // }
} // }
return '' return ''
}, },
//当前视频是否可以看广告解锁 //当前视频是否可以看广告解锁
@@ -473,7 +476,7 @@
}, },
// 移动视频信息的样式 // 移动视频信息的样式
tabBarStyle() { tabBarStyle() {
let style = { let style = {
// 滑块在页面渲染后第一次滑动时,无需动画效果 // 滑块在页面渲染后第一次滑动时,无需动画效果
'transition-duration': `${1}s`, 'transition-duration': `${1}s`,
@@ -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: {
//监听当前播放的集数 //监听当前播放的集数
@@ -750,8 +769,8 @@
}, },
showControls(val) { showControls(val) {
//在没有播放视频权限的时候控制中心不隐藏 //在没有播放视频权限的时候控制中心不隐藏
const nowVideo=this.videoList[this.current] const nowVideo = this.videoList[this.current]
const videoUrl=nowVideo?nowVideo.videoUrl:'' const videoUrl = nowVideo ? nowVideo.videoUrl : ''
if (!videoUrl) { if (!videoUrl) {
this.showControls = true this.showControls = true
this.$forceUpdate() this.$forceUpdate()
@@ -772,18 +791,28 @@
// #ifdef H5 // #ifdef H5
let el = document.querySelector('.uni-video-bar'); let el = document.querySelector('.uni-video-bar');
console.log(el, '2222222') console.log(el, '2222222')
if(el){ if (el) {
if (val) { if (val) {
el.style = 'display:block !important;'; el.style = 'display:block !important;';
} else { } else {
el.style = 'display:none !important;'; el.style = 'display:none !important;';
} }
} }
// #endif // #endif
}, },
}, },
methods: { methods: {
onResize(res) {
const sysInfo = uni.getSystemInfoSync()
//获取可是区域高度
const winHeight = sysInfo.windowHeight
if (winHeight && winHeight > 0) {
this.winHeight = winHeight + 'px'
} else {
this.winHeight = '100vh'
}
},
/** /**
* 获取金币比例 * 获取金币比例
*/ */
@@ -1601,10 +1630,10 @@
console.log(this.noBuyVideoIndex); console.log(this.noBuyVideoIndex);
console.log(this.videoList); console.log(this.videoList);
if (this.noBuyVideoIndex !== null && this.noBuyVideoIndex !== if (this.noBuyVideoIndex !== null && this.noBuyVideoIndex !==
undefined && this.noBuyVideoIndex !== '' ) { undefined && this.noBuyVideoIndex !== '') {
console.log('获取转盘抽奖次数') console.log('获取转盘抽奖次数')
this.$Request.getT('app/discSpinning/drawCount').then(res => { this.$Request.getT('app/discSpinning/drawCount').then(res => {
console.log('转盘抽奖次数',res.count) console.log('转盘抽奖次数', res.count)
if (res.count >= 1) { if (res.count >= 1) {
uni.navigateTo({ uni.navigateTo({
url: '/me/choujiang/choujiang' url: '/me/choujiang/choujiang'
@@ -1627,8 +1656,8 @@
this.countPrice = this.videoList[this.current].price this.countPrice = this.videoList[this.current].price
this.showPay = true this.showPay = true
this.noBuyVideoIndex = this.current this.noBuyVideoIndex = this.current
} }
}) })
@@ -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;
@@ -1909,7 +1940,7 @@
padding: 16rpx 0; padding: 16rpx 0;
text-align: center; text-align: center;
} }
.bsActive { .bsActive {
background-color: #ffffff; background-color: #ffffff;
border-radius: 6rpx; border-radius: 6rpx;
@@ -2035,6 +2066,8 @@
.swipers { .swipers {
width: 100%; width: 100%;
box-sizing: border-box;
overflow: hidden;
.swipers-item { .swipers-item {
width: 100%; width: 100%;