|
@@ -53,9 +53,11 @@
|
|
|
|
|
|
|
|
<!-- 主要内容区域 -->
|
|
<!-- 主要内容区域 -->
|
|
|
|
|
|
|
|
- <view class="content" :class="{ 'horizontal-content': isFocus==1, 'trailer-content': liveItem.status==1 }">
|
|
|
|
|
|
|
+ <view class="content"
|
|
|
|
|
+ :class="{ 'horizontal-content': isFocus==1, 'trailer-content': liveItem.status==1, 'fullscreen-mode': isFullscreen }">
|
|
|
<!-- 顶部信息栏 -->
|
|
<!-- 顶部信息栏 -->
|
|
|
- <view class="top-info-bar" v-if="!isFullscreen" :class="liveItem.showType == 1 ? 'horizontal-top' : ''">
|
|
|
|
|
|
|
+ <view class="top-info-bar" v-if="!isFullscreen"
|
|
|
|
|
+ :class="{'horizontal-top': liveItem.showType == 1,'hidden-on-fullscreen': isFullscreen}">
|
|
|
<view class="user-info-section">
|
|
<view class="user-info-section">
|
|
|
<image v-if="!scene&&liveItem.showType==2" @click="goBack" class="back-icon mr4"
|
|
<image v-if="!scene&&liveItem.showType==2" @click="goBack" class="back-icon mr4"
|
|
|
src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/return3.png" />
|
|
src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/return3.png" />
|
|
@@ -94,9 +96,11 @@
|
|
|
</view> -->
|
|
</view> -->
|
|
|
|
|
|
|
|
<!-- 视频区域 -->
|
|
<!-- 视频区域 -->
|
|
|
- <view class="videolist" v-if="liveItem.status == 2">
|
|
|
|
|
- <view class="video-container" :class="liveItem.showType == 1 ? 'horizontal-layout' : ''">
|
|
|
|
|
- <video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <view class="videolist" v-if="liveItem.status == 2" :class="isFullscreen ? 'screen' : ''">
|
|
|
|
|
+ <view class="video-container"
|
|
|
|
|
+ :class="{'horizontal-layout': liveItem.showType == 1,'fullscreen-mode': isFullscreen}">
|
|
|
|
|
+ <!-- <video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
|
|
|
:id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
|
|
:id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
|
|
|
object-fit="contain" :custom-cache="false" :enable-progress-gesture="false"
|
|
object-fit="contain" :custom-cache="false" :enable-progress-gesture="false"
|
|
|
vslide-gesture-in-fullscreen="true" :show-center-play-btn="false" :http-cache="false" loop
|
|
vslide-gesture-in-fullscreen="true" :show-center-play-btn="false" :http-cache="false" loop
|
|
@@ -104,39 +108,56 @@
|
|
|
@pause="onVideoPause" @play="onVideoPlay" @waiting="onVideoWaiting"
|
|
@pause="onVideoPause" @play="onVideoPlay" @waiting="onVideoWaiting"
|
|
|
:enable-play-gesture="false" :play-strategy="1" @dblclick="preventDoubleClick"
|
|
:enable-play-gesture="false" :play-strategy="1" @dblclick="preventDoubleClick"
|
|
|
preload="auto" :enable-stash-buffer="false" :stash-initial-size="0" :stash-max-size="0"
|
|
preload="auto" :enable-stash-buffer="false" :stash-initial-size="0" :stash-max-size="0"
|
|
|
- :stash-time="0" type="application/x-mpegURL" :controls="false" :show-fullscreen-btn="false"
|
|
|
|
|
|
|
+ :stash-time="0" type="application/x-mpegURL" :controls="false" :show-fullscreen-btn="true"
|
|
|
show-play-btn show-mute-btn enable-play-gesture="true"
|
|
show-play-btn show-mute-btn enable-play-gesture="true"
|
|
|
@fullscreenchange="onFullscreenChange" x5-video-player-fullscreen="true"
|
|
@fullscreenchange="onFullscreenChange" x5-video-player-fullscreen="true"
|
|
|
|
|
+ x5-video-player-type="h5" x5-video-orientation="landscape" :webkit-playsinline="false"
|
|
|
|
|
+ playsinline="false" :x5-playsinline="false">
|
|
|
|
|
+ </video> -->
|
|
|
|
|
+ <video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
|
|
|
|
|
+ :id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
|
|
|
|
|
+ object-fit="contain" :custom-cache="false" :enable-progress-gesture="false"
|
|
|
|
|
+ vslide-gesture-in-fullscreen="false" :show-center-play-btn="false" :http-cache="false" loop
|
|
|
|
|
+ @error="videoError" @timeupdate="onVideoTimeUpdate" @loadedmetadata="onVideoMetaLoaded"
|
|
|
|
|
+ @pause="onVideoPause" @play="onVideoPlay" @waiting="onVideoWaiting"
|
|
|
|
|
+ :enable-play-gesture="false" :play-strategy="1" @dblclick="preventDoubleClick"
|
|
|
|
|
+ preload="auto" :enable-stash-buffer="false" :stash-initial-size="0" :stash-max-size="0"
|
|
|
|
|
+ :stash-time="0" type="application/x-mpegURL" :controls="false" :show-fullscreen-btn="false"
|
|
|
|
|
+ show-play-btn show-mute-btn enable-play-gesture="true"
|
|
|
|
|
+ @fullscreenchange="onFullscreenChange" x5-video-player-fullscreen="false"
|
|
|
x5-video-player-type="h5" x5-video-orientation="landscape" :webkit-playsinline="true"
|
|
x5-video-player-type="h5" x5-video-orientation="landscape" :webkit-playsinline="true"
|
|
|
playsinline="true" :x5-playsinline="true">
|
|
playsinline="true" :x5-playsinline="true">
|
|
|
</video>
|
|
</video>
|
|
|
|
|
|
|
|
|
|
+ <view v-if="showCustomControls && liveItem.showType==1 && !isFullscreen" class="custom-controls"
|
|
|
|
|
+ @click.stop="toggleFullscreen">
|
|
|
|
|
+ <image src="/static/images/full_screen.png" class="control-icon" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
<!-- 全屏返回按钮 - 只在全屏状态下显示 -->
|
|
<!-- 全屏返回按钮 - 只在全屏状态下显示 -->
|
|
|
<view v-if="isFullscreen" class="fullscreen-exit-btn" @click="exitFullscreen">
|
|
<view v-if="isFullscreen" class="fullscreen-exit-btn" @click="exitFullscreen">
|
|
|
<image src="/static/images/half_screen.png" class="exit-fullscreen-icon" />
|
|
<image src="/static/images/half_screen.png" class="exit-fullscreen-icon" />
|
|
|
<text class="exit-text">退出全屏</text>
|
|
<text class="exit-text">退出全屏</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <!-- 全屏按钮 - 只在非全屏状态下显示 -->
|
|
|
|
|
- <view v-if="showCustomControls && liveItem.showType==1 && !isFullscreen" class="custom-controls"
|
|
|
|
|
- @click="toggleFullscreen">
|
|
|
|
|
- <image src="/static/images/full_screen.png" class="control-icon" />
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
|
|
|
<!-- 投诉按钮 -->
|
|
<!-- 投诉按钮 -->
|
|
|
- <view v-if="liveItem.showType==2" class="complaint-box"
|
|
|
|
|
|
|
+ <view v-if="liveItem.showType==2||isFullscreen" class="complaint-box"
|
|
|
|
|
+ :class="isFullscreen ? 'complaint-full' : ''"
|
|
|
@click="navgetTo('/pages_shopping/live/complaintList') ">
|
|
@click="navgetTo('/pages_shopping/live/complaintList') ">
|
|
|
<image class="image w32 h32 mr10" src="/static/images/complaint.png" mode="widthFix" />
|
|
<image class="image w32 h32 mr10" src="/static/images/complaint.png" mode="widthFix" />
|
|
|
<view class="fs26">投诉</view>
|
|
<view class="fs26">投诉</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 回放标签 -->
|
|
<!-- 回放标签 -->
|
|
|
- <view v-if="isPlayback" class="replay-label">回放</view>
|
|
|
|
|
|
|
+ <view v-if="isPlayback" class="replay-label" :class="isFullscreen ? 'replay-full' : ''">回放
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 直播结束状态 -->
|
|
<!-- 直播结束状态 -->
|
|
|
<!-- v-if="liveItem.status == 3" -->
|
|
<!-- v-if="liveItem.status == 3" -->
|
|
|
<view class="videolist" v-if="liveItem.status == 3">
|
|
<view class="videolist" v-if="liveItem.status == 3">
|
|
|
- <view class="video-container" :class="liveItem.showType == 1 ? 'horizontal-layout' : ''">
|
|
|
|
|
|
|
+ <view class="video-container"
|
|
|
|
|
+ :class="{'horizontal-layout': liveItem.showType == 1, 'fullscreen-mode': isFullscreen}">
|
|
|
<view class="live-end-message">直播已结束</view>
|
|
<view class="live-end-message">直播已结束</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -155,8 +176,8 @@
|
|
|
<view v-if="liveItem.videoUrl && liveItem.liveType == 3" class="replay-label">直播回放</view>
|
|
<view v-if="liveItem.videoUrl && liveItem.liveType == 3" class="replay-label">直播回放</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="slide-group">
|
|
|
|
|
- <view class="action-button-group" v-if="!isFocus">
|
|
|
|
|
|
|
+ <view class="slide-group" v-if="!isFocus && !isFullscreen">
|
|
|
|
|
+ <view class="action-button-group">
|
|
|
<view :class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20']">
|
|
<view :class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20']">
|
|
|
<button open-type="share" class="action-icon button-reset">
|
|
<button open-type="share" class="action-icon button-reset">
|
|
|
<image class="action-icon"
|
|
<image class="action-icon"
|
|
@@ -165,7 +186,7 @@
|
|
|
</button>
|
|
</button>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="action-button-group" v-if="!isFocus">
|
|
|
|
|
|
|
+ <view class="action-button-group">
|
|
|
<view
|
|
<view
|
|
|
:class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20','like-container']"
|
|
:class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20','like-container']"
|
|
|
@click="onLike">
|
|
@click="onLike">
|
|
@@ -235,7 +256,7 @@
|
|
|
:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
|
|
:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
|
|
|
cursor-spacing="100" :adjust-position="false" :disabled="isEnd" />
|
|
cursor-spacing="100" :adjust-position="false" :disabled="isEnd" />
|
|
|
<!-- v-if="isFocus&&!isIOS" -->
|
|
<!-- v-if="isFocus&&!isIOS" -->
|
|
|
- <view class="send-button" :class="liveItem.showType == 1 ? 'send2' : ''" @click="sendMsg()">
|
|
|
|
|
|
|
+ <view class="send-button" v-if="!isIOS" :class="liveItem.showType == 1 ? 'send2' : ''" @click="sendMsg()">
|
|
|
发送</view>
|
|
发送</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- :class="{ 'action-buttons-hidden': isFocus }" -->
|
|
<!-- :class="{ 'action-buttons-hidden': isFocus }" -->
|
|
@@ -267,7 +288,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 商品卡片 -->
|
|
<!-- 商品卡片 -->
|
|
|
- <view class="goods-card" v-if="isShowGoods" @click.stop="goShop(goodsCard.productId, goodsCard.goodsId)">
|
|
|
|
|
|
|
+ <view class="goods-card" v-if="isShowGoods&&!isFullscreen"
|
|
|
|
|
+ @click.stop="goShop(goodsCard.productId, goodsCard.goodsId)">
|
|
|
<view class="goods-card-header">
|
|
<view class="goods-card-header">
|
|
|
<view class="goods-status">
|
|
<view class="goods-status">
|
|
|
<image class="status-icon mr8"
|
|
<image class="status-icon mr8"
|
|
@@ -707,6 +729,9 @@
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
isFullscreen: false,
|
|
isFullscreen: false,
|
|
|
|
|
+ isVideoRotated: false,
|
|
|
|
|
+ showNonVideoElementsFlag: true,
|
|
|
|
|
+
|
|
|
isMuted: false,
|
|
isMuted: false,
|
|
|
showCustomControls: true,
|
|
showCustomControls: true,
|
|
|
videoContext: null,
|
|
videoContext: null,
|
|
@@ -879,7 +904,7 @@
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
async onLoad(options) {
|
|
async onLoad(options) {
|
|
|
- this.toggleFullscreen()
|
|
|
|
|
|
|
+
|
|
|
this.initTime()
|
|
this.initTime()
|
|
|
this.getLocationByIP();
|
|
this.getLocationByIP();
|
|
|
if (options.liveId) {
|
|
if (options.liveId) {
|
|
@@ -1123,7 +1148,15 @@
|
|
|
query: 'companyId=-2&companyUserId=' + this.userInfo.userId + '&liveId=' + this.liveId
|
|
query: 'companyId=-2&companyUserId=' + this.userInfo.userId + '&liveId=' + this.liveId
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
- computed: {
|
|
|
|
|
|
|
+ computed: { // 控制是否显示非视频元素
|
|
|
|
|
+ shouldShowNonVideoElements() {
|
|
|
|
|
+ return !this.isFullscreen && this.showNonVideoElementsFlag;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 控制是否显示全屏按钮
|
|
|
|
|
+ shouldShowFullscreenButton() {
|
|
|
|
|
+ return this.liveItem.showType == 1 && !this.isFullscreen;
|
|
|
|
|
+ },
|
|
|
...mapGetters(['coureLogin']),
|
|
...mapGetters(['coureLogin']),
|
|
|
appid() {
|
|
appid() {
|
|
|
return this.$store.state.appid
|
|
return this.$store.state.appid
|
|
@@ -1275,11 +1308,13 @@
|
|
|
// 清理大数据和状态
|
|
// 清理大数据和状态
|
|
|
this.clearBigData();
|
|
this.clearBigData();
|
|
|
this.resetAllStates();
|
|
this.resetAllStates();
|
|
|
- // 清理屏幕方向锁定
|
|
|
|
|
|
|
+ // 解锁屏幕方向
|
|
|
this.unlockOrientation();
|
|
this.unlockOrientation();
|
|
|
|
|
|
|
|
- // 移除屏幕方向监听
|
|
|
|
|
- this.removeOrientationChangeListener();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 强制退出全屏
|
|
|
|
|
+ this.isFullscreen = false;
|
|
|
|
|
+ this.showCustomControls = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -1327,25 +1362,19 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: { // 退出全屏
|
|
methods: { // 退出全屏
|
|
|
|
|
+ // 退出全屏
|
|
|
exitFullscreen() {
|
|
exitFullscreen() {
|
|
|
- console.log('退出全屏按钮被点击');
|
|
|
|
|
|
|
+ console.log('执行退出全屏');
|
|
|
|
|
+ this.isFullscreen = false;
|
|
|
|
|
|
|
|
- if (!this.videoContext) {
|
|
|
|
|
- console.log('创建 videoContext');
|
|
|
|
|
- this.videoContext = uni.createVideoContext(`myVideo_${this.liveId}`, this);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 恢复竖屏样式
|
|
|
|
|
+ this.restoreVideoList();
|
|
|
|
|
|
|
|
- if (!this.videoContext) {
|
|
|
|
|
- console.error('videoContext 创建失败');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 显示非videolist元素
|
|
|
|
|
+ this.showNonVideoElements();
|
|
|
|
|
|
|
|
- if (this.isFullscreen) {
|
|
|
|
|
- console.log('执行退出全屏操作');
|
|
|
|
|
- this.videoContext.exitFullScreen();
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log('当前不是全屏状态,无需退出');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 强制页面重排
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
},
|
|
},
|
|
|
// 添加屏幕方向变化监听
|
|
// 添加屏幕方向变化监听
|
|
|
addOrientationChangeListener() {
|
|
addOrientationChangeListener() {
|
|
@@ -1361,23 +1390,27 @@
|
|
|
}
|
|
}
|
|
|
}, // 处理屏幕方向变化
|
|
}, // 处理屏幕方向变化
|
|
|
handleOrientationChange() {
|
|
handleOrientationChange() {
|
|
|
- const orientation = window.orientation;
|
|
|
|
|
- console.log('屏幕方向变化:', orientation);
|
|
|
|
|
-
|
|
|
|
|
- // 0: 竖屏
|
|
|
|
|
- // 90: 横屏(向左转)
|
|
|
|
|
- // -90: 横屏(向右转)
|
|
|
|
|
- // 180: 倒置(很少用)
|
|
|
|
|
-
|
|
|
|
|
- if (this.isFullscreen && Math.abs(orientation) !== 90) {
|
|
|
|
|
- // 全屏状态下,如果不是横屏,尝试退出全屏
|
|
|
|
|
- console.log('全屏状态下屏幕方向不正确,尝试退出全屏');
|
|
|
|
|
- if (this.videoContext) {
|
|
|
|
|
- this.videoContext.exitFullScreen();
|
|
|
|
|
|
|
+ // 在小程序中,使用 uni.onWindowResize 或 uni.onDeviceOrientationChange
|
|
|
|
|
+ uni.onWindowResize((res) => {
|
|
|
|
|
+ const windowWidth = res.size.windowWidth;
|
|
|
|
|
+ const windowHeight = res.size.windowHeight;
|
|
|
|
|
+ const isLandscape = windowWidth > windowHeight;
|
|
|
|
|
+
|
|
|
|
|
+ if (this.isFullscreen && !isLandscape) {
|
|
|
|
|
+ console.log('全屏状态下屏幕方向不正确,尝试退出全屏');
|
|
|
|
|
+ if (this.videoContext) {
|
|
|
|
|
+ this.videoContext.exitFullScreen();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ }, // 恢复videolist盒子
|
|
|
|
|
+ restoreVideoList() {
|
|
|
|
|
+ this.isVideoRotated = false;
|
|
|
|
|
+ this.isFullscreen = false;
|
|
|
|
|
+ console.log('恢复视频容器竖屏状态');
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// 强制横屏全屏(备用方案)
|
|
// 强制横屏全屏(备用方案)
|
|
|
forceLandscapeFullscreen() {
|
|
forceLandscapeFullscreen() {
|
|
|
// 尝试多种全屏方式
|
|
// 尝试多种全屏方式
|
|
@@ -1433,76 +1466,133 @@
|
|
|
// 切换全屏
|
|
// 切换全屏
|
|
|
// 切换全屏
|
|
// 切换全屏
|
|
|
toggleFullscreen() {
|
|
toggleFullscreen() {
|
|
|
- console.log('全屏按钮被点击');
|
|
|
|
|
|
|
+ console.log('自定义全屏按钮被点击');
|
|
|
|
|
|
|
|
- // 确保 videoContext 存在
|
|
|
|
|
- if (!this.videoContext) {
|
|
|
|
|
- console.log('创建 videoContext');
|
|
|
|
|
- this.videoContext = uni.createVideoContext(`myVideo_${this.liveId}`, this);
|
|
|
|
|
|
|
+ if (this.isFullscreen) {
|
|
|
|
|
+ // 退出全屏
|
|
|
|
|
+ this.exitFullscreen();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 进入全屏
|
|
|
|
|
+ this.enterFullscreen();
|
|
|
}
|
|
}
|
|
|
|
|
+ }, // 进入全屏
|
|
|
|
|
+ enterFullscreen() {
|
|
|
|
|
+ console.log('执行进入全屏');
|
|
|
|
|
+ this.isFullscreen = true;
|
|
|
|
|
|
|
|
- if (!this.videoContext) {
|
|
|
|
|
- console.error('videoContext 创建失败');
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // 设置横屏样式
|
|
|
|
|
+ this.rotateVideoList();
|
|
|
|
|
+
|
|
|
|
|
+ // 隐藏非videolist元素
|
|
|
|
|
+ this.hideNonVideoElements();
|
|
|
|
|
+
|
|
|
|
|
+ // 强制页面重排
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 强制全屏的备用方案
|
|
|
|
|
+ forceFullscreen() {
|
|
|
|
|
+ console.log('使用备用方案进入全屏');
|
|
|
|
|
+
|
|
|
|
|
+ const videoId = `myVideo_${this.liveId}`;
|
|
|
|
|
+
|
|
|
|
|
+ // 在小程序中,只能使用 videoContext
|
|
|
|
|
+ if (this.videoContext) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.videoContext.requestFullScreen({
|
|
|
|
|
+ direction: 90 // 横屏方向
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('请求全屏失败:', error);
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '无法全屏播放,请尝试手动横屏',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }, // 隐藏非videolist元素
|
|
|
|
|
+ hideNonVideoElements() {
|
|
|
|
|
+ this.showNonVideoElementsFlag = false;
|
|
|
|
|
+ console.log('隐藏非视频元素');
|
|
|
|
|
+ },
|
|
|
|
|
+ // 显示非videolist元素
|
|
|
|
|
+ showNonVideoElements() {
|
|
|
|
|
+ this.showNonVideoElementsFlag = true;
|
|
|
|
|
+ console.log('显示非视频元素');
|
|
|
|
|
+ }, // 防止默认全屏事件
|
|
|
|
|
+ onFullscreenChange(e) {
|
|
|
|
|
+ // 阻止默认全屏行为
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
|
|
|
- if (this.isFullscreen) {
|
|
|
|
|
- this.exitFullscreen();
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log('请求全屏(横屏模式)');
|
|
|
|
|
- this.videoContext.requestFullScreen({
|
|
|
|
|
- direction: 90 // 90表示横屏,0是竖屏
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // 如果有video进入全屏,立即退出
|
|
|
|
|
+ if (e.detail && e.detail.fullScreen) {
|
|
|
|
|
+ const videoContext = uni.createVideoContext(`myVideo_${this.liveId}`, this);
|
|
|
|
|
+ if (videoContext) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ videoContext.exitFullScreen();
|
|
|
|
|
+ }, 100);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 旋转videolist盒子
|
|
|
|
|
+ rotateVideoList() {
|
|
|
|
|
+ // 在小程序中,通过设置CSS类名来控制样式,而不是直接操作DOM
|
|
|
|
|
+ this.isVideoRotated = true;
|
|
|
|
|
+ this.isFullscreen = true;
|
|
|
|
|
+
|
|
|
|
|
+ // 在小程序中,应该通过绑定class的方式控制样式
|
|
|
|
|
+ // 而不是直接操作DOM
|
|
|
|
|
+ console.log('视频容器旋转到横屏状态');
|
|
|
},
|
|
},
|
|
|
// 全屏状态变化监听
|
|
// 全屏状态变化监听
|
|
|
- // 加强 onFullscreenChange 方法
|
|
|
|
|
- // onFullscreenChange(e) {
|
|
|
|
|
- // console.log('全屏状态变化事件:', e);
|
|
|
|
|
|
|
|
|
|
- // // 确保正确获取状态
|
|
|
|
|
- // const isFullScreen = e.detail && e.detail.fullScreen;
|
|
|
|
|
- // console.log('全屏状态:', isFullScreen);
|
|
|
|
|
|
|
+ onFullscreenChange(e) {
|
|
|
|
|
+ console.log('全屏状态变化事件详情:', e);
|
|
|
|
|
|
|
|
- // this.isFullscreen = isFullScreen;
|
|
|
|
|
|
|
+ // 方法1:通过事件参数获取(小程序主要方式)
|
|
|
|
|
+ let fullScreen = false;
|
|
|
|
|
|
|
|
- // // 全屏时隐藏自定义控制条
|
|
|
|
|
- // this.showCustomControls = !this.isFullscreen;
|
|
|
|
|
|
|
+ // 视频组件的全屏事件参数
|
|
|
|
|
+ if (e.detail && typeof e.detail.fullScreen !== 'undefined') {
|
|
|
|
|
+ fullScreen = e.detail.fullScreen;
|
|
|
|
|
+ console.log('通过e.detail.fullScreen获取全屏状态:', fullScreen);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他可能的参数名
|
|
|
|
|
+ else if (e.detail && typeof e.detail.fullscreen !== 'undefined') {
|
|
|
|
|
+ fullScreen = e.detail.fullscreen;
|
|
|
|
|
+ console.log('通过e.detail.fullscreen获取全屏状态:', fullScreen);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 方法2:检测横屏(备用)
|
|
|
|
|
+ else {
|
|
|
|
|
+ // 在小程序环境中,可以通过屏幕方向判断
|
|
|
|
|
+ try {
|
|
|
|
|
+ const systemInfo = uni.getSystemInfoSync();
|
|
|
|
|
+ fullScreen = systemInfo.windowWidth > systemInfo.windowHeight;
|
|
|
|
|
+ console.log('通过屏幕方向判断全屏状态:', fullScreen);
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error('获取系统信息失败:', err);
|
|
|
|
|
+ // 默认使用事件参数
|
|
|
|
|
+ fullScreen = e.detail || false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // // 强制更新UI
|
|
|
|
|
- // this.$forceUpdate();
|
|
|
|
|
|
|
+ this.isFullscreen = fullScreen;
|
|
|
|
|
+ console.log('最终设置isFullscreen为:', this.isFullscreen);
|
|
|
|
|
|
|
|
- // // 调试输出
|
|
|
|
|
- // console.log('isFullscreen:', this.isFullscreen);
|
|
|
|
|
- // console.log('showCustomControls:', this.showCustomControls);
|
|
|
|
|
- // },
|
|
|
|
|
- onFullscreenChange(e) {
|
|
|
|
|
- const videoContainer = e.target.parentNode; // 获取视频父容器
|
|
|
|
|
- const isFullscreen = document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
|
|
|
|
|
-
|
|
|
|
|
- if (isFullscreen) {
|
|
|
|
|
- // 进入全屏:让图标容器也进入全屏,确保层级
|
|
|
|
|
- if (videoContainer.requestFullscreen) {
|
|
|
|
|
- videoContainer.requestFullscreen();
|
|
|
|
|
- } else if (videoContainer.webkitRequestFullscreen) {
|
|
|
|
|
- videoContainer.webkitRequestFullscreen();
|
|
|
|
|
- } else if (videoContainer.msRequestFullscreen) {
|
|
|
|
|
- videoContainer.msRequestFullscreen();
|
|
|
|
|
- }
|
|
|
|
|
- // 适配x5内核(微信等)
|
|
|
|
|
- document.documentElement.style.webkitTouchCallout = 'none';
|
|
|
|
|
- document.documentElement.style.webkitUserSelect = 'none';
|
|
|
|
|
- } else {
|
|
|
|
|
- // 退出全屏:退出容器的全屏
|
|
|
|
|
- if (document.exitFullscreen) {
|
|
|
|
|
- document.exitFullscreen();
|
|
|
|
|
- } else if (document.webkitExitFullscreen) {
|
|
|
|
|
- document.webkitExitFullscreen();
|
|
|
|
|
- } else if (document.msExitFullscreen) {
|
|
|
|
|
- document.msExitFullscreen();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 根据全屏状态显示/隐藏自定义控件
|
|
|
|
|
+ this.showCustomControls = !this.isFullscreen;
|
|
|
|
|
+
|
|
|
|
|
+ // 强制UI更新
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+
|
|
|
|
|
+ // 全屏时锁定横屏
|
|
|
|
|
+ if (this.isFullscreen) {
|
|
|
|
|
+ this.lockOrientation();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.unlockOrientation();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 锁定屏幕方向为横屏
|
|
// 锁定屏幕方向为横屏
|
|
|
lockOrientation() {
|
|
lockOrientation() {
|
|
|
// 设置屏幕方向为横屏
|
|
// 设置屏幕方向为横屏
|
|
@@ -4176,15 +4266,6 @@
|
|
|
// 使用单次nextTick确保DOM更新后再滚动
|
|
// 使用单次nextTick确保DOM更新后再滚动
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.forceScrollToBottomOnSend();
|
|
this.forceScrollToBottomOnSend();
|
|
|
- // if (isMyMessage) {
|
|
|
|
|
- // // 如果是自己发送的消息,强制滚动到底部
|
|
|
|
|
- // console.log('自己的消息,执行强制滚动');
|
|
|
|
|
- // this.forceScrollToBottomOnSend();
|
|
|
|
|
- // } else {
|
|
|
|
|
- // // 如果是他人的消息,使用普通滚动(有防抖)
|
|
|
|
|
- // console.log('他人的消息,执行普通滚动');
|
|
|
|
|
- // this.simpleScrollToBottom();
|
|
|
|
|
- // }
|
|
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 处理Socket消息
|
|
// 处理Socket消息
|
|
@@ -4506,32 +4587,33 @@
|
|
|
}
|
|
}
|
|
|
console.log("qxj userTotal", userTotal);
|
|
console.log("qxj userTotal", userTotal);
|
|
|
return userTotal;
|
|
return userTotal;
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
|
+ /* 退出全屏按钮 */
|
|
|
.fullscreen-exit-btn {
|
|
.fullscreen-exit-btn {
|
|
|
- position: absolute;
|
|
|
|
|
- bottom: 120rpx;
|
|
|
|
|
- right: 40rpx;
|
|
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ bottom: 40rpx;
|
|
|
|
|
+ left: 82vh;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
- z-index: 99999;
|
|
|
|
|
- background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
|
|
+ z-index: 100001;
|
|
|
|
|
+ background: rgba(57, 57, 57, 0.6);
|
|
|
border-radius: 40rpx;
|
|
border-radius: 40rpx;
|
|
|
padding: 20rpx 24rpx;
|
|
padding: 20rpx 24rpx;
|
|
|
transition: all 0.3s ease;
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
&:active {
|
|
&:active {
|
|
|
transform: scale(0.95);
|
|
transform: scale(0.95);
|
|
|
- background: rgba(0, 0, 0, 0.8);
|
|
|
|
|
|
|
+ background: rgba(50, 50, 50, 0.6);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.exit-fullscreen-icon {
|
|
.exit-fullscreen-icon {
|
|
@@ -4547,83 +4629,62 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 全屏时的样式调整
|
|
|
|
|
|
|
+ .video-container.fullscreen-mode .fullscreen-exit-btn {
|
|
|
|
|
+ z-index: 999999 !important;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* 全屏模式样式 */
|
|
|
.video-container.fullscreen-mode {
|
|
.video-container.fullscreen-mode {
|
|
|
- position: fixed;
|
|
|
|
|
- top: 0;
|
|
|
|
|
- left: 0;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- z-index: 999999;
|
|
|
|
|
- background-color: #000;
|
|
|
|
|
|
|
+ width: auto !important;
|
|
|
|
|
+ height: auto !important;
|
|
|
|
|
+ z-index: 99999 !important;
|
|
|
|
|
+ background-color: #000 !important;
|
|
|
|
|
+ transform: rotate(90deg) !important;
|
|
|
|
|
+ transform-origin: center center !important;
|
|
|
|
|
|
|
|
.video-player {
|
|
.video-player {
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .custom-controls {
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- bottom: 42rpx;
|
|
|
|
|
- right: 20rpx;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- z-index: 9999;
|
|
|
|
|
- background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
- border-radius: 40rpx;
|
|
|
|
|
- padding: 10rpx 20rpx;
|
|
|
|
|
- transition: all 0.3s ease;
|
|
|
|
|
-
|
|
|
|
|
- // 全屏状态下的样式调整
|
|
|
|
|
- .fullscreen-mode & {
|
|
|
|
|
- display: none;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- &:active {
|
|
|
|
|
- transform: scale(0.95);
|
|
|
|
|
- background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
- opacity: 0.8;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ width: 100vh !important;
|
|
|
|
|
+ height: 100vw !important;
|
|
|
|
|
+ object-fit: contain !important;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 全屏时其他元素隐藏
|
|
|
|
|
- .complaint-box,
|
|
|
|
|
- .replay-label {
|
|
|
|
|
- display: none;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /* 全屏时隐藏其他元素 */
|
|
|
|
|
+ .video-container.fullscreen-mode~* {
|
|
|
|
|
+ display: none !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.video-container {
|
|
.video-container {
|
|
|
- position: relative;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- /* 根据需要调整 */
|
|
|
|
|
|
|
+ transition: all 0.3s ease;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .video-player {
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
|
|
+ .video-player.fullscreen {
|
|
|
|
|
+ width: 100vh !important;
|
|
|
|
|
+ height: 100vw !important;
|
|
|
|
|
+ object-fit: contain !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /* 全屏按钮样式优化 */
|
|
|
.custom-controls {
|
|
.custom-controls {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- bottom: 42rpx;
|
|
|
|
|
- /* 调整位置,避免被其他元素覆盖 */
|
|
|
|
|
- right: 20rpx;
|
|
|
|
|
|
|
+ bottom: 60rpx;
|
|
|
|
|
+ right: 40rpx;
|
|
|
|
|
+ z-index: 9999;
|
|
|
|
|
+ background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
+ border-radius: 50%;
|
|
|
|
|
+ width: 80rpx;
|
|
|
|
|
+ height: 80rpx;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- z-index: 9999;
|
|
|
|
|
- /* 确保在最上层 */
|
|
|
|
|
- background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
- border-radius: 40rpx;
|
|
|
|
|
- padding: 10rpx 20rpx;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ transition: all 0.3s ease;
|
|
|
|
|
|
|
|
- /* 优化全屏按钮样式 */
|
|
|
|
|
- .custom-controls:active {
|
|
|
|
|
- transform: scale(0.95);
|
|
|
|
|
- background: rgba(0, 0, 0, 0.6);
|
|
|
|
|
- opacity: 0.8;
|
|
|
|
|
|
|
+ &:active {
|
|
|
|
|
+ transform: scale(0.95);
|
|
|
|
|
+ background: rgba(0, 0, 0, 0.8);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.control-icon {
|
|
.control-icon {
|
|
@@ -4631,7 +4692,7 @@
|
|
|
height: 46rpx;
|
|
height: 46rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@media screen and (orientation: landscape) {
|
|
@media screen and (orientation: landscape) {
|
|
|
.video-container.horizontal-layout {
|
|
.video-container.horizontal-layout {
|
|
@@ -4639,10 +4700,10 @@
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .video-player {
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // .video-player {
|
|
|
|
|
+ // width: 100vh !important;
|
|
|
|
|
+ // height: 100vw !important;
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -4952,6 +5013,11 @@
|
|
|
height: var(--video-height);
|
|
height: var(--video-height);
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
+ &.screen {
|
|
|
|
|
+ width: 100vw;
|
|
|
|
|
+ height: 100vh;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.video-container {
|
|
.video-container {
|
|
|
height: var(--video-height);
|
|
height: var(--video-height);
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -4975,11 +5041,21 @@
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
- background-color: rgba(77, 77, 77, 0.5);
|
|
|
|
|
|
|
+ background-color: rgba(57, 57, 57, 0.6);
|
|
|
padding: 16rpx 0;
|
|
padding: 16rpx 0;
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
border-radius: 28rpx;
|
|
border-radius: 28rpx;
|
|
|
z-index: 999;
|
|
z-index: 999;
|
|
|
|
|
+
|
|
|
|
|
+ &.complaint-full {
|
|
|
|
|
+ top: 10rpx;
|
|
|
|
|
+ left: 82vh;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &:active {
|
|
|
|
|
+ transform: scale(0.95);
|
|
|
|
|
+ background: rgba(50, 50, 50, 0.6);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.txt {
|
|
.txt {
|
|
@@ -5010,10 +5086,17 @@
|
|
|
top: 15%;
|
|
top: 15%;
|
|
|
right: 24rpx;
|
|
right: 24rpx;
|
|
|
background-color: rgba(57, 57, 57, 0.6);
|
|
background-color: rgba(57, 57, 57, 0.6);
|
|
|
- padding: 6rpx 16rpx;
|
|
|
|
|
|
|
+ width: 100rpx;
|
|
|
|
|
+ height: 70rpx;
|
|
|
|
|
+ line-height: 70rpx;
|
|
|
|
|
+ text-align: center;
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
border-radius: 15rpx;
|
|
border-radius: 15rpx;
|
|
|
z-index: 1;
|
|
z-index: 1;
|
|
|
|
|
+
|
|
|
|
|
+ &.replay-full {
|
|
|
|
|
+ left: 82vh;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|