|
@@ -26,7 +26,7 @@
|
|
|
|
|
|
</view>
|
|
|
<!-- 右边的 -->
|
|
|
- <view :class=" liveItem.showType==1 ? 'siderow-group' : 'side-group'">
|
|
|
+ <view class="side-group">
|
|
|
<view class="side-item">
|
|
|
<image class="image" @click="onLike(liveItem)" src="/static/images/like.png">
|
|
|
</image>
|
|
@@ -35,21 +35,13 @@
|
|
|
<!-- -->
|
|
|
<view class="side-item">
|
|
|
<button open-type="share" class="button">
|
|
|
- <image class="image" src="/static/images/share.png" mode="widthFix"></image>
|
|
|
+ <image class="image" src="/static/images/wechat.png" mode="widthFix"></image>
|
|
|
</button>
|
|
|
<view>分享</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <!-- <view class="hongbao-box" v-if="redInfo?.redStatus==1&&isShowRed">
|
|
|
- <view class="u-flex-y-center">
|
|
|
- <view class="tip">领红包</view>
|
|
|
- <view class="item">
|
|
|
- <image @click="onRed()" src="/static/images/redbag.png" mode="widthFix">
|
|
|
- </image>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
+
|
|
|
<view class="activity-box">
|
|
|
<!-- v-if="redInfo?.redStatus==1&&isShowRed" -->
|
|
|
<view class="item-box" @click="onRed()" v-if="isShowRed">
|
|
@@ -90,7 +82,7 @@
|
|
|
class=" item"></live-player> -->
|
|
|
<live-player v-if="liveItem.livingUrl && liveItem.liveType === 1" :id="'myLivePlayer_' + liveId"
|
|
|
:src="liveItem.livingUrl" autoplay mode="live" object-fit="contain" :muted="false"
|
|
|
- orientation="vertical" :enable-play-gesture="true"
|
|
|
+ orientation="vertical" :enable-play-gesture="true" min-cache="1" max-cache="3"
|
|
|
@statechange="onLiveStateChange($event, liveItem)" @error="onLiveError($event, liveItem)"
|
|
|
class="item"></live-player>
|
|
|
|
|
@@ -133,26 +125,16 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 底部聊天区域 -->
|
|
|
- <view class="pb40 " style="position: fixed;bottom: 120rpx;width: 100%;">
|
|
|
- <view class="w100 mt20" style="height: 35vh;">
|
|
|
+ <!-- class="pb20" -->
|
|
|
+ <view :style="{position: 'fixed',width: '100%',bottom: chatHeight + 'rpx',zIndex:999}">
|
|
|
+ <view class="w100 mt20" style="height: 30vh;">
|
|
|
<scroll-view enable-flex scroll-y="true" class=" p20 scrolly flex-1 column"
|
|
|
- style="width: calc(100% - 40rpx);height: calc(100% - 40rpx);"
|
|
|
+ style="width: calc(100% - 40rpx);height: calc(100% - 20rpx);"
|
|
|
:scroll-into-view="scrollIntoView">
|
|
|
- <!-- <view>
|
|
|
- <view class="list justify-start" v-for="(item,talkIndex) in inAndOut" :key="talkIndex"
|
|
|
- v-show="item.cmd=='announcement'">
|
|
|
- <view class="talk-list ml16 justify-start">
|
|
|
- <view class="fs30">
|
|
|
- <text class='colorf'>
|
|
|
- {{item.msg}}直播间{{liveItem.messageContent}}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
|
|
|
<view class="list justify-start" v-for="(item,talkIndex) in talklist" :key="talkIndex"
|
|
|
:id="`list_${talkIndex}`" v-show="item.cmd!='red'&&item.cmd!='out'&&item.cmd!='entry'">
|
|
|
- <view class="talk-list ml16 justify-start">
|
|
|
+ <view class="talk-list justify-start">
|
|
|
<view class="fs30">
|
|
|
<text style="color: #FFDA73;">{{item.nickName}}:</text>
|
|
|
<text class='colorf'>{{item.msg}}</text>
|
|
@@ -161,7 +143,7 @@
|
|
|
</view>
|
|
|
<view v-if="showWelcomeMessage" class="welcome-message">
|
|
|
<view class="list justify-start" v-show="inAndOut.cmd=='entry'||inAndOut.cmd=='out'">
|
|
|
- <view class="talk-list ml16 justify-start">
|
|
|
+ <view class="talk-list justify-start">
|
|
|
<view class="fs30">
|
|
|
<text style="color: #ff89d6;">{{inAndOut.nickName}} </text>
|
|
|
<text class='colorf'>
|
|
@@ -179,7 +161,8 @@
|
|
|
style="background:rgba(57, 57, 57, 1);padding:10rpx 14rpx 10rpx 32rpx;box-sizing:border-box;border-radius:36rpx;">
|
|
|
<u-input :placeholder="placeholderText" border="none" customStyle='font-size:24rpx;'
|
|
|
v-model="value" shape='circle' color='#fff' placeholderStyle='color:#e7e7e7'
|
|
|
- class="ml20" @focus="inputFocus" @blur="inputBlur">
|
|
|
+ :adjust-position="false" :scroll-with-animation="false" class="ml20" @focus="inputFocus"
|
|
|
+ @blur="inputBlur">
|
|
|
</u-input>
|
|
|
<view class="send" @click="sendMsg()">发送</view>
|
|
|
</view>
|
|
@@ -190,6 +173,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
<view class="goods" v-if="isShowGoods">
|
|
@@ -197,9 +181,12 @@
|
|
|
<view class="left">
|
|
|
<image class="w30 h30 mr8" src="/static/images/signal.png"></image>讲解中
|
|
|
</view>
|
|
|
- <image class="w44 h44 mr10" src="/static/images/close.png" @click="isShowGoods=false">
|
|
|
- </image>
|
|
|
+ <view class="close-box mr4" @click="isShowGoods=false">
|
|
|
+ <image class="w34 h34 " src="/static/images/close.png">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+
|
|
|
<image class="photo" :src="goodsCard?.imgUrl"></image>
|
|
|
<view class="item">
|
|
|
<view class="price"><text class="red">¥{{goodsCard?.price}} </text><text
|
|
@@ -211,27 +198,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <!-- <u-popup :show="isShowGoods" @close="!isShowGoods" round='20rpx' mode="center" zIndex='10099'
|
|
|
- bgColor='#ffffff'>
|
|
|
- <view class="goods">
|
|
|
- <view class="top">
|
|
|
- <view class="left">
|
|
|
- <image class="w30 h30 mr8" src="/static/images/signal.png"></image>讲解中
|
|
|
- </view>
|
|
|
- <image class="w44 h44 mr10" src="/static/images/close.png" @click="isShowGoods=false">
|
|
|
- </image>
|
|
|
- </view>
|
|
|
- <image class="photo" :src="goodsCard?.imgUrl"></image>
|
|
|
- <view class="item">
|
|
|
- <view class="price"><text class="red">¥{{goodsCard?.price}} </text><text
|
|
|
- class="del">¥{{goodsCard?.otPrice}}</text></view>
|
|
|
- <view class="title oneline-hide">{{goodsCard?.productName}}</view>
|
|
|
- <view class="button" @click="goShop(goodsCard?.productId,goodsCard?.goodsId)">
|
|
|
- 立即抢购
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </u-popup> -->
|
|
|
<u-popup :show="isShowLotteryPop" @close="!isShowLotteryPop" round='40rpx'>
|
|
|
<view class="prize-box" style="border-radius: 40rpx;height: fit-content;">
|
|
|
<image class="nav-img " src="/static/images/red_head.png" mode="widthFix"></image>
|
|
@@ -243,48 +209,28 @@
|
|
|
<view class="column align-center ">
|
|
|
<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">{{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">
|
|
|
+ 开奖倒计时
|
|
|
+
|
|
|
+ <u-count-down :time="lotteryTime" format="HH:mm:ss" autoStart millisecond
|
|
|
+ @change="onChange" :key="lotteryTime">
|
|
|
<view class="u-flex-y-center">
|
|
|
<view class="white-item">
|
|
|
- {{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}
|
|
|
+ {{ timeData.hours>=10?timeData.hours:'0'+timeData.hours}}
|
|
|
+ </view>
|
|
|
+ <view class="white-item">
|
|
|
+ {{ timeData.minutes>=10?timeData.minutes:'0'+timeData.minutes }}
|
|
|
+ </view>
|
|
|
+ <view class="white-item">
|
|
|
+ {{ timeData.seconds>=10?timeData.seconds:'0'+timeData.seconds }}
|
|
|
</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>
|
|
|
- </view> -->
|
|
|
<view class="item-group">
|
|
|
<ThreeItemSwiper :products="lotteryProducts"></ThreeItemSwiper>
|
|
|
</view>
|
|
|
-
|
|
|
- <!-- <view class="item-group">
|
|
|
- <view class="item center">
|
|
|
- <image class="w280 h280" src="/static/images/img.png"></image>
|
|
|
- <view v-show="true" class="title">二等奖</view>
|
|
|
- <view v-show="true" class="txt">新用户免费领礼品弹窗</view>
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
<view class="point-group" v-for="(item,index) in lotteryProducts" :key="index">
|
|
|
- <!-- <view class="item" v-if="item.length"
|
|
|
- :class="{ selected: activePointIndex === 0 }" @click="activePointIndex = 0">
|
|
|
- </view> -->
|
|
|
- <!-- <view class="item" :class="{ selected: activePointIndex === 1 }"
|
|
|
- @click="() => { activePointIndex = 1; scrollToCenterItem() }"></view>
|
|
|
- <view class="item" :class="{ selected: activePointIndex === 2 }"
|
|
|
- @click="activePointIndex = 2"></view> -->
|
|
|
</view>
|
|
|
<view class="colorf fs28">
|
|
|
观看直播参与抽奖
|
|
@@ -347,18 +293,15 @@
|
|
|
<u-avatar :src="item.avatar||$img.logo" size="36"></u-avatar>
|
|
|
<text class="ml16 f30">{{item.nickName||"未命名"}}</text>
|
|
|
</view>
|
|
|
- <!-- <view class="no-more" v-if="viewNoMoreData && liveViewers.length > 0">
|
|
|
- <text>没有更多了</text>
|
|
|
- </view> -->
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
|
|
|
+
|
|
|
<!-- 商品弹窗 -->
|
|
|
<u-popup :show="shopping" @close="closeShop" round='20rpx' bgColor='f3f5f9' zIndex='10075'>
|
|
|
<view class="shoppop">
|
|
|
<view class="shoppop-top">
|
|
|
- <!-- <u-avatar :src="store.logoUrl" size="36" class="ml16"></u-avatar> -->
|
|
|
<view class="search-input u-flex-y-center">
|
|
|
<image class="w24 mr16" src="/static/images/search.png" mode="widthFix">
|
|
|
</image>
|
|
@@ -452,6 +395,9 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ chatHeight: 0,
|
|
|
+ keyboardHeight: 0,
|
|
|
+ // inputHeight: null,
|
|
|
videoCurrentTime: 0, // 当前视频播放时间
|
|
|
isVideoPlaying: false, // 视频是否正在播放
|
|
|
videoProgressKey: '', // 存储进度的key
|
|
@@ -460,7 +406,7 @@
|
|
|
isShowPrize: false,
|
|
|
prizeInfo: [],
|
|
|
timeData: {},
|
|
|
- lotteryTime: 0,
|
|
|
+ lotteryTime: null,
|
|
|
lotteryProducts: [],
|
|
|
lotteryList: [],
|
|
|
talklist: {},
|
|
@@ -501,7 +447,6 @@
|
|
|
viewPageSize: 10, // 每页数量
|
|
|
viewPageNum: 1, // 当前页码
|
|
|
viewLoading: false, // 是否正在加载
|
|
|
- viewNoMoreData: false, // 是否没有更多数据
|
|
|
scrollHeight: 0,
|
|
|
scrollTimer: null, // 滚动防抖定时器
|
|
|
|
|
@@ -547,20 +492,16 @@
|
|
|
|
|
|
|
|
|
onLoad(options) {
|
|
|
+
|
|
|
+ this.keyboardListener = uni.onKeyboardHeightChange(res => {
|
|
|
+ console.log('键盘高度', res.height);
|
|
|
+ this.keyboardHeight = res.height * 2;
|
|
|
+ });
|
|
|
this.initTime();
|
|
|
- console.log(options)
|
|
|
if (options.liveId) {
|
|
|
this.liveId = options.liveId; // 仅当 liveId 变化时更新
|
|
|
}
|
|
|
this.userinfo = JSON.parse(uni.getStorageSync("userInfo"))
|
|
|
- if (this.liveId == null) {
|
|
|
- uni.showToast({
|
|
|
- title: "未知错误,请联系管理员!",
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- console.log(this.liveId)
|
|
|
// 初始化直播间列表
|
|
|
this.getliving(this.liveId);
|
|
|
this.initSocket();
|
|
@@ -637,13 +578,14 @@
|
|
|
|
|
|
// 清除定时器
|
|
|
if (this.redTimer) {
|
|
|
- clearInterval(this.redTimer);
|
|
|
+ clearTimeout(this.redTimer);
|
|
|
this.redTimer = null;
|
|
|
}
|
|
|
if (this.lotteryTimer) {
|
|
|
- clearInterval(this.lotteryTimer);
|
|
|
+ clearTimeout(this.lotteryTimer);
|
|
|
this.lotteryTimer = null;
|
|
|
}
|
|
|
+ this.lotteryTime = 0; // 重置时间
|
|
|
if (this.welcomeTimer) {
|
|
|
clearInterval(this.welcomeTimer);
|
|
|
this.welcomeTimer = null;
|
|
@@ -698,6 +640,25 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ inputFocus() {
|
|
|
+ this.chatHeight = this.keyboardHeight;
|
|
|
+ this.isFocus = true;
|
|
|
+ },
|
|
|
+ inputBlur() {
|
|
|
+ this.chatHeight = 0;
|
|
|
+ this.isFocus = false
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ // resetCountdown() {
|
|
|
+ // // 先停止
|
|
|
+ // this.$refs.countDownRef && this.$refs.countDownRef.stop();
|
|
|
+
|
|
|
+ // // 重新设置时间并启动
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.countDownRef && this.$refs.countDownRef.start();
|
|
|
+ // });
|
|
|
+ // },
|
|
|
// 录播时间点
|
|
|
onVideoMetaLoaded(e) {
|
|
|
// 设置存储key
|
|
@@ -784,9 +745,7 @@
|
|
|
onClaim() {
|
|
|
let data = {
|
|
|
liveId: this.liveId,
|
|
|
- // integral: this.integral,
|
|
|
lotteryId: this.lotteryInfo.lotteryId,
|
|
|
- // userId: this.userinfo.userId
|
|
|
}
|
|
|
|
|
|
claim(data).then(res => {
|
|
@@ -809,10 +768,6 @@
|
|
|
},
|
|
|
// 点击抽奖图标
|
|
|
onLottery() {
|
|
|
- if (this.lotteryTimer) {
|
|
|
- clearInterval(this.lotteryTimer);
|
|
|
- this.lotteryTimer = null;
|
|
|
- }
|
|
|
if (!this.lotteryInfo) return;
|
|
|
|
|
|
let data = {
|
|
@@ -821,11 +776,14 @@
|
|
|
|
|
|
// 抽奖查询
|
|
|
liveLottery(data).then(res => {
|
|
|
- // this.isShowLottery = false
|
|
|
- this.isShowLotteryPop = true
|
|
|
if (res.code == 200) {
|
|
|
this.lotteryList = res.data
|
|
|
this.lotteryProducts = res.data.products
|
|
|
+
|
|
|
+ if (res.data.duration) {
|
|
|
+ // this.lotteryTime = res.data.duration * 60 * 1000; // 重新赋值
|
|
|
+ this.isShowLotteryPop = true
|
|
|
+ }
|
|
|
// this.startTimeTimer(this.lotteryList, "lottery");
|
|
|
} else {
|
|
|
uni.showToast({
|
|
@@ -860,12 +818,6 @@
|
|
|
rej => {}
|
|
|
);
|
|
|
},
|
|
|
- inputFocus() {
|
|
|
- this.isFocus = true
|
|
|
- },
|
|
|
- inputBlur() {
|
|
|
- this.isFocus = false
|
|
|
- },
|
|
|
|
|
|
//正在购买
|
|
|
|
|
@@ -906,52 +858,34 @@
|
|
|
getCurrentActivities() {
|
|
|
if (!this.liveId) return;
|
|
|
currentActivities(this.liveId).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- // 商品卡片
|
|
|
- // 红包
|
|
|
- if (res.red) {
|
|
|
- this.redInfo = res.red[0];
|
|
|
- }
|
|
|
- if (res.lottery) {
|
|
|
- this.lotteryInfo = res.lottery[0];
|
|
|
- }
|
|
|
-
|
|
|
- this.goodsCard = res.goods;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 抽奖
|
|
|
- this.lotteryTime = this.lotteryInfo?.duration * 60 * 1000
|
|
|
-
|
|
|
- if (this.goodsCard && this.goodsCard.status == 1) {
|
|
|
-
|
|
|
- this.isShowGoods = true
|
|
|
- } else {
|
|
|
- this.isShowGoods = false
|
|
|
- }
|
|
|
-
|
|
|
- if (this.redInfo && this.redInfo.redStatus == 1) {
|
|
|
-
|
|
|
- this.isShowRed = true
|
|
|
- } else {
|
|
|
- this.isShowRed = false
|
|
|
- }
|
|
|
- if (this.lotteryInfo && this.lotteryInfo.lotteryStatus == 1) {
|
|
|
- this.isShowLottery = true
|
|
|
- } else {
|
|
|
- this.isShowLottery = false
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ if (res.code === 200) {
|
|
|
+ // 提取数据(默认空数组/对象避免报错)
|
|
|
+ this.redInfo = (res.red || [])[0];
|
|
|
+ this.lotteryInfo = (res.lottery || [])[0];
|
|
|
+ this.goodsCard = res.goods || {};
|
|
|
+
|
|
|
+ // 抽奖时间计算
|
|
|
+ this.lotteryTime = this.lotteryInfo?.duration * 60 * 1000;
|
|
|
+
|
|
|
+ this.isShowGoods = this.goodsCard && this.goodsCard.status == 1;
|
|
|
+ this.isShowRed = this.redInfo && this.redInfo.redStatus == 1;
|
|
|
+ this.isShowLottery = this.lotteryInfo && this.lotteryInfo.lotteryStatus == 1;
|
|
|
+
|
|
|
+ // 处理抽奖定时器
|
|
|
+ clearTimeout(this.lotteryTimer); // 先清除旧定时器
|
|
|
+ if (this.isShowLottery) {
|
|
|
+ this.lotteryTimer = setTimeout(() => {
|
|
|
+ this.isShowLottery = this.isShowLotteryPop = false;
|
|
|
+ }, this.lotteryInfo.duration * 60000);
|
|
|
}
|
|
|
- },
|
|
|
- rej => {}
|
|
|
- );
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, rej => {});
|
|
|
+
|
|
|
},
|
|
|
// 计算当前时间与 liveItem.startTime 的差值,并更新 totalTime
|
|
|
calculateTimeDiff(item, type = "") {
|
|
@@ -987,11 +921,11 @@
|
|
|
// 防御3:时间解析失败(Invalid Date),兜底显示
|
|
|
if (isNaN(time.getTime())) {
|
|
|
if (type === "lottery") {
|
|
|
- this.lotteryTime = {
|
|
|
- hours: "00",
|
|
|
- minutes: "00",
|
|
|
- seconds: "00"
|
|
|
- };
|
|
|
+ // this.lotteryTime = {
|
|
|
+ // hours: "00",
|
|
|
+ // minutes: "00",
|
|
|
+ // seconds: "00"
|
|
|
+ // };
|
|
|
} else {
|
|
|
this.$set(this.liveItem, "totalTime", "00:00:00");
|
|
|
}
|
|
@@ -1374,17 +1308,15 @@
|
|
|
this.liveItem = res.data;
|
|
|
this.talklist = res.data.talklist;
|
|
|
|
|
|
- // 强制更新视频源(覆盖旧值)
|
|
|
- if (res.data.liveType === 2) {
|
|
|
- // 回放视频
|
|
|
- this.$set(this.liveItem, 'videoUrl', res.data.videoUrl);
|
|
|
- this.$set(this.liveItem, 'livingUrl', ''); // 清空直播流
|
|
|
-
|
|
|
-
|
|
|
- } else if (res.data.liveType === 1) {
|
|
|
+ if (res.data.liveType === 1) {
|
|
|
// 直播流
|
|
|
this.$set(this.liveItem, 'livingUrl', res.data.flvHlsUrl);
|
|
|
this.$set(this.liveItem, 'videoUrl', ''); // 清空回放视频
|
|
|
+
|
|
|
+ } else if (res.data.liveType === 2||res.data.liveType === 3) {
|
|
|
+ // 回放视频 2录播 3直播回放
|
|
|
+ this.$set(this.liveItem, 'videoUrl', res.data.videoUrl);
|
|
|
+ this.$set(this.liveItem, 'livingUrl', ''); // 清空直播流
|
|
|
} else {
|
|
|
// 未开播
|
|
|
this.$set(this.liveItem, 'livingUrl', '');
|
|
@@ -1443,6 +1375,7 @@
|
|
|
},
|
|
|
// 点赞
|
|
|
async onLike(liveItem) {
|
|
|
+ console.log("dian")
|
|
|
if (!liveItem || !this.liveId) return;
|
|
|
try {
|
|
|
const res = await liveDataLike(this.liveId);
|
|
@@ -1540,19 +1473,11 @@
|
|
|
},
|
|
|
initSocket() {
|
|
|
|
|
|
-
|
|
|
- if (!this.liveId||this.userinfo?.userId ) return;
|
|
|
-
|
|
|
- // 设置正在连接的直播间ID
|
|
|
- // this.connectingLiveId = liveId;
|
|
|
-
|
|
|
- // 生成签名
|
|
|
+ if (!this.liveId) return;
|
|
|
const signature = CryptoJS.HmacSHA256(
|
|
|
`${this.liveId}${this.userinfo.userId}${this.userType}${this.timestamp}`,
|
|
|
this.timestamp.toString()
|
|
|
).toString(CryptoJS.enc.Hex);
|
|
|
-
|
|
|
-
|
|
|
try {
|
|
|
const socketTask = uni.connectSocket({
|
|
|
url: `${wsUrl}?userId=${this.userinfo.userId}&liveId=${this.liveId}&userType=${this.userType}×tamp=${this.timestamp}&signature=${signature}`,
|
|
@@ -1600,34 +1525,32 @@
|
|
|
});
|
|
|
} else if (socketMessage.cmd == 'red') {
|
|
|
this.redInfo = JSON.parse(socketMessage.data);
|
|
|
-
|
|
|
- if (socketMessage.status == 1) {
|
|
|
- this.isShowRed = true
|
|
|
- let time = this.redInfo.duration
|
|
|
- this.redTimer = setInterval(() => {
|
|
|
- this.isShowRed = false
|
|
|
- }, time * 60000)
|
|
|
- } else {
|
|
|
- this.isShowRed = false
|
|
|
+ this.isShowRed = socketMessage.status === 1;
|
|
|
+ if (this.isShowRed) {
|
|
|
+ const time = this.redInfo.duration * 60000;
|
|
|
+ this.redTimer = setTimeout(() => this.isShowRed = false, time);
|
|
|
}
|
|
|
|
|
|
} else if (socketMessage.cmd == 'goods') {
|
|
|
this.goodsCard = JSON.parse(socketMessage.data);
|
|
|
- if (socketMessage.status == 1) {
|
|
|
- this.isShowGoods = true
|
|
|
- } else {
|
|
|
- this.isShowGoods = false
|
|
|
- }
|
|
|
+ this.isShowGoods = socketMessage.status == 1;
|
|
|
|
|
|
} else if (socketMessage.cmd == 'lottery') {
|
|
|
+
|
|
|
this.lotteryInfo = JSON.parse(socketMessage.data);
|
|
|
- if (socketMessage.status == 1) {
|
|
|
- this.isShowLottery = true
|
|
|
- let time = this.lotteryInfo.duration
|
|
|
- this.lotteryTimer = setInterval(() => {
|
|
|
- this.isShowLottery = false
|
|
|
- }, time * 60000)
|
|
|
- this.lotteryTime = time * 60 * 1000
|
|
|
+ this.isShowLottery = socketMessage.status === 1;
|
|
|
+
|
|
|
+ // 清除已有定时器(无论状态是否为1,先清掉旧的)
|
|
|
+ clearTimeout(this.lotteryTimer);
|
|
|
+
|
|
|
+ if (this.isShowLottery) {
|
|
|
+ this.lotteryTime = this.lotteryInfo.duration * 60 * 1000;
|
|
|
+ this.lotteryTimer = setTimeout(() => {
|
|
|
+ this.isShowLottery = false;
|
|
|
+ this.isShowLotteryPop = false;
|
|
|
+ }, this.lotteryTime);
|
|
|
+
|
|
|
+
|
|
|
// this.convertMinutesToHoursMinutes(time)
|
|
|
} else {
|
|
|
this.isShowLottery = false
|
|
@@ -1656,6 +1579,7 @@
|
|
|
this.prizeInfo = JSON.parse(socketMessage.data);
|
|
|
this.isShowPrize = true;
|
|
|
this.isShowLottery = false
|
|
|
+ this.isShowLotteryPop = false;
|
|
|
} else if (socketMessage.cmd == 'blockUser') {
|
|
|
uni.removeStorage({
|
|
|
key: 'AppToken',
|
|
@@ -1804,7 +1728,7 @@
|
|
|
.welcome-message {
|
|
|
position: fixed;
|
|
|
width: 100%;
|
|
|
- bottom: 700rpx;
|
|
|
+ bottom: 38vh;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
color: white;
|
|
@@ -1942,42 +1866,11 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- .siderow-group {
|
|
|
- position: absolute;
|
|
|
- top: 65%;
|
|
|
- right: 30rpx;
|
|
|
- z-index: 9;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- .side-item {
|
|
|
- font-weight: 500;
|
|
|
- font-size: 24rpx;
|
|
|
- color: #FFFFFF;
|
|
|
- margin-bottom: 32rpx;
|
|
|
- text-align: center;
|
|
|
-
|
|
|
- .button {
|
|
|
- background-color: transparent;
|
|
|
- margin: 0;
|
|
|
- line-height: 1;
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
-
|
|
|
- .image {
|
|
|
- width: 72rpx;
|
|
|
- height: 72rpx;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
.side-group {
|
|
|
position: absolute;
|
|
|
- // top: 30%;
|
|
|
top: 65%;
|
|
|
right: 30rpx;
|
|
|
- z-index: 9;
|
|
|
+ z-index: 1000;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
@@ -2037,17 +1930,16 @@
|
|
|
}
|
|
|
|
|
|
.input-box {
|
|
|
- position: fixed;
|
|
|
- bottom: 20rpx;
|
|
|
-
|
|
|
+ // position: fixed;
|
|
|
+ // bottom: 20rpx;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
.videolist {
|
|
|
position: relative;
|
|
|
height: 100vh;
|
|
|
width: 100%;
|
|
|
|
|
|
-
|
|
|
.video {
|
|
|
height: 100vh;
|
|
|
width: 100%;
|
|
@@ -2074,8 +1966,6 @@
|
|
|
color: #fff;
|
|
|
border-radius: 15rpx;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.video_row {
|
|
@@ -2083,10 +1973,7 @@
|
|
|
top: 18%;
|
|
|
max-height: 500rpx;
|
|
|
z-index: 99;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.prize-card {
|
|
@@ -2114,7 +2001,6 @@
|
|
|
.txt {
|
|
|
font-weight: 600;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.tip {
|
|
@@ -2134,15 +2020,13 @@
|
|
|
color: #ffffff;
|
|
|
text-align: center;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.red-card {
|
|
|
- width: 504rpx;
|
|
|
+ width: 550rpx;
|
|
|
height: 636rpx;
|
|
|
position: relative;
|
|
|
|
|
|
-
|
|
|
image {
|
|
|
position: absolute;
|
|
|
width: 100%;
|
|
@@ -2201,7 +2085,8 @@
|
|
|
}
|
|
|
|
|
|
.integral-box {
|
|
|
- width: 500rpx;
|
|
|
+ min-width: 400rpx;
|
|
|
+ max-width: 600rpx;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
@@ -2284,8 +2169,16 @@
|
|
|
align-items: center;
|
|
|
border-radius: 10rpx;
|
|
|
}
|
|
|
+
|
|
|
+ .close-box {
|
|
|
+ padding: 4rpx 6rpx 0;
|
|
|
+ border-radius: 4rpx;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
.photo {
|
|
|
width: 100%;
|
|
|
height: 180rpx;
|
|
@@ -2293,6 +2186,8 @@
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
.item {
|
|
|
padding: 4rpx;
|
|
|
|