|
|
@@ -29,7 +29,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="trailer-actions" v-if="!isFocus">
|
|
|
+ <view class="trailer-actions">
|
|
|
<button open-type="share" class="button-reset share-button">
|
|
|
<view class="action-button mr18" @click="handleAgreement">
|
|
|
<text>分享给好友</text>
|
|
|
@@ -52,7 +52,8 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 主要内容区域 -->
|
|
|
- <view class="content">
|
|
|
+
|
|
|
+ <view class="content" :class="{ 'horizontal-content': isFocus==1, 'trailer-content': liveItem.status==1 }">
|
|
|
<!-- 顶部信息栏 -->
|
|
|
<view class="top-info-bar" :class="liveItem.showType == 1 ? 'horizontal-top' : ''">
|
|
|
<view class="user-info-section">
|
|
|
@@ -102,40 +103,16 @@
|
|
|
: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="isPlayback"></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="true"
|
|
|
- :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
|
|
|
- show-play-btn
|
|
|
- show-mute-btn
|
|
|
- enable-play-gesture="true"
|
|
|
- ></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="true" :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
|
|
|
+ show-play-btn show-mute-btn enable-play-gesture="true"></video>
|
|
|
<view v-else class="txt">回放生成中...</view>
|
|
|
<view v-if="isPlayback" class="replay-label">回放</view>
|
|
|
</view>
|
|
|
@@ -167,6 +144,7 @@
|
|
|
<!-- 底部聊天区域 -->
|
|
|
<view class="chat-area-container" :class="{
|
|
|
'chat-area-container2': liveItem.showType == 1,
|
|
|
+ 'chat-area-container3': liveItem.status == 1,
|
|
|
'chat-area-focused': isFocus
|
|
|
}" :style="{ '--keyboard-height': keyboardHeight + 'rpx' }">
|
|
|
<view class="tabs_bg" v-if="liveItem.showType == 1">
|
|
|
@@ -177,7 +155,8 @@
|
|
|
|
|
|
<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="!isFocus&&isShowNotice"
|
|
|
+ :class="liveItem.showType == 1 ? 'horizontal-notice' : ''">
|
|
|
公告消息: {{notice.msg}}
|
|
|
</view>
|
|
|
<scroll-view id="msgScroll" v-if="Array.isArray(talklist)" enable-flex scroll-y="true"
|
|
|
@@ -295,7 +274,7 @@
|
|
|
</view> -->
|
|
|
<view class="bold fs36 ml20">授权你的昵称信息</view>
|
|
|
<view class="mtb20 justify-between align-center plr20">
|
|
|
- <view class="button-container">
|
|
|
+ <view class="button-container">
|
|
|
<input type="nickname" class="hidden-input" @blur="onNickNameInput" placeholder="请点击授权微信昵称"
|
|
|
@input="onNickNameInput" />
|
|
|
<!-- <button class="custom-button"
|
|
|
@@ -458,7 +437,8 @@
|
|
|
<u-popup :show="isShowPopMsg" round="20rpx" mode="center" zIndex="10076">
|
|
|
<view class="message-popup">
|
|
|
<image class="message-close-icon"
|
|
|
- src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/del2.png" @click="isShowPopMsg = false" />
|
|
|
+ src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/del2.png"
|
|
|
+ @click="isShowPopMsg = false" />
|
|
|
<view class="message-title">消息通知</view>
|
|
|
<view class="message-content">{{popMsg}}</view>
|
|
|
<view class="message-confirm-button" @click="isShowPopMsg = false">确认</view>
|
|
|
@@ -799,8 +779,8 @@
|
|
|
networkType: 'unknown', // 当前网络类型
|
|
|
isNetworkAvailable: true, // 网络是否可用
|
|
|
|
|
|
- templateId: 'IKffTm6HnbLS91hDCUnKSQpC2r4EABo3fOtThnK1dI8',//百域承品
|
|
|
-
|
|
|
+ templateId: 'IKffTm6HnbLS91hDCUnKSQpC2r4EABo3fOtThnK1dI8', //百域承品
|
|
|
+
|
|
|
isAgreement: false,
|
|
|
|
|
|
wsNewUrl: 'wss://api.fhhx.runtzh.com/ws/app/webSocket',
|
|
|
@@ -882,7 +862,7 @@
|
|
|
userData: {},
|
|
|
diffTotalTime: '',
|
|
|
address: '',
|
|
|
- user:{}
|
|
|
+ user: {}
|
|
|
};
|
|
|
},
|
|
|
async onLoad(options) {
|
|
|
@@ -902,7 +882,7 @@
|
|
|
this.liveId = params.a;
|
|
|
});
|
|
|
if (params.b && params.c) {
|
|
|
- console.log("扫码参数",params)
|
|
|
+ console.log("扫码参数", params)
|
|
|
this.qrFrom = `&companyId=${params.b}&companyUserId=${params.c}`;
|
|
|
}
|
|
|
}
|
|
|
@@ -959,6 +939,7 @@
|
|
|
}
|
|
|
} else {
|
|
|
console.log("手机型号是>>>>", this.systemInfo.model)
|
|
|
+ console.log("手机高度是>>>>", this.systemInfo.model)
|
|
|
// Android处理保持原有逻辑
|
|
|
if (res.height > 0) {
|
|
|
this.isKeyboardShow = true;
|
|
|
@@ -1128,31 +1109,31 @@
|
|
|
return userPrize ? userPrize.productId : null;
|
|
|
},
|
|
|
getCurrentUserPrizeRecordId() {
|
|
|
- console.log('=== getCurrentUserPrizeRecordId 调试信息 ===');
|
|
|
- console.log('this.prizeInfo:', this.prizeInfo);
|
|
|
- console.log('this.userInfo:', this.userInfo);
|
|
|
- console.log('this.userInfo.userId:', this.userInfo?.userId);
|
|
|
-
|
|
|
- if (!Array.isArray(this.prizeInfo) || !this.userInfo?.userId) {
|
|
|
- console.log('条件不满足,返回null');
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- const userPrize = this.prizeInfo.find(item => {
|
|
|
- const match = String(item.userId) == String(this.userInfo.userId);
|
|
|
- console.log('查找匹配:', {
|
|
|
- itemUserId: item.userId,
|
|
|
- currentUserId: this.userInfo.userId,
|
|
|
- match: match,
|
|
|
- itemRecordId: item.recordId
|
|
|
- });
|
|
|
- return match;
|
|
|
- });
|
|
|
-
|
|
|
- console.log('找到的用户奖品:', userPrize);
|
|
|
- console.log('最终返回的recordId:', userPrize ? userPrize.recordId : null);
|
|
|
-
|
|
|
- return userPrize ? userPrize.recordId : null;
|
|
|
+ console.log('=== getCurrentUserPrizeRecordId 调试信息 ===');
|
|
|
+ console.log('this.prizeInfo:', this.prizeInfo);
|
|
|
+ console.log('this.userInfo:', this.userInfo);
|
|
|
+ console.log('this.userInfo.userId:', this.userInfo?.userId);
|
|
|
+
|
|
|
+ if (!Array.isArray(this.prizeInfo) || !this.userInfo?.userId) {
|
|
|
+ console.log('条件不满足,返回null');
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ const userPrize = this.prizeInfo.find(item => {
|
|
|
+ const match = String(item.userId) == String(this.userInfo.userId);
|
|
|
+ console.log('查找匹配:', {
|
|
|
+ itemUserId: item.userId,
|
|
|
+ currentUserId: this.userInfo.userId,
|
|
|
+ match: match,
|
|
|
+ itemRecordId: item.recordId
|
|
|
+ });
|
|
|
+ return match;
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log('找到的用户奖品:', userPrize);
|
|
|
+ console.log('最终返回的recordId:', userPrize ? userPrize.recordId : null);
|
|
|
+
|
|
|
+ return userPrize ? userPrize.recordId : null;
|
|
|
},
|
|
|
nameuser() {
|
|
|
return this.userInfo.nickname
|
|
|
@@ -1281,7 +1262,7 @@
|
|
|
uni.setStorageSync('userInfo', this.userInfo);
|
|
|
this.userlogo = false;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
editUser() {
|
|
|
this.user.nickName = this.user.nickname;
|
|
|
editUser(this.user).then(
|
|
|
@@ -1307,7 +1288,7 @@
|
|
|
rej => {}
|
|
|
);
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
onNickNameInput(e) {
|
|
|
console.log(e)
|
|
|
this.user.nickname = e.detail.value
|
|
|
@@ -2003,30 +1984,75 @@
|
|
|
this.heartBeatRetryCount = 0;
|
|
|
},
|
|
|
|
|
|
+
|
|
|
+ // startTrafficCalculation(bitrate) {
|
|
|
+ // if (this.trafficTimer) {
|
|
|
+ // clearInterval(this.trafficTimer);
|
|
|
+ // this.trafficTimer = null;
|
|
|
+ // }
|
|
|
+ // this.startTime = Date.now();
|
|
|
+ // var that = this;
|
|
|
+ // this.trafficTimer = setInterval(() => {
|
|
|
+ // that.calculateTraffic(bitrate);
|
|
|
+ // }, 10000); // 每10秒计算一次
|
|
|
+ // },
|
|
|
//直播计算流量
|
|
|
- startTrafficCalculation(bitrate) {
|
|
|
+ startTrafficCalculation() {
|
|
|
if (this.trafficTimer) {
|
|
|
clearInterval(this.trafficTimer);
|
|
|
this.trafficTimer = null;
|
|
|
}
|
|
|
+
|
|
|
this.startTime = Date.now();
|
|
|
var that = this;
|
|
|
+
|
|
|
+ // 计算码率
|
|
|
+ let bitrate = this.calculateBitrate();
|
|
|
+
|
|
|
this.trafficTimer = setInterval(() => {
|
|
|
that.calculateTraffic(bitrate);
|
|
|
}, 10000); // 每10秒计算一次
|
|
|
},
|
|
|
// 计算流量
|
|
|
+ // calculateTraffic(bitrate) {
|
|
|
+ // const currentTime = Date.now();
|
|
|
+ // const duration = (currentTime - this.startTime) / 1000; // 持续时间(秒)
|
|
|
+ // // 流量 = 码率 × 时间
|
|
|
+ // // 码率单位: bps, 时间单位: 秒, 流量单位: 比特
|
|
|
+ // const trafficBits = bitrate * duration;
|
|
|
+ // // 转换为字节
|
|
|
+ // this.totalTraffic = trafficBits / 8;
|
|
|
+ // this.getLiveInternetTraffic();
|
|
|
+ // },
|
|
|
+ calculateBitrate() {
|
|
|
+ // 如果接口返回了视频文件大小和时长,使用这些数据计算码率
|
|
|
+ if (this.liveItem.videoFileSize && this.liveItem.videoDuration) {
|
|
|
+ // 码率 = 文件大小(字节) / 时长(秒) × 8 (转换为bps) × 5
|
|
|
+ const calculatedBitrate = (this.liveItem.videoFileSize / this.liveItem.videoDuration) * 8 * 5;
|
|
|
+ console.log(
|
|
|
+ `使用接口数据计算码率: ${calculatedBitrate} bps (文件大小: ${this.liveItem.videoFileSize} 字节, 时长: ${this.liveItem.videoDuration} 秒)`
|
|
|
+ );
|
|
|
+ return calculatedBitrate;
|
|
|
+ } else {
|
|
|
+ // 如果任一字段为空,使用默认码率 1500 bps
|
|
|
+ console.log('接口数据不完整,使用默认码率: 1500 bps');
|
|
|
+ return 1500;
|
|
|
+ }
|
|
|
+ },
|
|
|
calculateTraffic(bitrate) {
|
|
|
const currentTime = Date.now();
|
|
|
const duration = (currentTime - this.startTime) / 1000; // 持续时间(秒)
|
|
|
+
|
|
|
// 流量 = 码率 × 时间
|
|
|
// 码率单位: bps, 时间单位: 秒, 流量单位: 比特
|
|
|
const trafficBits = bitrate * duration;
|
|
|
+
|
|
|
// 转换为字节
|
|
|
this.totalTraffic = trafficBits / 8;
|
|
|
+
|
|
|
+ // 调用流量上报接口
|
|
|
this.getLiveInternetTraffic();
|
|
|
},
|
|
|
-
|
|
|
startTimer() {
|
|
|
this.startTime = Date.now();
|
|
|
this.lookTimer = setInterval(() => {
|
|
|
@@ -2262,8 +2288,8 @@
|
|
|
liveId: this.liveId,
|
|
|
userId: this.userInfo.userId,
|
|
|
templateId: this.templateId, // 模板ID
|
|
|
- maOpenId:this.userInfo.maOpenId,
|
|
|
- appId:this.appid,
|
|
|
+ maOpenId: this.userInfo.maOpenId,
|
|
|
+ appId: this.appid,
|
|
|
data: {
|
|
|
thing6: this.liveItem.liveName,
|
|
|
date7: this.liveItem.startTime
|
|
|
@@ -2589,7 +2615,7 @@
|
|
|
this.isFocus = false;
|
|
|
},
|
|
|
getTimeDifferenceInSeconds(createTimeStr) {
|
|
|
- if(!createTimeStr) return;
|
|
|
+ if (!createTimeStr) return;
|
|
|
const createTime = new Date(createTimeStr.replace(/-/g, '/'));
|
|
|
const now = new Date();
|
|
|
const timeDiffMs = now - createTime;
|
|
|
@@ -2631,10 +2657,26 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // onVideoWaiting(e) {
|
|
|
+ // // console.log('视频等待加载', e);
|
|
|
+ // if (this.liveItem.liveType == 2) {
|
|
|
+ // this.startTrafficCalculation(this.bitrate);
|
|
|
+ // } else {
|
|
|
+ // let that = this;
|
|
|
+ // if (this.trafficInterval) {
|
|
|
+ // clearInterval(this.trafficInterval);
|
|
|
+ // this.trafficInterval = null;
|
|
|
+ // }
|
|
|
+ // this.trafficInterval = setInterval(function() {
|
|
|
+ // that.getInternetTraffic();
|
|
|
+ // }, 10000);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
onVideoWaiting(e) {
|
|
|
// console.log('视频等待加载', e);
|
|
|
if (this.liveItem.liveType == 2) {
|
|
|
- this.startTrafficCalculation(this.bitrate);
|
|
|
+ // 修改这里:不再传入固定码率,而是在方法内部计算
|
|
|
+ this.startTrafficCalculation();
|
|
|
} else {
|
|
|
let that = this;
|
|
|
if (this.trafficInterval) {
|
|
|
@@ -2664,7 +2706,7 @@
|
|
|
this.playVideo();
|
|
|
this.generating = false;
|
|
|
this.hasPlayback = true;
|
|
|
-
|
|
|
+
|
|
|
}, 180000);
|
|
|
this.closeWebSocket(true);
|
|
|
this.isEnd = true;
|
|
|
@@ -2886,7 +2928,8 @@
|
|
|
this.playVideo();
|
|
|
} else if (e.detail.code == 2004) {
|
|
|
this.calculateTimeDiff(this.liveItem);
|
|
|
- this.startTrafficCalculation(this.bitrateLive);
|
|
|
+ // this.startTrafficCalculation(this.bitrateLive);
|
|
|
+ this.startTrafficCalculation();
|
|
|
}
|
|
|
// 2001: 已经连接服务器
|
|
|
// 2002: 已经连接服务器,开始拉流
|
|
|
@@ -3598,7 +3641,7 @@
|
|
|
|
|
|
setTimeout(() => {
|
|
|
this.getliveUser(false);
|
|
|
- },1000);
|
|
|
+ }, 1000);
|
|
|
|
|
|
const now = new Date();
|
|
|
this.timestamp = now.getTime(); // 生成签名
|
|
|
@@ -4212,11 +4255,11 @@
|
|
|
--video-height: 100vh;
|
|
|
--chat-height: 30vh;
|
|
|
--pop-bg: #333333;
|
|
|
- --notice-bg:rgba(9, 9, 9, 0.4);
|
|
|
+ --notice-bg: rgba(9, 9, 9, 0.4);
|
|
|
}
|
|
|
|
|
|
.swiper-wrapper.horizontal {
|
|
|
- --notice-bg:#fefae8;
|
|
|
+ --notice-bg: #fefae8;
|
|
|
--pop-bg: #ECF5F4;
|
|
|
/* 默认变量(浅色主题) */
|
|
|
--bottom-color: #fff;
|
|
|
@@ -4266,7 +4309,8 @@
|
|
|
padding: 20rpx;
|
|
|
z-index: 999;
|
|
|
box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.12);
|
|
|
- transition: box-shadow 0.3s ease;
|
|
|
+ transition: box-shadow 0.3s ease;
|
|
|
+
|
|
|
.trailer-video {
|
|
|
width: 100%;
|
|
|
height: 400rpx;
|
|
|
@@ -4365,7 +4409,15 @@
|
|
|
left: 0;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- // justify-content: space-between;
|
|
|
+
|
|
|
+
|
|
|
+ &.horizontal-content {
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.trailer-content {
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
|
|
|
// 顶部信息栏
|
|
|
.top-info-bar {
|
|
|
@@ -4533,6 +4585,7 @@
|
|
|
transform: translateZ(0);
|
|
|
will-change: transform;
|
|
|
backface-visibility: hidden;
|
|
|
+ // max-height: 50%;
|
|
|
|
|
|
&.chat-area-container2 {
|
|
|
flex: 1;
|
|
|
@@ -4544,7 +4597,20 @@
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
|
|
|
+ &.chat-area-container3 {
|
|
|
+ max-height: 40%;
|
|
|
+ flex: 1;
|
|
|
+ min-height: 0; // 重要:允许收缩到0
|
|
|
+ position: relative;
|
|
|
+ transform: none; // 移除之前的变换
|
|
|
+ will-change: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
&.chat-area-focused {
|
|
|
+ // max-height: 500rpx;
|
|
|
transform: translateY(calc(-1 * var(--keyboard-height, 0rpx))) translateZ(0);
|
|
|
z-index: 1000;
|
|
|
}
|
|
|
@@ -4576,7 +4642,8 @@
|
|
|
border-radius: 20rpx;
|
|
|
color: #ffda73;
|
|
|
overflow: hidden;
|
|
|
- &.horizontal-notice{
|
|
|
+
|
|
|
+ &.horizontal-notice {
|
|
|
position: static;
|
|
|
}
|
|
|
}
|
|
|
@@ -4623,6 +4690,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 输入和操作区域
|
|
|
.input-actions-container {
|
|
|
position: relative;
|
|
|
@@ -4905,8 +4973,6 @@
|
|
|
padding: 30rpx;
|
|
|
margin-top: 40rpx;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -5108,6 +5174,7 @@
|
|
|
height: 64rpx;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
.red-envelope-background {
|
|
|
width: 100%;
|
|
|
height: 100%;
|