|
|
@@ -2,18 +2,22 @@
|
|
|
<view class="swiper-wrapper" :class="liveItem.showType == 1 ? 'horizontal' : ''">
|
|
|
<view class="container">
|
|
|
<!-- 预告直播状态 -->
|
|
|
- <view class="trailer-box" v-if="liveItem.status == 1">
|
|
|
- <video v-if="liveItem.previewUrl" :id="`myVideo_${liveId}`" class="trailer-video"
|
|
|
- :src="liveItem.previewUrl" :autoplay="true" :loop="false" object-fit="contain" :custom-cache="false"
|
|
|
- :enable-progress-gesture="false" vslide-gesture-in-fullscreen="false" :show-center-play-btn="false"
|
|
|
- :http-cache="false" @error="videoError" @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause"
|
|
|
- @play="onVideoPlay" :disable-progress="true" :enable-play-gesture="true" @waiting="onVideoWaiting"
|
|
|
- preload="auto" type="application/x-mpegURL" :controls="false"></video>
|
|
|
+ <view :class="liveItem.previewUrl?'trailer-box':'trailer-box2'" v-if="liveItem.status == 1">
|
|
|
+ <view class="video-container2"
|
|
|
+ :style="{ paddingBottom:liveItem.previewUrl?videoRatio + '%':'' ,height:auto,width:'100%'}">
|
|
|
+ <video v-if="liveItem.previewUrl" :id="`myVideo_${liveId}`" class="trailer-video"
|
|
|
+ :src="liveItem.previewUrl" :autoplay="true" :loop="false"
|
|
|
+ :object-fit="isHeight?'contain':'fill'" :custom-cache="false" :enable-progress-gesture="false"
|
|
|
+ vslide-gesture-in-fullscreen="false" :show-center-play-btn="false" :http-cache="false"
|
|
|
+ @error="videoError" @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause"
|
|
|
+ @play="onVideoPlay" :disable-progress="true" :enable-play-gesture="true"
|
|
|
+ @waiting="onVideoWaiting" preload="auto" type="application/x-mpegURL" :controls="false"></video>
|
|
|
+ </view>
|
|
|
<image v-if="liveItem.status == 1 && !liveItem.previewUrl" class="trailer-placeholder"
|
|
|
- src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/no_live.png">
|
|
|
+ src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/readyStart.png">
|
|
|
</image>
|
|
|
<view class="countdown-container" v-if="liveItem.status == 1 && liveCountdown">
|
|
|
- <view class="live-name">{{ liveItem.liveName }}</view>
|
|
|
+ <view class="live-name" v-if="liveItem.previewUrl">{{ liveItem.liveName }}</view>
|
|
|
<view class="countdown-display">
|
|
|
<text class="countdown-label">距离开播还有</text>
|
|
|
<view class="countdown-unit">
|
|
|
@@ -31,13 +35,13 @@
|
|
|
</view>
|
|
|
<view class="trailer-actions">
|
|
|
<button open-type="share" class="button-reset share-button">
|
|
|
- <view class="action-button mr18" @click="handleAgreement">
|
|
|
+ <view class="action-button mr24" @click="handleAgreement">
|
|
|
<text>分享给好友</text>
|
|
|
</view>
|
|
|
</button>
|
|
|
|
|
|
<view class="action-button reserve-button" @click="handleAgreement">
|
|
|
- <image class="button-icon mr8" src="/static/images/trailer.png"></image>
|
|
|
+ <!-- <image class="button-icon mr8" src="/static/images/trailer.png"></image> -->
|
|
|
<text>预约直播</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -99,11 +103,12 @@
|
|
|
<text>{{ orderUser.count || 0 }}人正在去购买</text>
|
|
|
</view> -->
|
|
|
|
|
|
+
|
|
|
<!-- 视频区域 -->
|
|
|
|
|
|
<view class="videolist" v-if="liveItem.status == 2" :class="isFullscreen ? 'screen' : ''">
|
|
|
<view class="video-container"
|
|
|
- :style="{ paddingBottom: liveItem.showType==2||isFullscreen?'':videoRatio + '%',height:liveItem.showType==2?'100vh':'auto',width:isFullscreen?'0':'100%'}"
|
|
|
+ :style="{ paddingBottom: liveItem.showType==2||isFullscreen?'':videoRatio + '%',height:liveItem.showType==2?'100vh':isFullscreen?'auto':'400rpx',width:isFullscreen?'0':'100%'}"
|
|
|
: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"
|
|
|
@@ -121,8 +126,8 @@
|
|
|
</video> -->
|
|
|
<video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
|
|
|
:id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
|
|
|
- :style="{transform: `scale(${scale})`, transformOrigin: 'center center', bottom:isFullscreen?'0':''}"
|
|
|
- :object-fit="liveItem.showType==2?'contain':'fill'" :custom-cache="false"
|
|
|
+ :style="{transform:liveItem.showType!==2?`scale(${scale})`:'', transformOrigin: 'center center', bottom:isFullscreen?'0':''}"
|
|
|
+ :object-fit="liveItem.showType==2||isFullscreen?'contain':'fill'" :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"
|
|
|
@@ -157,7 +162,8 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 回放标签 -->
|
|
|
- <view v-if="isPlayback" class="replay-label" :style="{top:liveItem.showType === 2?'22%':isFullscreen?'':'10%',bottom:isFullscreen?'75vw':''}"
|
|
|
+ <view v-if="isPlayback" class="replay-label"
|
|
|
+ :style="{top:liveItem.showType === 2?'22%':isFullscreen?'':'10%',bottom:isFullscreen?'75vw':''}"
|
|
|
:class="isFullscreen? 'replay-full' : ''">回放
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -167,7 +173,7 @@
|
|
|
<view class="videolist" v-if="liveItem.status == 3">
|
|
|
<view class="video-container" style="height: 500rpx;"
|
|
|
:class="{'horizontal-layout': liveItem.showType == 1, 'fullscreen-mode': isFullscreen}">
|
|
|
- <view class="live-end-message">直播已结束</view>
|
|
|
+ <view class="live-end-message" :style="{marginTop:liveItem.showType === 2?'50%':''}">直播已结束</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -208,7 +214,8 @@
|
|
|
<!-- 底部聊天区域 -->
|
|
|
<view class="chat-area-container" :class="{
|
|
|
'chat-area-container2': liveItem.showType == 1,
|
|
|
- 'chat-area-container3': liveItem.status == 1,
|
|
|
+ 'chat-area-container3': liveItem.status == 1 && !liveItem.previewUrl && liveItem.showType == 1,
|
|
|
+ 'chat-area-container4': liveItem.status == 1 && liveItem.previewUrl && liveItem.showType == 1,
|
|
|
'chat-area-focused': isFocus
|
|
|
}" :style="{ '--keyboard-height': keyboardHeight + 'rpx' ,'display':isFullscreen?'none':''}">
|
|
|
<view class="tabs_bg" v-if="liveItem.showType == 1">
|
|
|
@@ -224,15 +231,15 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="chat-content-wrapper" :class="{ 'chat-content-focused': isFocus }">
|
|
|
- <view class="notice-message" v-if="!isFocus&&isShowNotice"
|
|
|
- :class="liveItem.showType == 1 ? 'horizontal-notice' : ''">
|
|
|
+ <view class="notice-message" v-if="isShowNotice"
|
|
|
+ :class="liveItem.showType == 1 ? 'horizontal-notice' : 'horizontal-notice2'">
|
|
|
公告消息: {{notice.msg}}
|
|
|
</view>
|
|
|
<scroll-view id="msgScroll" v-if="Array.isArray(talklist)" enable-flex scroll-y="true"
|
|
|
- :style="{ height: `calc(100% - ${commonViewHeight}px)`,marginTop:commonViewHeight+'px' }"
|
|
|
+ :style="{ height: liveItem.showType === 1?`calc(100% - ${commonViewHeight}px)`:liveItem.status == 1?'100%':'',marginTop:liveItem.showType === 1?commonViewHeight+'px':'' }"
|
|
|
:enhanced="true" :bounces="false" :show-scrollbar="false" :fast-deceleration="false"
|
|
|
:enable-back-to-top="false" class="message-scroll-view"
|
|
|
- :class="liveItem.status == 1 ? 'message-scroll2' : ''" :scroll-top="scrollTop"
|
|
|
+ :class="liveItem.status == 1 ? '' : ''" :scroll-top="scrollTop"
|
|
|
:scroll-into-view="scrollIntoView" @scroll="onScroll" ref="scrollView">
|
|
|
<view class="message-list" v-for="(item, talkIndex) in (talklist || [])"
|
|
|
:key="item.uniqueId " :id="`list_${item.uniqueId }`" v-show="item.cmd != 'red' ">
|
|
|
@@ -258,13 +265,15 @@
|
|
|
:placeholder-style="liveItem.showType == 1 ? 'color:#999999;' : 'color:#e7e7e7;'"
|
|
|
placeholder-class="placeholder-style" class="chat-input"
|
|
|
:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
|
|
|
- cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg" />
|
|
|
+ cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg"
|
|
|
+ :confirm-type="value?'send':'done'" />
|
|
|
|
|
|
- <input v-else :placeholder="placeholderText" v-model="value"
|
|
|
+ <input v-else :placeholder="placeholderText" v-model="value" type="text"
|
|
|
:placeholder-style="liveItem.showType == 1 ? 'color:#999999;' : 'color:#e7e7e7;'"
|
|
|
placeholder-class="placeholder-style" class="chat-input"
|
|
|
:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
|
|
|
- cursor-spacing="100" :adjust-position="false" :disabled="isEnd" />
|
|
|
+ cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg"
|
|
|
+ :confirm-type="value?'send':'done'" />
|
|
|
<!-- v-if="isFocus&&!isIOS" -->
|
|
|
<view class="send-button" v-if="!isIOS" :class="liveItem.showType == 1 ? 'send2' : ''"
|
|
|
@click="sendMsg()">
|
|
|
@@ -725,7 +734,9 @@
|
|
|
internetTraffic, // 流量(缓冲百分比),
|
|
|
liveInternetTraffic, // 直播流量(缓冲百分比),
|
|
|
loginByMp,
|
|
|
- getUserInfo
|
|
|
+ getUserInfo,
|
|
|
+ getIsAddKf,
|
|
|
+ liveWatchUser
|
|
|
} from '@/api/living.js';
|
|
|
import {
|
|
|
editUser
|
|
|
@@ -757,8 +768,9 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ urlOption:{},
|
|
|
menuButtonInfo: {}, // 胶囊按钮布局信息
|
|
|
-
|
|
|
+ isHeight: false,
|
|
|
isFullscreen: false,
|
|
|
isVideoRotated: false,
|
|
|
showNonVideoElementsFlag: true,
|
|
|
@@ -833,6 +845,11 @@
|
|
|
isOnload: false,
|
|
|
isConnecting: false, // 是否正在连接中
|
|
|
hasInitialized: false,
|
|
|
+ // 请求状态标记,防止重复请求
|
|
|
+ isLoadingLiveInfo: false, // 是否正在加载直播间信息
|
|
|
+ isLoadingVideo: false, // 是否正在加载视频资源
|
|
|
+ hasCheckedLogin: false, // 是否已检查登录状态
|
|
|
+ hasLoadedLocation: false, // 是否已加载位置信息
|
|
|
|
|
|
liveViewersData: [],
|
|
|
liveUserCalled: false, //调用过watchUserList没
|
|
|
@@ -904,6 +921,7 @@
|
|
|
shopping: false,
|
|
|
systemInfo: null, // 缓存系统信息,避免重复调用同步API
|
|
|
generatingTimer: null, //回访生成中
|
|
|
+ getlivingTimer: null, // getliving 防抖定时器
|
|
|
inputInfo: '',
|
|
|
showWelcomeMessage: false,
|
|
|
isShowGoods: false,
|
|
|
@@ -943,9 +961,20 @@
|
|
|
async onLoad(options) {
|
|
|
this.getMenuButtonInfo(); // 初始化获取胶囊信息
|
|
|
this.initTime()
|
|
|
- this.getLocationByIP();
|
|
|
+
|
|
|
+ // 解析参数
|
|
|
if (options.liveId) {
|
|
|
this.liveId = options.liveId;
|
|
|
+
|
|
|
+ }
|
|
|
+ if(options.qwUserId){
|
|
|
+ this.urlOption.companyId=options.companyId
|
|
|
+ this.urlOption.companyUserId=options.companyUserId
|
|
|
+ this.urlOption.corpId=options.corpId
|
|
|
+ this.urlOption.liveId=options.liveId
|
|
|
+ this.urlOption.qwUserId=options.qwUserId
|
|
|
+ this.urlOption.qwExternalId=options.externalId
|
|
|
+ this.urlOption.chatId=options.chatId
|
|
|
}
|
|
|
// 扫码传来的参数
|
|
|
if (options.scene) {
|
|
|
@@ -966,15 +995,30 @@
|
|
|
this.qrFrom = `&companyId=${options.companyId}&companyUserId=${options.companyUserId}`;
|
|
|
}
|
|
|
this.userinfo = uni.getStorageSync('userinfo');
|
|
|
- // this.userData = uni.getStorageSync('userData');
|
|
|
console.log('全部参数', options);
|
|
|
+
|
|
|
+ // 优先判断登录状态,然后加载数据
|
|
|
+ // this.userData = uni.getStorageSync('userData');
|
|
|
+
|
|
|
try {
|
|
|
const isLogin = await this.utils.checkLiveToken();
|
|
|
+ this.hasCheckedLogin = true;
|
|
|
if (isLogin) {
|
|
|
- this.haveLogin()
|
|
|
+ // 登录后:优先加载直播间信息,然后加载视频资源
|
|
|
+ await this.haveLogin();
|
|
|
+ } else {
|
|
|
+ // 未登录:先登录,登录成功后再加载数据
|
|
|
+ this.goLogin();
|
|
|
}
|
|
|
+
|
|
|
} catch (error) {
|
|
|
console.error('初始化失败:', error);
|
|
|
+ this.hasCheckedLogin = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 异步加载位置信息(不阻塞主流程)
|
|
|
+ if (!this.hasLoadedLocation) {
|
|
|
+ this.getLocationByIP();
|
|
|
}
|
|
|
//获取键盘高度 - 针对iPhone优化(使用缓存的系统信息)
|
|
|
uni.onKeyboardHeightChange((res) => {
|
|
|
@@ -1039,9 +1083,14 @@
|
|
|
// 初始化网络状态监听
|
|
|
this.initNetworkStatusListener();
|
|
|
},
|
|
|
- onPullDownRefresh() {
|
|
|
- this.getLiveMsg(this.liveItem);
|
|
|
- // this.getliveUser();
|
|
|
+ async onPullDownRefresh() {
|
|
|
+ // 下拉刷新时,重新加载数据
|
|
|
+ if (this.liveId) {
|
|
|
+ // 重置加载状态,允许重新加载
|
|
|
+ this.isLoadingLiveInfo = false;
|
|
|
+ await this.getliving(this.liveId);
|
|
|
+ await this.getLiveMsg(this.liveItem);
|
|
|
+ }
|
|
|
setTimeout(() => {
|
|
|
uni.stopPullDownRefresh();
|
|
|
}, 1000);
|
|
|
@@ -1065,18 +1114,26 @@
|
|
|
this.isIOS = systemInfo.platform === 'ios';
|
|
|
},
|
|
|
async onShow() {
|
|
|
- try {
|
|
|
- const isLogin = await this.utils.checkLiveToken();
|
|
|
- if (isLogin) {
|
|
|
- this.haveLogin()
|
|
|
- } else {
|
|
|
- this.goLogin();
|
|
|
+ // 如果还没有检查过登录状态,则检查(避免重复检查)
|
|
|
+ if (!this.hasCheckedLogin) {
|
|
|
+ try {
|
|
|
+ const isLogin = await this.utils.checkLiveToken();
|
|
|
+ this.hasCheckedLogin = true;
|
|
|
+ if (isLogin) {
|
|
|
+ await this.haveLogin();
|
|
|
+ } else {
|
|
|
+ this.goLogin();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('初始化失败:', error);
|
|
|
+ this.hasCheckedLogin = true;
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.error('初始化失败:', error);
|
|
|
}
|
|
|
|
|
|
- this.getLocationByIP();
|
|
|
+ // 位置信息只加载一次
|
|
|
+ if (!this.hasLoadedLocation) {
|
|
|
+ this.getLocationByIP();
|
|
|
+ }
|
|
|
|
|
|
this.uuId = generateRandomString(16);
|
|
|
const isLiveLogin = uni.getStorageSync('isLiveLogin');
|
|
|
@@ -1324,6 +1381,12 @@
|
|
|
// 关闭WebSocket连接(会自动清理相关资源)
|
|
|
this.closeWebSocket(true);
|
|
|
|
|
|
+ // 清除 getliving 防抖定时器
|
|
|
+ if (this.getlivingTimer) {
|
|
|
+ clearTimeout(this.getlivingTimer);
|
|
|
+ this.getlivingTimer = null;
|
|
|
+ }
|
|
|
+
|
|
|
// 清除所有定时器(使用增强清理)
|
|
|
this.clearAllTimersEnhanced();
|
|
|
|
|
|
@@ -1381,8 +1444,13 @@
|
|
|
return;
|
|
|
}
|
|
|
// 状态变化时,调用getliving更新直播间数据
|
|
|
- // console.log(`liveItem.status从${oldStatus}变为${newStatus},触发getliving请求`);
|
|
|
- this.getliving(this.liveId);
|
|
|
+ // 添加防抖,避免频繁请求
|
|
|
+ if (this.getlivingTimer) {
|
|
|
+ clearTimeout(this.getlivingTimer);
|
|
|
+ }
|
|
|
+ this.getlivingTimer = setTimeout(() => {
|
|
|
+ this.getliving(this.liveId);
|
|
|
+ }, 500); // 500ms 防抖
|
|
|
},
|
|
|
deep: true
|
|
|
},
|
|
|
@@ -1397,13 +1465,25 @@
|
|
|
immediate: true
|
|
|
},
|
|
|
'isShowNotice': {
|
|
|
- handler(newVal, oldVal) {
|
|
|
- setTimeout(() => {
|
|
|
- this.noticeHeightFun()
|
|
|
- }, 800)
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.noticeHeightFun()
|
|
|
+ }, 800)
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ 'notice.msg': {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ const newLength = newVal.length;
|
|
|
+ const oldLength = oldVal.length;
|
|
|
+ if (newLength !== oldLength) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.noticeHeightFun()
|
|
|
+ }, 800)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
noticeHeightFun() {
|
|
|
@@ -1748,6 +1828,11 @@
|
|
|
this.user.nickname = e.detail.value
|
|
|
},
|
|
|
async haveLogin() {
|
|
|
+ // 防止重复执行
|
|
|
+ if (this.isOnload) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
this.userInfo = uni.getStorageSync('userInfo');
|
|
|
if (this.userInfo) {
|
|
|
await this.getUserInfo();
|
|
|
@@ -1755,13 +1840,19 @@
|
|
|
|
|
|
// this.initTime();
|
|
|
if (this.liveId) {
|
|
|
- // 先获取直播间信息
|
|
|
+ // 优先加载直播间信息(包含视频资源URL)
|
|
|
await this.getliving(this.liveId);
|
|
|
this.isOnload = true;
|
|
|
|
|
|
- await this.getLiveMsg(this.liveItem);
|
|
|
- await this.getliveViewData();
|
|
|
- // await this.getliving(this.liveId);
|
|
|
+ // 然后加载其他数据(并行执行,不阻塞视频加载)
|
|
|
+ Promise.all([
|
|
|
+ this.getLiveMsg(this.liveItem),
|
|
|
+ this.getliveViewData()
|
|
|
+ ]).catch(err => {
|
|
|
+ console.error('加载数据失败:', err);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 其他非关键数据异步加载
|
|
|
this.getCurrentActivities();
|
|
|
this.getliveOrder();
|
|
|
this.initSocket();
|
|
|
@@ -1812,7 +1903,9 @@
|
|
|
this.haveLogin()
|
|
|
this.userlogo = true
|
|
|
// console.log("TOKEN_KEYAuto",TOKEN_KEYAuto)
|
|
|
- // this.getIsAddKf()
|
|
|
+ if(this.urlOption.qwUserId){
|
|
|
+ this.getIsAddKf() //this.getIsAddKf()
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
@@ -1831,8 +1924,60 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // liveWatchUser(){
|
|
|
+ // var data={
|
|
|
+ // qwUserId:this.urlOption.qwUserId,
|
|
|
+ // liveId:this.urlOption.liveId,
|
|
|
+ // userId:this.userInfo.userId,
|
|
|
+ // corpId:this.urlOption.corpId,
|
|
|
+ // companyUserId:this.urlOption.companyUserId,
|
|
|
+ // qwExternalId:this.urlOption.qwExternalId,
|
|
|
+ // companyId:this.urlOption.companyId,
|
|
|
+ // chatId:this.urlOption.chatId,
|
|
|
+ // }
|
|
|
+ // liveWatchUser(data).then(
|
|
|
+ // res => {
|
|
|
+ // if (res.code == 200) {
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: 'none',
|
|
|
+ // title: res.msg,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // rej => {}
|
|
|
+ // );
|
|
|
+ // },
|
|
|
+ // 客服
|
|
|
+ getIsAddKf() {
|
|
|
+ // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
|
|
|
+ getIsAddKf(this.urlOption).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.isAddKf = 1
|
|
|
+ //this.getH5CourseVideoDetails()
|
|
|
+ } else if (res.code == 401) {
|
|
|
+ this.isAddKf = 0
|
|
|
+ this.goLogin();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {}
|
|
|
+ );
|
|
|
+ },
|
|
|
clickTabs(item) {},
|
|
|
getLocationByIP() {
|
|
|
+ // 防止重复请求
|
|
|
+ if (this.hasLoadedLocation) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.hasLoadedLocation = true;
|
|
|
+
|
|
|
// 高德IP定位API,需要替换成你的key
|
|
|
const key = '4e13632be0cc278f56825919603c07cf';
|
|
|
uni.request({
|
|
|
@@ -1847,10 +1992,12 @@
|
|
|
console.log('用户所在地:', this.location);
|
|
|
} else {
|
|
|
console.error('获取位置失败:', res.data);
|
|
|
+ this.hasLoadedLocation = false; // 失败后允许重试
|
|
|
}
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
console.error('请求失败:', err);
|
|
|
+ this.hasLoadedLocation = false; // 失败后允许重试
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -2750,8 +2897,9 @@
|
|
|
maOpenId: this.userInfo.maOpenId,
|
|
|
appId: this.appid,
|
|
|
data: {
|
|
|
- thing6: this.liveItem.liveName,
|
|
|
- date7: this.liveItem.startTime
|
|
|
+ thing4: this.liveItem.liveName,
|
|
|
+ time2: this.liveItem.startTime,
|
|
|
+ date7: this.liveItem.startTime
|
|
|
}
|
|
|
};
|
|
|
subNotifyLive(templateData).then(
|
|
|
@@ -3096,14 +3244,18 @@
|
|
|
//横屏
|
|
|
const wW = (winW / winH) * 100;
|
|
|
//竖屏
|
|
|
- const wH = (winH / winW) * 100;
|
|
|
- if (this.liveItem.showType == 2) {
|
|
|
- const videoRatio = (height / width) * 100;
|
|
|
- this.scale = wH / videoRatio;
|
|
|
- console.log("比例", this.videoRatio, width, height)
|
|
|
- } else if (this.isFullscreen) {
|
|
|
- this.scale = wW / this.videoRatio;
|
|
|
+ if (height > width) {
|
|
|
+ this.isHeight = true
|
|
|
}
|
|
|
+ const wH = (winH / winW) * 100;
|
|
|
+ // this.scale = wW / this.videoRatio;
|
|
|
+ // if (this.liveItem.showType == 2) {
|
|
|
+ // const videoRatio = (height / width) * 100;
|
|
|
+ // this.scale = wH / videoRatio;
|
|
|
+ // console.log("比例", this.videoRatio, width, height)
|
|
|
+ // } else if (this.isFullscreen) {
|
|
|
+
|
|
|
+ // }
|
|
|
this.videoProgressKey = `videoProgress_${this.liveId}`;
|
|
|
this.setVideoProgress();
|
|
|
},
|
|
|
@@ -3834,11 +3986,21 @@
|
|
|
// 修改获取直播信息方法
|
|
|
async getliving(liveId) {
|
|
|
if (!liveId) return;
|
|
|
+
|
|
|
+ // 防止重复请求
|
|
|
+ if (this.isLoadingLiveInfo) {
|
|
|
+ console.log('正在加载直播间信息,跳过重复请求');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.isLoadingLiveInfo = true;
|
|
|
const param = {
|
|
|
id: liveId
|
|
|
};
|
|
|
try {
|
|
|
const res = await getlive(param);
|
|
|
+ this.isLoadingLiveInfo = false;
|
|
|
+
|
|
|
if (res.code !== 200) {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
@@ -3931,6 +4093,7 @@
|
|
|
this.playVideo();
|
|
|
}
|
|
|
} catch (err) {
|
|
|
+ this.isLoadingLiveInfo = false;
|
|
|
console.error('获取直播信息失败:', err);
|
|
|
uni.showToast({
|
|
|
title: '获取直播信息失败',
|
|
|
@@ -3987,11 +4150,14 @@
|
|
|
//直播间点赞、关注、在线人数数据
|
|
|
getliveViewData() {
|
|
|
if (!this.liveId) return;
|
|
|
- getLiveViewData(this.liveId).then((res) => {
|
|
|
+
|
|
|
+ // 使用 Promise 包装,支持 await
|
|
|
+ return getLiveViewData(this.liveId).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
// 强制响应式更新,确保数据实时显示
|
|
|
this.liveViewData = res;
|
|
|
}
|
|
|
+ return res;
|
|
|
}).catch((error) => {
|
|
|
console.error('获取直播间数据失败:', error);
|
|
|
// 失败时兜底,避免显示异常
|
|
|
@@ -3999,6 +4165,7 @@
|
|
|
like: 0,
|
|
|
watchCount: 0
|
|
|
};
|
|
|
+ throw error;
|
|
|
});
|
|
|
},
|
|
|
// 30秒刷新一下直播间点赞数
|
|
|
@@ -4847,6 +5014,12 @@
|
|
|
transition: all 0.3s ease;
|
|
|
}
|
|
|
|
|
|
+ .video-container2 {
|
|
|
+ position: relative;
|
|
|
+ bottom: -1px;
|
|
|
+ transition: all 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
.video-player.fullscreen {
|
|
|
width: 100vh !important;
|
|
|
height: 100vw !important;
|
|
|
@@ -4905,7 +5078,7 @@
|
|
|
line-height: 1 !important;
|
|
|
margin: 0 !important;
|
|
|
width: auto !important;
|
|
|
- font-weight: 500 !important;
|
|
|
+ // font-weight: 500 !important;
|
|
|
border-radius: none !important;
|
|
|
|
|
|
&::after {
|
|
|
@@ -4975,7 +5148,7 @@
|
|
|
background: var(--pop-bg);
|
|
|
border-radius: 24rpx;
|
|
|
position: absolute;
|
|
|
- top: 15%;
|
|
|
+ top: 16%;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
display: flex;
|
|
|
@@ -4989,7 +5162,10 @@
|
|
|
|
|
|
.trailer-video {
|
|
|
width: 100%;
|
|
|
- height: 400rpx;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ z-index: 1;
|
|
|
+ border-radius: 20rpx;
|
|
|
}
|
|
|
|
|
|
.trailer-placeholder {
|
|
|
@@ -5075,6 +5251,121 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 新预告直播盒子
|
|
|
+ .trailer-box2 {
|
|
|
+ width: 100%;
|
|
|
+ position: absolute;
|
|
|
+ top: 16%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ z-index: 999;
|
|
|
+ transition: box-shadow 0.3s ease;
|
|
|
+ height: 400rpx;
|
|
|
+
|
|
|
+ .trailer-video {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .trailer-placeholder {
|
|
|
+
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: -1;
|
|
|
+ /* 置于内容下方 */
|
|
|
+ }
|
|
|
+
|
|
|
+ .countdown-container {
|
|
|
+ padding-top: 15%;
|
|
|
+ margin: 20rpx 0;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .live-name {
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 36rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .countdown-display {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin: 30rpx 0;
|
|
|
+
|
|
|
+ .countdown-label {
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: rgba(250, 214, 176, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .countdown-separator {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
+
|
|
|
+ .countdown-unit {
|
|
|
+ width: 60rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ background: rgba(255, 246, 214, 1);
|
|
|
+ border-radius: 8rpx;
|
|
|
+ text-align: center;
|
|
|
+ overflow: hidden;
|
|
|
+ margin: 0 8rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: rgba(0, 75, 59, 1);
|
|
|
+ line-height: 60rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .trailer-actions {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .action-button {
|
|
|
+ width: 280rpx;
|
|
|
+ height: 72rpx;
|
|
|
+ border-radius: 36rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ text-align: center;
|
|
|
+ border: 1px solid rgba(151, 151, 151, 1);
|
|
|
+ font-size: 36rpx;
|
|
|
+ font-weight: bold;
|
|
|
+
|
|
|
+ &.reserve-button {
|
|
|
+ color: rgba(0, 110, 80, 1);
|
|
|
+ background: linear-gradient(231.51deg, rgba(249, 215, 178, 1) 0%, rgba(255, 255, 191, 1) 47.83%, rgba(255, 250, 229, 1) 65.77%, rgba(248, 214, 178, 1) 100%);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ &:not(.reserve-button) {
|
|
|
+ color: rgba(255, 246, 214, 1);
|
|
|
+ background: rgba(0, 110, 80, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .button-icon {
|
|
|
+ width: 32rpx;
|
|
|
+ height: 32rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .no-live-title {
|
|
|
+ margin-top: 30rpx;
|
|
|
+ font-size: 42rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 主要内容区域
|
|
|
.content {
|
|
|
position: relative;
|
|
|
@@ -5238,6 +5529,7 @@
|
|
|
color: #fff;
|
|
|
border-radius: 28rpx;
|
|
|
z-index: 999999 !important;
|
|
|
+
|
|
|
&.complaint-full {
|
|
|
// top: 10rpx;
|
|
|
left: 82vh;
|
|
|
@@ -5368,16 +5660,32 @@
|
|
|
}
|
|
|
|
|
|
&.chat-area-container3 {
|
|
|
+ height: calc(85% - 420rpx);
|
|
|
+ flex: 1;
|
|
|
+ transform: none; // 移除之前的变换
|
|
|
+ will-change: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
|
|
|
- max-height: 40%;
|
|
|
+ &.chat-area-container4 {
|
|
|
+ height: calc(85% - 680rpx);
|
|
|
flex: 1;
|
|
|
- min-height: 0; // 重要:允许收缩到0
|
|
|
- // position: relative;
|
|
|
transform: none; // 移除之前的变换
|
|
|
will-change: auto;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
position: absolute;
|
|
|
+ // max-height: 40%;
|
|
|
+ // flex: 1;
|
|
|
+ // min-height: 0; // 重要:允许收缩到0
|
|
|
+ // // position: relative;
|
|
|
+ // transform: none; // 移除之前的变换
|
|
|
+ // will-change: auto;
|
|
|
+ // display: flex;
|
|
|
+ // flex-direction: column;
|
|
|
+ // position: absolute;
|
|
|
}
|
|
|
|
|
|
&.chat-area-focused {
|
|
|
@@ -5406,14 +5714,14 @@
|
|
|
|
|
|
.chat-content-wrapper {
|
|
|
flex: 1;
|
|
|
- height: 300rpx;
|
|
|
+ height: 400rpx;
|
|
|
padding: 20rpx 0;
|
|
|
transform: translateZ(0);
|
|
|
will-change: height;
|
|
|
position: relative;
|
|
|
|
|
|
&.chat-content-focused {
|
|
|
- height: 100rpx;
|
|
|
+ height: 100rpx !important;
|
|
|
}
|
|
|
|
|
|
.notice-message {
|
|
|
@@ -5434,6 +5742,10 @@
|
|
|
height: fit-content;
|
|
|
z-index: 2;
|
|
|
}
|
|
|
+
|
|
|
+ &.horizontal-notice2 {
|
|
|
+ color: #fff !important
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.message-scroll-view {
|