|
@@ -52,7 +52,7 @@
|
|
|
</view> -->
|
|
|
<view class="activity-box">
|
|
|
<!-- v-if="redInfo?.redStatus==1&&isShowRed" -->
|
|
|
- <view class="item-box" @click="onRed()" v-if="redInfo?.redStatus==1&&isShowRed">
|
|
|
+ <view class="item-box" @click="onRed()" v-if="isShowRed">
|
|
|
<view class="u-flex-y-center">
|
|
|
<view class="tip">领红包</view>
|
|
|
<view class="item">
|
|
@@ -61,7 +61,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="item-box" @click="onLottery()" v-if="lotteryInfo?.lotteryStatus==1&&isShowLottery">
|
|
|
+ <view class="item-box" @click="onLottery()" v-if="isShowLottery">
|
|
|
<view class="u-flex-y-center">
|
|
|
<view class="tip">抽奖</view>
|
|
|
<view class="item">
|
|
@@ -98,10 +98,19 @@
|
|
|
:show-center-play-btn="false" :http-cache="false" @error="videoError">
|
|
|
</video> -->
|
|
|
|
|
|
- <video v-if=" liveItem.videoUrl" :class="liveItem.showType == 1 ? 'video_row' : 'videotop'"
|
|
|
+ <!-- <video v-if=" liveItem.videoUrl" :class="liveItem.showType == 1 ? 'video_row' : 'videotop'"
|
|
|
:src="liveItem.videoUrl" :autoplay="true" :controls='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 @error="videoError">
|
|
|
+ </video> -->
|
|
|
+
|
|
|
+ <video v-if="liveItem.videoUrl" :id="`myVideo_${liveId}`"
|
|
|
+ :class="liveItem.showType == 1 ? 'video_row' : 'videotop'" :src="liveItem.videoUrl"
|
|
|
+ :autoplay="true" :controls="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 @error="videoError"
|
|
|
+ @timeupdate="onVideoTimeUpdate" @loadeddata="onVideoLoaded"
|
|
|
+ @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause" @play="onVideoPlay">
|
|
|
</video>
|
|
|
<view v-if="liveItem.videoUrl" class="time">{{liveItem.totalTime}}</view>
|
|
|
</view>
|
|
@@ -200,11 +209,24 @@
|
|
|
<image class="w446 h80" src="/static/images/red_title.png"></image>
|
|
|
<view class="fs24 colorf u-flex-y-center mt30 mb30">
|
|
|
52人已参与,开奖倒计时
|
|
|
- <view class="white-item">14</view>:
|
|
|
- <view class="white-item">344</view>:
|
|
|
- <view class="white-item">44</view>
|
|
|
+ <!-- <view class="white-item">{{lotteryTime.hours}}</view>:
|
|
|
+ <view class="white-item">{{lotteryTime.minutes}}</view>:
|
|
|
+ <view class="white-item">{{lotteryTime.seconds}}</view> -->
|
|
|
+ <u-count-down :time="lotteryTime||0" format="DD:HH:mm:ss" autoStart millisecond
|
|
|
+ @change="onChange">
|
|
|
+ <view class="u-flex-y-center">
|
|
|
+ <view class="white-item">
|
|
|
+ {{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}
|
|
|
+ </view>
|
|
|
+ <view class="white-item">{{ timeData.minutes }}</view>
|
|
|
+ <view class="white-item">{{ timeData.seconds }}</view>
|
|
|
+ </view>
|
|
|
+ </u-count-down>
|
|
|
</view>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<!-- <view class="item-group">
|
|
|
<three-d-swiper :items="swiperItems" :swiperHeight="348" :autoPlay="4000"
|
|
|
:indicatorTop="20"></three-d-swiper>
|
|
@@ -244,7 +266,7 @@
|
|
|
<view class="colorf fs28">
|
|
|
观看直播参与抽奖
|
|
|
</view>
|
|
|
- <view class="button" @click="">参与抽奖</view>
|
|
|
+ <view class="button" @click="onClaim">参与抽奖</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -275,6 +297,17 @@
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
|
|
|
+ <u-popup :show="isShowPrize" @close="!isShowPrize" round='20rpx' mode="center" bgColor='#fff' zIndex='10076'>
|
|
|
+ <view class="prize-card">
|
|
|
+ <view class="title">位幸运观众</view>
|
|
|
+ <view class="prize-content" v-for="(item,index) in prizeInfo" :key="index">
|
|
|
+ <view class="name">{{item.userName}}</view>
|
|
|
+ <view class="txt ">{{item.prizeLevel}}等奖</view>
|
|
|
+ </view>
|
|
|
+ <view class="button" @click="isShowPrize=flase">确认</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+
|
|
|
<!-- 观众列表弹窗 -->
|
|
|
<u-popup :show="showadd" @close="close" @open="openViews" round='20rpx' bgColor='#ffffff' zIndex='10077'>
|
|
|
<view class="view-box">
|
|
@@ -352,6 +385,7 @@
|
|
|
import CryptoJS from 'crypto-js'
|
|
|
import {
|
|
|
liveLottery, // 抽奖查询
|
|
|
+ claim, //抽奖
|
|
|
|
|
|
liveRed, // 点击领红包
|
|
|
liveDataLike, // 点赞
|
|
@@ -379,8 +413,8 @@
|
|
|
import {
|
|
|
getlive,
|
|
|
} from '@/api/home'
|
|
|
- var wsUrl = "wss://live.test.ylrztop.com/ws/live-api/app/webSocket"; //余红奇
|
|
|
- // var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
|
|
|
+ // var wsUrl = "wss://live.test.ylrztop.com/ws/live-api/app/webSocket"; //余红奇
|
|
|
+ var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
|
|
|
var pingpangTimes = null;
|
|
|
var initTimes = null;
|
|
|
var isSocketOpen = false;
|
|
@@ -392,24 +426,18 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- payLimitTime: null,
|
|
|
- // swiperData: [{
|
|
|
- // imgUrl: '/static/images/zfb.png',
|
|
|
- // title: '自然风光'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // imgUrl: '/static/images/zfb.png',
|
|
|
- // title: '城市建筑'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // imgUrl: '/static/images/zfb.png',
|
|
|
- // title: '人文景观'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // imgUrl: '/static/images/zfb.png',
|
|
|
- // title: '科技创新'
|
|
|
- // }
|
|
|
- // ],
|
|
|
+ videoCurrentTime: 0, // 当前视频播放时间
|
|
|
+ isVideoPlaying: false, // 视频是否正在播放
|
|
|
+ videoProgressKey: '', // 存储进度的key
|
|
|
+
|
|
|
+
|
|
|
+ isShowPrize: false,
|
|
|
+ prizeInfo: [],
|
|
|
+ timeData: {},
|
|
|
+ lotteryTime: 0,
|
|
|
+ lotteryProducts: [],
|
|
|
+ lotteryList: [],
|
|
|
+ talklist: {},
|
|
|
isShowLotteryPop: false,
|
|
|
liveItem: {},
|
|
|
isSending: false,
|
|
@@ -560,25 +588,34 @@
|
|
|
// }
|
|
|
},
|
|
|
onHide() {
|
|
|
+ // 页面隐藏时保存视频进度
|
|
|
+ this.saveVideoProgress();
|
|
|
+
|
|
|
const currentLive = this.liveItem;
|
|
|
if (currentLive) {
|
|
|
this.pauseVideo(currentLive);
|
|
|
this.clearTimeTimer(currentLive); // 隐藏时清除当前直播间定时器
|
|
|
} // 隐藏时关闭所有连接
|
|
|
this.closeAllWebSockets();
|
|
|
+ if (this.lotteryList) {
|
|
|
+ this.clearTimeTimer(this.lotteryList)
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getCurrentActivities();
|
|
|
},
|
|
|
onUnload() {
|
|
|
+ // 页面卸载时保存视频进度
|
|
|
+ this.saveVideoProgress();
|
|
|
+
|
|
|
// 清除定时器
|
|
|
if (this.redTimer) {
|
|
|
clearInterval(this.redTimer);
|
|
|
this.redTimer = null;
|
|
|
}
|
|
|
- if (this.redTimer) {
|
|
|
- clearInterval(this.redTimer);
|
|
|
- this.redTimer = null;
|
|
|
+ if (this.lotteryTimer) {
|
|
|
+ clearInterval(this.lotteryTimer);
|
|
|
+ this.lotteryTimer = null;
|
|
|
}
|
|
|
if (this.welcomeTimer) {
|
|
|
clearInterval(this.welcomeTimer);
|
|
@@ -600,13 +637,26 @@
|
|
|
this.hlsPlayer.destroy();
|
|
|
this.hlsPlayer = null;
|
|
|
}
|
|
|
+ // 移除所有全局事件监听
|
|
|
+ this.removeAllEventListeners();
|
|
|
|
|
|
+ // 清理定时器
|
|
|
+ this.clearAllTimers();
|
|
|
|
|
|
+ // 销毁HLS播放器(如果使用了hls.js)
|
|
|
+ if (this.hlsPlayer) {
|
|
|
+ this.hlsPlayer.destroy();
|
|
|
+ this.hlsPlayer = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 暂停视频
|
|
|
const videoId = `myVideo_${this.liveId}`;
|
|
|
const videoContext = uni.createVideoContext(videoId, this);
|
|
|
if (videoContext) {
|
|
|
- videoContext.pause(); // 仅暂停视频即可
|
|
|
+ videoContext.pause();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
watch: {
|
|
|
// 监听orderUser.count的变化
|
|
@@ -621,7 +671,128 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 点击抽奖
|
|
|
+ onVideoMetaLoaded(e) {
|
|
|
+ console.log('视频元数据加载完成');
|
|
|
+ // 设置存储key
|
|
|
+ this.videoProgressKey = `videoProgress_${this.liveId}`;
|
|
|
+
|
|
|
+ // 尝试从存储中获取保存的播放进度
|
|
|
+ uni.getStorage({
|
|
|
+ key: this.videoProgressKey,
|
|
|
+ success: (res) => {
|
|
|
+ console.log('获取到保存的播放进度:', res.data);
|
|
|
+ this.videoCurrentTime = res.data;
|
|
|
+
|
|
|
+ // 设置视频播放位置
|
|
|
+ this.setVideoCurrentTime(this.videoCurrentTime);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('没有找到保存的播放进度或获取失败', err);
|
|
|
+ this.videoCurrentTime = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 视频数据加载完成
|
|
|
+ onVideoLoaded(e) {
|
|
|
+ console.log('视频数据加载完成');
|
|
|
+ },
|
|
|
+
|
|
|
+ // 视频时间更新
|
|
|
+ onVideoTimeUpdate(e) {
|
|
|
+ // 获取当前播放时间
|
|
|
+ this.videoCurrentTime = e.detail.currentTime;
|
|
|
+
|
|
|
+ // 每隔5秒保存一次进度(避免频繁存储)
|
|
|
+ if (Math.floor(this.videoCurrentTime) % 5 === 0) {
|
|
|
+ this.saveVideoProgress();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 视频暂停
|
|
|
+ onVideoPause(e) {
|
|
|
+ this.isVideoPlaying = false;
|
|
|
+ // 暂停时保存进度
|
|
|
+ this.saveVideoProgress();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 视频播放
|
|
|
+ onVideoPlay(e) {
|
|
|
+ this.isVideoPlaying = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 设置视频当前时间
|
|
|
+ setVideoCurrentTime(time) {
|
|
|
+ const videoId = `myVideo_${this.liveId}`;
|
|
|
+ const videoContext = uni.createVideoContext(videoId, this);
|
|
|
+
|
|
|
+ if (videoContext) {
|
|
|
+ videoContext.seek(time);
|
|
|
+ console.log(`设置视频播放位置: ${time}秒`);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 保存视频进度
|
|
|
+ saveVideoProgress() {
|
|
|
+ if (this.videoProgressKey) {
|
|
|
+ uni.setStorage({
|
|
|
+ key: this.videoProgressKey,
|
|
|
+ data: this.videoCurrentTime,
|
|
|
+ success: () => {},
|
|
|
+ fail: (err) => {
|
|
|
+ console.error('保存视频进度失败:', err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ onChange(e) {
|
|
|
+ this.timeData = e
|
|
|
+ },
|
|
|
+ // 参与抽奖
|
|
|
+ onClaim() {
|
|
|
+ let data = {
|
|
|
+ liveId: this.liveId,
|
|
|
+ // integral: this.integral,
|
|
|
+ lotteryId: this.lotteryInfo.lotteryId,
|
|
|
+ // userId: this.userinfo.userId
|
|
|
+ }
|
|
|
+
|
|
|
+ claim(data).then(res => {
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ this.isShowLotteryPop = false
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rej => {}
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 点击抽奖图标
|
|
|
onLottery() {
|
|
|
if (this.lotteryTimer) {
|
|
|
clearInterval(this.lotteryTimer);
|
|
@@ -638,7 +809,9 @@
|
|
|
this.isShowLottery = false
|
|
|
this.isShowLotteryPop = true
|
|
|
if (res.code == 200) {
|
|
|
+ this.lotteryList = res.data
|
|
|
this.lotteryProducts = res.data.products
|
|
|
+ // this.startTimeTimer(this.lotteryList, "lottery");
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
@@ -717,11 +890,21 @@
|
|
|
currentActivities(this.liveId).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
// 商品卡片
|
|
|
- this.goodsCard = res.goods;
|
|
|
// 红包
|
|
|
- this.redInfo = res.red[0];
|
|
|
+ if (res.red) {
|
|
|
+ this.redInfo = res.red[0];
|
|
|
+ }
|
|
|
+ if (res.lottery) {
|
|
|
+ this.lotteryInfo = res.lottery[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.goodsCard = res.goods;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 抽奖
|
|
|
- this.lotteryInfo = res.lottery[0];
|
|
|
+ this.lotteryTime = this.lotteryInfo?.duration * 60 * 1000
|
|
|
+ console.log("毫秒", this.lotteryTime)
|
|
|
|
|
|
if (this.goodsCard && this.goodsCard.status == 1) {
|
|
|
|
|
@@ -754,29 +937,76 @@
|
|
|
);
|
|
|
},
|
|
|
// 计算当前时间与 liveItem.startTime 的差值,并更新 totalTime
|
|
|
- calculateTimeDiff(liveItem) {
|
|
|
- if (!liveItem.startTime) {
|
|
|
- liveItem.totalTime = '00小时00分钟00秒';
|
|
|
+ calculateTimeDiff(item, type = "") {
|
|
|
+ // 防御1:item 不存在直接返回
|
|
|
+ if (!item) return;
|
|
|
+
|
|
|
+ // 步骤1:提取对应场景的时间字符串(直播用startTime,抽奖用updateTime)
|
|
|
+ let timeStr = "";
|
|
|
+ if (type === "lottery") {
|
|
|
+ timeStr = item || ""; // 抽奖场景:从item取updateTime
|
|
|
+ } else {
|
|
|
+ timeStr = item || ""; // 直播场景:从item取startTime
|
|
|
+ }
|
|
|
+
|
|
|
+ // 防御2:时间字符串为空,兜底显示
|
|
|
+ if (!timeStr) {
|
|
|
+ if (type === "lottery") {
|
|
|
+ // this.lotteryTime = {
|
|
|
+ // hours: "00",
|
|
|
+ // minutes: "00",
|
|
|
+ // seconds: "00"
|
|
|
+ // };
|
|
|
+ } else {
|
|
|
+ this.$set(this.liveItem, "totalTime", "00:00:00");
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
- const iosCompatibleTime = liveItem.startTime
|
|
|
- .replace(/-/g, '/')
|
|
|
- .replace(' ', ' ');
|
|
|
- const startTime = new Date(liveItem.startTime);
|
|
|
- const now = new Date();
|
|
|
- if (isNaN(startTime.getTime())) {
|
|
|
- console.warn(`iOS 时间解析失败,原始时间:${liveItem.startTime},转换后:${iosCompatibleTime}`);
|
|
|
- liveItem.totalTime = '00小时00分钟00秒';
|
|
|
+
|
|
|
+ // 步骤2:转换时间格式(适配iOS,将 "-" 替换为 "/")
|
|
|
+ const iosCompatibleTime = timeStr.replace(/-/g, "/");
|
|
|
+ const time = new Date(iosCompatibleTime);
|
|
|
+
|
|
|
+ // 防御3:时间解析失败(Invalid Date),兜底显示
|
|
|
+ if (isNaN(time.getTime())) {
|
|
|
+ if (type === "lottery") {
|
|
|
+ this.lotteryTime = {
|
|
|
+ hours: "00",
|
|
|
+ minutes: "00",
|
|
|
+ seconds: "00"
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.$set(this.liveItem, "totalTime", "00:00:00");
|
|
|
+ }
|
|
|
+ console.warn("时间解析失败,原始格式:", timeStr);
|
|
|
return;
|
|
|
}
|
|
|
- const diffMs = Math.max(0, now - startTime);
|
|
|
|
|
|
+ // 步骤3:计算时间差(抽奖是「结束时间-当前时间」,直播是「当前时间-开始时间」)
|
|
|
+ const now = new Date();
|
|
|
+ let diffMs = 0;
|
|
|
+ if (type === "lottery") {
|
|
|
+ diffMs = Math.max(0, time - now); // 抽奖:倒计时(结束时间-现在)
|
|
|
+ } else {
|
|
|
+ diffMs = Math.max(0, now - time); // 直播:已播放时长(现在-开始时间)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 步骤4:转换为 时:分:秒(补零处理)
|
|
|
const totalSeconds = Math.floor(diffMs / 1000);
|
|
|
const hours = this.padZero(Math.floor(totalSeconds / 3600));
|
|
|
const minutes = this.padZero(Math.floor((totalSeconds % 3600) / 60));
|
|
|
const seconds = this.padZero(totalSeconds % 60);
|
|
|
|
|
|
- this.$set(liveItem, 'totalTime', `${hours}:${minutes}:${seconds}`);
|
|
|
+ // 步骤5:更新对应数据(响应式)
|
|
|
+ if (type === "lottery") {
|
|
|
+ // this.lotteryTime = {
|
|
|
+ // hours,
|
|
|
+ // minutes,
|
|
|
+ // seconds
|
|
|
+ // };
|
|
|
+ } else {
|
|
|
+ this.$set(this.liveItem, "totalTime", `${hours}:${minutes}:${seconds}`);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
padZero(num) {
|
|
@@ -784,29 +1014,40 @@
|
|
|
},
|
|
|
|
|
|
// 启动当前直播间的时间差值定时器
|
|
|
- startTimeTimer(liveItem) {
|
|
|
- // 先清除当前直播间的旧定时器(避免重复)
|
|
|
- if (liveItem.timeTimer) {
|
|
|
- clearInterval(liveItem.timeTimer);
|
|
|
- }
|
|
|
-
|
|
|
+ startTimeTimer(item, type = '') {
|
|
|
+ // 防御:若 item 不存在,直接返回
|
|
|
+ if (!item) return;
|
|
|
// 立即计算一次(避免等待1秒才显示)
|
|
|
- this.calculateTimeDiff(liveItem);
|
|
|
-
|
|
|
- // 每秒更新一次(实时刷新)
|
|
|
- liveItem.timeTimer = setInterval(() => {
|
|
|
- this.calculateTimeDiff(liveItem);
|
|
|
- }, 1000);
|
|
|
+ if (type === "lottery") {
|
|
|
+ this.calculateTimeDiff(item.updateTime, "lottery");
|
|
|
+ item.timeTimer = setInterval(() => {
|
|
|
+ this.calculateTimeDiff(item.updateTime, "lottery");
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ this.calculateTimeDiff(item.startTime);
|
|
|
+ item.timeTimer = setInterval(() => {
|
|
|
+ this.calculateTimeDiff(item.startTime);
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
},
|
|
|
// 清除指定直播间的时间定时器
|
|
|
- clearTimeTimer(liveItem) {
|
|
|
- if (liveItem.timeTimer) {
|
|
|
- clearInterval(liveItem.timeTimer);
|
|
|
- liveItem.timeTimer = null; // 清空定时器标识
|
|
|
+ clearTimeTimer(item) {
|
|
|
+ if (item.timeTimer) {
|
|
|
+ clearInterval(item.timeTimer);
|
|
|
+ item.timeTimer = null; // 清空定时器标识
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
+ //抽奖时间
|
|
|
+ // convertMinutesToHoursMinutes(totalMinutes) {
|
|
|
+ // const hours = Math.floor(totalMinutes / 60);
|
|
|
+ // const minutes = totalMinutes % 60;
|
|
|
+ // const seconds = totalMinutes % 3600;
|
|
|
+ // this.lotteryTime = {
|
|
|
+ // hours,
|
|
|
+ // minutes,
|
|
|
+ // seconds
|
|
|
+ // };
|
|
|
+ // },
|
|
|
|
|
|
toggleViewerList() {
|
|
|
const now = Date.now()
|
|
@@ -934,7 +1175,8 @@
|
|
|
|
|
|
this.viewLoading = true;
|
|
|
try {
|
|
|
- const res = await watchUserList(this.liveId, this.viewPageSize, this.viewPageNum, false);
|
|
|
+ const res = await watchUserList(this.liveId, this.viewPageSize, this.viewPageNum,
|
|
|
+ false);
|
|
|
if (res.code === 200) {
|
|
|
// 若请求期间已切换直播间,忽略旧数据
|
|
|
|
|
@@ -1130,7 +1372,7 @@
|
|
|
this.$set(this.liveItem, 'livingUrl', '');
|
|
|
this.$set(this.liveItem, 'videoUrl', '');
|
|
|
}
|
|
|
-
|
|
|
+ this.startTimeTimer(this.liveItem);
|
|
|
await this.getLiveMsg(this.liveItem);
|
|
|
await this.getliveViewData(this.liveItem);
|
|
|
|
|
@@ -1151,7 +1393,8 @@
|
|
|
if (!str) return '';
|
|
|
// 确保str是字符串(如果是数字等类型,先转为字符串)
|
|
|
const strVal = String(str);
|
|
|
- return strVal.split('').map((char, index) => (index === 0 ? char : maskChar)).join('');
|
|
|
+ return strVal.split('').map((char, index) => (index === 0 ? char : maskChar)).join(
|
|
|
+ '');
|
|
|
},
|
|
|
|
|
|
getPureDecimal(num, precision = 6) {
|
|
@@ -1220,7 +1463,9 @@
|
|
|
// const currentLive = this.liveItem;
|
|
|
if (!this.liveId) return;
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages_shop/goods?productId=' + productId + '&liveId=' + this.liveId +
|
|
|
+ url: '/pages_shop/goods?productId=' + productId + '&liveId=' +
|
|
|
+ this
|
|
|
+ .liveId +
|
|
|
'&goodsId=' + goodsId + '&storeId=' + this.storeId
|
|
|
})
|
|
|
},
|
|
@@ -1359,15 +1604,19 @@
|
|
|
} else if (socketMessage.cmd == 'lottery') {
|
|
|
this.lotteryInfo = JSON.parse(socketMessage.data);
|
|
|
if (socketMessage.status == 1) {
|
|
|
- this.isShowlottery = true
|
|
|
+ this.isShowLottery = true
|
|
|
let time = this.lotteryInfo.duration
|
|
|
this.lotteryTimer = setInterval(() => {
|
|
|
- this.isShowlottery = false
|
|
|
+ this.isShowLottery = false
|
|
|
}, time * 60000)
|
|
|
+ this.lotteryTime = time * 60 * 1000
|
|
|
+ // console.log("毫秒",this.lotteryTime)
|
|
|
+ // this.convertMinutesToHoursMinutes(time)
|
|
|
} else {
|
|
|
- this.isShowlottery = false
|
|
|
+ this.isShowLottery = false
|
|
|
}
|
|
|
- } else if (socketMessage.cmd == 'entry' || socketMessage.cmd == 'out') {
|
|
|
+ } else if (socketMessage.cmd == 'entry' || socketMessage.cmd ==
|
|
|
+ 'out') {
|
|
|
const oldList = this.talklist || [];
|
|
|
// 创建新数组并添加元素
|
|
|
const newList = [...oldList, messageData];
|
|
@@ -1385,6 +1634,9 @@
|
|
|
msg: socketMessage.msg,
|
|
|
status: true
|
|
|
}
|
|
|
+ } else if (socketMessage.cmd == 'LotteryDetail') {
|
|
|
+ this.prizeInfo = JSON.parse(socketMessage.data);
|
|
|
+ this.isShowPrize = socketMessage.status === 1;
|
|
|
} else if (socketMessage.cmd == 'blockUser') {
|
|
|
uni.removeStorage({
|
|
|
key: 'AppToken',
|
|
@@ -1806,6 +2058,51 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ .prize-card {
|
|
|
+ width: 504rpx;
|
|
|
+ padding: 40rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 34rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ margin: 0rpx 0 40rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .prize-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .name {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ .txt {
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #C32008;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .button {
|
|
|
+ width: 392rpx;
|
|
|
+ height: 96rpx;
|
|
|
+ line-height: 96rpx;
|
|
|
+ background: linear-gradient(180deg, #FFF4D5 0%, #FFE5B1 100%);
|
|
|
+ border-radius: 48rpx 48rpx 48rpx 48rpx;
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 36rpx;
|
|
|
+ color: #C32008;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
.red-card {
|
|
|
width: 504rpx;
|
|
|
height: 636rpx;
|
|
@@ -2170,10 +2467,12 @@
|
|
|
}
|
|
|
|
|
|
.item-group {
|
|
|
- position: absolute;
|
|
|
- top: 250rpx;
|
|
|
- left: 0;
|
|
|
width: 100%;
|
|
|
+ // position: absolute;
|
|
|
+ // top: 250rpx;
|
|
|
+ // left: 0;
|
|
|
+ // width: 100%;
|
|
|
+ // height: 500rpx;
|
|
|
}
|
|
|
|
|
|
// .item-group {
|
|
@@ -2226,7 +2525,7 @@
|
|
|
// }
|
|
|
|
|
|
.point-group {
|
|
|
- margin: 220rpx 0 50rpx;
|
|
|
+ margin: 20rpx 0 50rpx;
|
|
|
display: flex;
|
|
|
gap: 6rpx;
|
|
|
|