living.js 24 KB

1
  1. "use strict";const t=require("../../common/vendor.js"),V=require("../../api/list.js"),u=require("../../api/live.js");require("../../api/order.js");const b=require("../../api/home.js"),h=require("../../common/assets.js");var M="wss://live.test.ylrztop.com/ws/live-api/app/webSocket",w=!1;const U={data(){return{timer:null,isShowRed:!1,lastSwiperChangeTime:0,swiperChangeThrottle:300,lastClickTime:0,clickDelay:300,connectingLiveId:null,swiperDuration:0,videoRetryCounts:{},socketInstances:{},currentSwiperIndex:0,list:[],liveUserTotal:null,viewPageSize:10,viewPageNum:1,viewLoading:!1,viewNoMoreData:!1,scrollHeight:0,scrollTimer:null,socketInstance:null,reconnectCount:0,maxReconnectAttempts:3,isManualClose:!1,showRed:!0,searchTimer:null,reconnectTimer:null,isCollect:!1,showPurchasePrompt:!1,purchasePromptTimer:null,prevOrderCount:0,videoUrl:null,showType:1,boxHeight:300,liveViewers:[],likeName:0,hlsPlayer:null,livingUrl:"",products:{},store:{},orderUser:{},userType:0,timestamp:"",liveId:null,userinfo:"",talkdisabled:!1,autoplay:!1,showadd:!1,scrollIntoView:"",videoContext:"",livedata:{}}},onLoad(e){this.initTime(),e.liveId&&(this.liveId=e.liveId),this.userinfo=JSON.parse(t.index.getStorageSync("userInfo")),this.initLiveList(e);const s=t.index.getWindowInfo().platform;["mp-weixin","mp-alipay","mp-baidu","mp-toutiao"].includes(s)&&(t.index.showShareMenu?t.index.showShareMenu({withShareTicket:!0,success:()=>{console.log("分享菜单显示成功")},fail:i=>{console.error("分享菜单显示失败:",i)}}):console.warn("当前平台不支持 uni.showShareMenu")),this.getCurrentActivities(e.liveId)},onReady(){},onShareAppMessage(){return{title:this.livedata.liveName,path:"/pages/home/living",imageUrl:this.products.image,success(e){console.log("分享成功",e)},fail(e){console.error("分享失败",e)}}},computed:{filteredViewers(){return Array.isArray(this.liveViewers)?this.liveViewers.slice(0,3):[]}},onHide(){const e=this.list[this.currentSwiperIndex];e&&(this.pauseVideo(e),this.clearTimeTimer(e)),this.closeAllWebSockets()},onUnload(){this.list.forEach(e=>{this.clearTimeTimer(e)}),this.closeAllWebSockets(),this.socketInstances={},this.removeAllEventListeners(),this.clearAllTimers(),this.hlsPlayer&&(this.hlsPlayer.destroy(),this.hlsPlayer=null),this.list.forEach(e=>{const s=`myVideo_${e.liveId}`,i=t.index.createVideoContext(s,this);i&&i.pause()})},watch:{"orderUser.count":{handler(e,s){e!==this.prevOrderCount&&(this.prevOrderCount=e,this.showPurchaseMessage())},immediate:!0}},methods:{onLiveStateChange(e,s){e.detail.code},onLiveError(e,s){this.videoError(e,s)},getCurrentActivities(e){e.liveId&&u.currentActivities(e.liveId).then(s=>{s.code==200?(this.$set(e,"goodsCard",s.goods),this.$set(e,"redInfo",s.red[0]),this.isShowRed=!0,this.$set(e,"lottery",s.lottery)):t.index.showToast({title:s.msg,icon:"none"})},s=>{})},calculateTimeDiff(e){if(!e.startTime){e.totalTime="00小时00分钟00秒";return}const s=e.startTime.replace(/-/g,"/").replace(" "," "),i=new Date(e.startTime),c=new Date;if(isNaN(i.getTime())){console.warn(`iOS 时间解析失败,原始时间:${e.startTime},转换后:${s}`),e.totalTime="00小时00分钟00秒";return}const a=Math.max(0,c-i),o=Math.floor(a/1e3),d=this.padZero(Math.floor(o/3600)),r=this.padZero(Math.floor(o%3600/60)),g=this.padZero(o%60);this.$set(e,"totalTime",`${d}:${r}:${g}`)},padZero(e){return e<10?`0${e}`:e},startTimeTimer(e){e.timeTimer&&clearInterval(e.timeTimer),this.calculateTimeDiff(e),e.timeTimer=setInterval(()=>{this.calculateTimeDiff(e)},1e3)},clearTimeTimer(e){e.timeTimer&&(clearInterval(e.timeTimer),e.timeTimer=null)},toggleViewerList(){const e=Date.now();e-this.lastClickTime>this.clickDelay&&(this.showadd=!this.showadd,this.lastClickTime=e)},resetUserListParams(){this.viewPageNum=1,this.viewNoMoreData=!1,this.liveViewers=[]},closeAllWebSockets(){this.isManualClose=!0,Object.keys(this.socketInstances).forEach(e=>{try{this.socketInstances[e]&&this.socketInstances[e].instance&&(this.socketInstances[e].instance.close({code:1e3,reason:"页面关闭"}),console.log(`直播间 ${e} WebSocket 已关闭`))}catch(s){console.error(`关闭直播间 ${e} WebSocket 时出错:`,s)}}),this.socketInstances={},w=!1},removeAllEventListeners(){t.index.$off("initSocket"),t.index.$off("sendMsg"),t.index.$off("closeWebSocket"),t.index.$off("refreshOrder")},clearAllTimers(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.pingpangTimes&&(clearInterval(this.pingpangTimes),this.pingpangTimes=null),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null),this.scrollTimer&&(clearTimeout(this.scrollTimer),this.scrollTimer=null),this.searchTimer&&(clearTimeout(this.searchTimer),this.searchTimer=null),this.purchasePromptTimer&&(clearTimeout(this.purchasePromptTimer),this.purchasePromptTimer=null)},async initCurrentLiveData(){const e=this.list[this.currentSwiperIndex];if(!(!e||!e.liveId)){e.loading=!0;try{await this.initSocket(e),await Promise.allSettled([this.getLiveMsg(e),this.getCurrentActivities(e),this.getliveViewData(e),this.getliving(e)]),e.loaded=!0,this.startTimeTimer(e)}catch(s){console.error("初始化直播间数据失败:",s)}finally{e.loading=!1}}},async initLiveList(e){try{if(await this.getList(),this.list.length===0){console.error("直播间列表为空,无法初始化");return}if(e.liveId){const i=this.list.findIndex(c=>c.liveId==e.liveId);this.currentSwiperIndex=i!==-1?i:0}else this.currentSwiperIndex=0;setTimeout(()=>{this.swiperDuration=300},100);const s=this.list[this.currentSwiperIndex];s&&(this.liveId=s.liveId,this.resetUserListParams(),this.preloadNearbyLives(!1),await this.initCurrentLiveData(),setTimeout(()=>{this.playVideo(s)},500))}catch(s){console.error("初始化失败:",s)}},async onSwiperChange(e){const s=Date.now(),i=e.detail.current,c=this.currentSwiperIndex;if(i===c)return;if(s-this.lastSwiperChangeTime<this.swiperChangeThrottle){console.log("Swiper切换过快,已节流");return}this.lastSwiperChangeTime=s;const a=this.list[c];if(a&&(this.closeWebSocket(a.liveId),clearInterval(this.pingpangTimes),this.pingpangTimes=null),this.timer&&(clearInterval(this.timer),this.timer=null),this.closeShop(),a&&(this.pauseVideo(a),this.clearTimeTimer(a),this.socketInstances[a.liveId])){try{this.socketInstances[a.liveId].instance.close({code:1e3,reason:"切换直播间"}),console.log(`关闭旧直播间 ${a.liveId} WebSocket`)}catch(d){console.error("关闭旧连接失败:",d)}delete this.socketInstances[a.liveId]}this.currentSwiperIndex=i;const o=this.list[i];o&&(this.liveId=o.liveId,this.resetUserListParams(),await this.initCurrentLiveData(),setTimeout(()=>{this.playVideo(o)},100))},async getList(){const e={page:1,page_size:20};try{const s=await V.liveList(e);s.code===200?(this.list=s.rows.map(i=>({...i,talklist:[],loading:!1,loaded:!1,shopping:!1,inputInfo:"",showWelcomeMessage:!1,redInfo:{},goodsCard:{},totalTime:"00小时00分钟00秒",timeTimer:null,startTime:i.startTime?i.startTime.replace(/-/g,"/"):""})),console.log("直播间列表加载成功,数量:",this.list.length)):(t.index.showToast({title:s.msg,icon:"none"}),this.list=[])}catch(s){console.error("获取直播间列表失败:",s),this.list=[]}},playVideo(e){if(e)try{if(e.liveType===1&&e.livingUrl){const s=`myLivePlayer_${e.liveId}`,i=t.index.createLivePlayerContext(s,this);i&&i.play()}else if(e.liveType===2&&e.videoUrl){const s=`myVideo_${e.liveId}`,i=t.index.createVideoContext(s,this);i&&i.pause(()=>{i.play()})}}catch(s){console.error("播放视频失败:",s)}},pauseVideo(e){if(e)try{if(e.liveType===1){const s=`myLivePlayer_${e.liveId}`,i=t.index.createLivePlayerContext(s,this);i&&i.pause()}else if(e.liveType===2){const s=`myVideo_${e.liveId}`,i=t.index.createVideoContext(s,this);i&&i.pause()}}catch(s){console.error("暂停视频失败:",s)}},async preloadNearbyLives(e=!1){const s=this.currentSwiperIndex,i=[];s>0&&i.push(s-1),s<this.list.length-1&&i.push(s+1);for(const c of i){const a=this.list[c];if(!(!a||a.loaded||a.loading)){a.loading=!0;try{await Promise.all([this.getliving(a),this.getLiveMsg(a),this.getCurrentActivities(a),this.getliveViewData(a)]),a.loaded=!0}catch{a.loaded=!1}finally{a.loading=!1}}}},openViews(){this.$nextTick(()=>{t.index.createSelectorQuery().in(this).select(".view-box").boundingClientRect(s=>{s&&(this.scrollHeight=s.height-80-120)}).exec()})},resetLiveData(){const e={userinfo:this.userinfo,list:this.list,currentSwiperIndex:this.currentSwiperIndex};this.liveUserTotal=null,this.liveViewers=[],this.livingUrl="",this.videoUrl=null,this.products={},this.store={},this.orderUser={},this.talklist=[],this.livedata={},this.shopping=!1,this.inputInfo="",Object.assign(this,e)},async getliveUser(e=!1){const s=this.liveId;if(s){this.viewLoading=!0;try{const i=await u.watchUserList(s,this.viewPageSize,this.viewPageNum,!1);if(i.code===200){if(this.liveId!==s)return;if(this.liveUserTotal=i.total,i.rows.length===0){this.viewNoMoreData=!0;return}this.liveViewers=e?[...this.liveViewers,...i.rows]:i.rows,this.viewPageNum++}}catch(i){console.error("获取观众列表失败:",i)}finally{this.viewLoading=!1}}},handleScrollToLower(){this.scrollTimer&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{},1e3)},async getLiveMsg(e){if(!e||!e.liveId){console.error("getLiveMsg 错误:无效的 liveItem",{liveItem:e,currentIndex:this.currentSwiperIndex,listLength:this.list.length});return}try{const s=await u.liveMsg(e.liveId,30,1);if(s.code==200){const c=[...Array.isArray(s.rows)?s.rows:[]].reverse();this.$set(e,"talklist",c),this.$nextTick(()=>{this.$set(e,"scrollIntoView",`list_${c.length-1}`)})}}catch(s){console.error("获取聊天记录失败:",s)}},onRed(e){var i;if(!e.liveId||!((i=e.redInfo)!=null&&i.redId))return;let s={liveId:e.liveId,userId:this.userinfo.userId,redId:e.redInfo.redId};u.liveRed(s).then(c=>{this.isShowRed=!1,c.code==200?(console.log(this.isShowRed),console.log("点了this.liveId",liveItem.redInfo),t.index.showToast({title:c.msg,icon:"none"})):t.index.showToast({title:c.msg,icon:"none"})},c=>{})},handleSearchInput(){clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>{this.queryCollect()},500)},showPurchaseMessage(){this.purchasePromptTimer&&clearTimeout(this.purchasePromptTimer),this.showPurchasePrompt=!0,this.purchasePromptTimer=setTimeout(()=>{this.showPurchasePrompt=!1},2e3)},truncateString(e,s){return e.length>s?e.slice(0,s)+"...":e},goStore(e){if(console.log("带过去storeId",e),!e.storeId){t.index.showToast({title:"当前直播间暂未开通店铺",icon:"none"});return}t.index.navigateTo({url:"/pages_shop/store?liveId="+e.liveId+"&storeId="+e.storeId})},goOrderList(){t.index.navigateTo({url:"/pages_shop/order"})},initHlsPlayer(){if(t.Hls.isSupported()&&this.livingUrl){const e=document.getElementById("myVideo");e&&(this.hlsPlayer=new t.Hls,this.hlsPlayer.loadSource(this.livingUrl),this.hlsPlayer.attachMedia(e),this.hlsPlayer.on(t.Hls.Events.MANIFEST_PARSED,()=>{e.play()}))}},videoError(e,s){if(!(!s||s.liveId!==this.liveId)){if(this.videoRetryCounts[s.liveId]===void 0&&(this.videoRetryCounts[s.liveId]=0),this.videoRetryCounts[s.liveId]>=3){console.error(`直播间 ${s.liveId} 视频加载失败,停止重试`),t.index.showToast({title:"视频加载失败,请检查网络",icon:"none",duration:2e3});return}this.videoRetryCounts[s.liveId]++,setTimeout(()=>{s.liveId===this.liveId&&(console.log(`第${this.videoRetryCounts[s.liveId]}次重试播放视频`),this.playVideo(s))},2e3)}},async getliving(e){if(!(!e||!e.liveId)){e.liveId;try{const s=await b.getlive({id:e.liveId});if(s.code!==200){t.index.showToast({title:s.msg,icon:"none"});return}s.data.liveType===2?(this.$set(e,"videoUrl",s.data.videoUrl),this.$set(e,"livingUrl",""),this.$set(e,"placeholderText","说点什么...")):s.data.liveType===1?(this.$set(e,"livingUrl",s.data.flvHlsUrl),this.$set(e,"videoUrl",""),this.$set(e,"placeholderText","说点什么...")):(this.$set(e,"livingUrl",""),this.$set(e,"videoUrl",""));const i=this.currentSwiperIndex===this.list.findIndex(c=>c.liveId===e.liveId);this.$set(e,"autoplay",i&&s.data.liveType!==0),this.$set(e,"showType",s.data.showType),this.$set(e,"storeId",s.storeId),this.queryCollect()}catch(s){console.error("获取直播信息失败:",s),t.index.showToast({title:"获取直播信息失败",icon:"none"})}}},setupVideoPlayback(e,s){if(!e.livingUrl)return;const i=`myVideo_${e.liveId}`,c=t.index.createVideoContext(i,this);s.liveType===1?c.seek(s.nowDuration||0):c.play()},maskString(e,s="*"){return e?String(e).split("").map((c,a)=>a===0?c:s).join(""):""},getPureDecimal(e,s=6){const i=Math.abs(e).toFixed(s).split(".")[1];return(i==null?void 0:i.replace(/0+$/,""))||""},goBack(){const e=this.list[this.currentSwiperIndex];e&&this.pauseVideo(e),this.closeWebSocket(),getCurrentPages().length>1?t.index.navigateBack():t.index.reLaunch({url:"/pages/list/index"})},async getliveOrder(){const e=this.liveId;if(e)try{const s=await u.liveOrderUser(e);if(s.code===200){const i=this.list[this.currentSwiperIndex];i&&(this.$set(i,"orderUser",s),this.orderUser=s)}}catch(s){console.error("获取正在购买用户失败:",s)}},getLiveinformation(){this.liveId&&u.getLiveInfo(this.liveId).then(e=>{e.code==200?(console.log("获取直播间信息接口>>>>",e),this.livingUrl=e.livingUrl):t.index.showToast({title:e.msg,icon:"none"})},e=>{})},async onLike(e){if(!(!e||!e.liveId))try{const s=await u.liveDataLike(e.liveId);s!=null&&s.like?e.liveViewData.like++:t.index.showToast({title:s.msg,icon:"none"})}catch(s){console.error("点赞失败:",s)}},async getliveViewData(e){if(!(!e||!e.liveId))try{const s=await u.getLiveViewData(e.liveId);s.code==200&&this.$set(e,"liveViewData",s)}catch(s){console.error("获取直播间数据失败:",s),this.$set(e,"liveViewData",{like:0,watchCount:0})}},goShop(e,s){const i=this.list[this.currentSwiperIndex];!i||!i.liveId||t.index.navigateTo({url:"/pages_shop/goods?productId="+e+"&liveId="+i.liveId+"&goodsId="+s+"&storeId="+i.storeId})},async queryCollect(){const e=this.list[this.currentSwiperIndex];if(!e||!e.liveId)return;const{storeId:s}=e;if(s)try{const i=await u.liveStore(e.liveId,e.inputInfo);i.code===200&&(this.$set(e,"products",i.data),this.products=i.data)}catch(i){console.error("获取小黄车商品失败:",i)}},onStoreCollect(e){console.log("店铺收藏",e),e.storeId&&u.collectStore(e.storeId).then(s=>{s.code==200?(t.index.showToast({title:s.msg,icon:"none"}),e.store.isFavorite=!e.store.isFavorite):t.index.showToast({title:s.msg,icon:"none"})},s=>{})},onGoodsCollect(e){console.log("商品收藏",e),!(!e||e.length===0||!e.goodsId)&&u.collectGoods(e.goodsId).then(s=>{s.code==200?(t.index.showToast({title:s.msg,icon:"none"}),e.isFavorite=!e.isFavorite):t.index.showToast({title:s.msg,icon:"none"})},s=>{})},initTime(){const e=new Date;this.timestamp=e.getTime()},openShop(){},openViews(){this.$nextTick(()=>{t.index.createSelectorQuery().in(this).select(".view-box").boundingClientRect(s=>{s&&(this.scrollHeight=s.height-80-120)}).exec()})},openCart(e){if(!e.storeId){t.index.showToast({title:"当前直播间暂未开通店铺",icon:"none"});return}e.shopping=!0},close(){this.showadd=!1},closeShop(){const e=this.list[this.currentSwiperIndex];e&&this.$set(e,"shopping",!1)},getEWechatSdk(){},closeWebSocket(e=null){if(this.isManualClose=!0,clearInterval(this.pingpangTimes),clearInterval(this.reconnectTimer),e){if(this.socketInstances[e]&&this.socketInstances[e].instance)try{this.socketInstances[e].instance.close()}catch{}delete this.socketInstances[e]}else Object.keys(this.socketInstances).forEach(s=>{if(this.socketInstances[s]&&this.socketInstances[s].instance)try{this.socketInstances[s].instance.close()}catch{}}),this.socketInstances={};w=!1},startHeartbeat(e){clearInterval(this.pingpangTimes),this.pingpangTimes=setInterval(()=>{const s=this.socketInstances[e];if(!s||!s.isOpen||!s.instance)return;const i={cmd:"ping",timestamp:Date.now()};try{s.instance.send({data:JSON.stringify(i)})}catch{this.scheduleReconnect(e)}},3e4)},async initSocket(e){const s=this.list[this.currentSwiperIndex];if(!s||s.liveId!==e.liveId||!e||!e.liveId)return;const i=e.liveId;if(this.connectingLiveId===i||this.socketInstances[i]&&this.socketInstances[i].isOpen||this.currentSwiperIndex!==this.list.findIndex(o=>o.liveId===i))return;if(this.socketInstances[i]={instance:null,isOpen:!1},this.closeWebSocket(i),this.connectingLiveId=i,this.reconnectCount>=this.maxReconnectAttempts){this.connectingLiveId=null;return}this.isManualClose=!1;const c=setTimeout(()=>{var o;(o=this.socketInstances[i])!=null&&o.isOpen||(console.error(`WebSocket连接超时: ${i}`),this.scheduleReconnect(i))},1e4),a=t.CryptoJS.HmacSHA256(`${i}${this.userinfo.userId}${this.userType}${this.timestamp}`,this.timestamp.toString()).toString(t.CryptoJS.enc.Hex);this.socketInstances[i]={instance:null,isOpen:!1};try{const o=t.index.connectSocket({url:`${M}?userId=${this.userinfo.userId}&liveId=${i}&userType=${this.userType}&timestamp=${this.timestamp}&signature=${a}`,success:()=>{},fail:d=>{this.connectingLiveId=null,this.scheduleReconnect(i)}});o.onOpen(d=>{console.log("WebSocket 连接已成功建立",d),this.socketInstances[i].instance=o,this.socketInstances[i].isOpen=!0,clearTimeout(c),w=!0,this.connectingLiveId=null,this.reconnectCount=0,this.startHeartbeat(i)}),o.onMessage(d=>{const r=this.list.find(g=>g.liveId===i);r&&this.handleSocketMessage(d,r)}),o.onError(d=>{clearTimeout(c),this.connectingLiveId=null,this.scheduleReconnect(i)}),o.onClose(()=>{console.log(`WebSocket 连接已关闭: ${i}`),this.connectingLiveId=null})}catch(o){console.error("创建 WebSocket 异常:",o),this.connectingLiveId=null,this.scheduleReconnect(i)}},handleSocketMessage(e,s){let i=JSON.parse(e.data);const c=i.data;if(i.code==200){const a={...c,cmd:c.cmd||"",ts:Date.now()};if(c.cmd=="sendMsg")this.$set(s,"talklist",[...s.talklist||[],a]),this.$nextTick(()=>{const o=s.talklist.length-1;this.$set(s,"scrollIntoView",`list_${o}`)});else if(c.cmd=="red")this.$set(s,"redInfo",JSON.parse(c.data)),this.isShowRed=!0,this.timer=setInterval(()=>{this.isShowRed=!0},s.redInfo.duration*1e3);else if(c.cmd=="entry"||c.cmd=="out")this.$set(s,"talklist",[...s.talklist,a]),this.$set(s,"showWelcomeMessage",!1),this.$set(s,"showWelcomeMessage",!0),this.getliveUser(!1),s.welcomeTimer&&clearTimeout(s.welcomeTimer),s.welcomeTimer=setTimeout(()=>{this.$set(s,"showWelcomeMessage",!1)},1e3);else if(c.cmd=="Integral"){let o={msg:c.msg,status:!0};this.$set(s,"integral",o)}else c.cmd=="blockUser"?t.index.removeStorage({key:"AppToken",success:()=>{t.index.reLaunch({url:"/pages/auth/login"})}}):c.cmd=="goods"&&this.$set(s,"goodsCard",JSON.parse(c.data))}else t.index.showToast({title:i.msg,icon:"none"})},scheduleReconnect(e){if(this.isManualClose||this.reconnectCount>=this.maxReconnectAttempts)return;this.reconnectCount++;const s=Math.min(3e3*this.reconnectCount,3e4);clearInterval(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{const i=this.list.find(c=>c.liveId===e)||{liveId:e};this.initSocket(i)},s)},sendMsg(e){if(!e||!e.liveId||e.isSending)return;e.isSending=!0,setTimeout(()=>{e.isSending=!1},800);const s=(e.value||"").trim();if(!s){t.index.showToast({title:"不能发送空消息",icon:"none"});return}const i=e.liveId,c=this.socketInstances[i];if(this.$set(e,"value",""),!c||!c.instance||!c.isOpen){this.initSocket(e),t.index.showToast({title:"连接未建立,正在重连",icon:"none"});return}const a={liveId:i,userId:this.userinfo.userId,userType:0,cmd:"sendMsg",msg:s,nickName:this.userinfo.nickName,avatar:this.userinfo.avatar};try{c.instance.send({data:JSON.stringify(a),success:()=>{},fail:o=>{t.index.showToast({title:o,icon:"none"}),this.$set(e,"value",s)}})}catch{}}}};if(!Array){const e=t.resolveComponent("u-avatar"),s=t.resolveComponent("u-input"),i=t.resolveComponent("u-popup");(e+s+i)()}const D=()=>"../../uni_modules/uview-plus/components/u-avatar/u-avatar.js",N=()=>"../../uni_modules/uview-plus/components/u-input/u-input.js",$=()=>"../../uni_modules/uview-plus/components/u-popup/u-popup.js";Math||(D+N+$)();function R(e,s,i,c,a,o){var d;return{a:t.f(a.list,(r,g,p)=>{var v,T,y,S,k,x,m,C,I,L,_;return t.e({a:t.o((...n)=>o.goBack&&o.goBack(...n),r.liveId),b:"471975a0-0-"+p,c:t.p({src:r.liveImgUrl||e.$img.logo,size:"32"}),d:t.t(r.liveName?o.truncateString(r.liveName,8):"未命名")},Array.isArray(o.filteredViewers)?{e:t.f(o.filteredViewers,(n,l,f)=>({a:l,b:n.avatar||e.$img.logo}))}:{},{f:t.o((...n)=>o.toggleViewerList&&o.toggleViewerList(...n),r.liveId),g:t.o(n=>o.onLike(r),r.liveId),h:t.t(((v=r.liveViewData)==null?void 0:v.like)||0),i:t.n(r.showType==1?"siderow-group":"side-group"),j:((T=r.redInfo)==null?void 0:T.redStatus)==1&&a.isShowRed},((y=r.redInfo)==null?void 0:y.redStatus)==1&&a.isShowRed?{k:t.o(n=>o.onRed(r),r.liveId),l:h._imports_3}:{},a.showPurchasePrompt&&((S=a.orderUser)!=null&&S.count)?{m:h._imports_4,n:t.t(a.orderUser.userName?o.maskString(a.orderUser.userName):""),o:t.t(a.orderUser.count||0)}:{},{p:a.currentSwiperIndex===g&&r.livingUrl&&r.liveType===1},a.currentSwiperIndex===g&&r.livingUrl&&r.liveType===1?{q:"myLivePlayer_"+r.liveId,r:t.n(r.showType==1?"video_row":"videotop"),s:r.livingUrl,t:r.showType==1?"horizontal":"vertical",v:t.o(n=>o.onLiveStateChange(n,r),r.liveId),w:t.o(n=>o.onLiveError(n,r),r.liveId)}:{},{x:a.currentSwiperIndex===g&&r.videoUrl},a.currentSwiperIndex===g&&r.videoUrl?{y:t.n(r.showType==1?"video_row":"videotop"),z:r.videoUrl,A:a.currentSwiperIndex===g,B:t.o((...n)=>o.videoError&&o.videoError(...n),r.liveId)}:{},{C:r.videoUrl},r.videoUrl?{D:t.t(r.totalTime)}:{},{E:t.f(r.talklist,(n,l,f)=>({a:t.t(n.msg),b:l,c:n.cmd=="announcement"})),F:t.t(r.messageContent),G:t.f(r.talklist,(n,l,f)=>({a:t.t(n.nickName),b:t.t(n.msg),c:l,d:`list_${l}`,e:n.cmd!="red"&&n.cmd!="out"&&n.cmd!="entry"})),H:r.showWelcomeMessage},r.showWelcomeMessage?{I:t.f(r.talklist,(n,l,f)=>({a:t.t(n.nickName),b:t.t(n.msg),c:l,d:n.cmd=="entry"||n.cmd=="out"})),J:t.t(r.messageContent)}:{},{K:r.scrollIntoView,L:"471975a0-1-"+p,M:t.o(n=>r.value=n,r.liveId),N:t.p({placeholder:r.placeholderText,border:"none",customStyle:"font-size:24rpx;",shape:"circle",color:"#fff",placeholderStyle:"color:#e7e7e7",modelValue:r.value}),O:t.o(n=>o.sendMsg(r),r.liveId),P:t.o(n=>o.openCart(r),r.liveId),Q:t.o(n=>r.goodsCard.isShow=!1,r.liveId),R:(k=r.goodsCard)==null?void 0:k.imgUrl,S:t.t((x=r.goodsCard)==null?void 0:x.price),T:t.t((m=r.goodsCard)==null?void 0:m.otPrice),U:t.t((C=r.goodsCard)==null?void 0:C.productName),V:t.o(n=>{var l,f;return o.goShop((l=r.goodsCard)==null?void 0:l.productId,(f=r.goodsCard)==null?void 0:f.goodsId)},r.liveId),W:t.o(n=>{var l;return!((l=r.goodsCard)!=null&&l.isShow)},r.liveId),X:"471975a0-2-"+p,Y:t.p({show:(I=r.goodsCard)==null?void 0:I.isShow,round:"20rpx",mode:"center",bgColor:"#ffffff"}),Z:t.t((L=r.integral)==null?void 0:L.msg),aa:t.o(n=>r.integral.status=e.flase,r.liveId),ab:t.o(n=>{var l;return!((l=r.integral)!=null&&l.status)},r.liveId),ac:"471975a0-3-"+p,ad:t.p({show:(_=r.integral)==null?void 0:_.status,round:"20rpx",mode:"center",bgColor:"#ffffff"}),ae:t.f(a.liveViewers,(n,l,f)=>({a:t.t(l+1),b:l===0?"#FF3B30":l===1?"#FF9500":l===2?"#FFCC00":"#8E8E93",c:l<3?"bold":"normal",d:"471975a0-5-"+p+"-"+f+","+("471975a0-4-"+p),e:t.p({src:n.avatar||e.$img.logo,size:"32"}),f:t.t(n.nickName||"未命名"),g:l}))},a.viewNoMoreData&&a.liveViewers.length>0?{}:{},{af:t.o((...n)=>o.handleScrollToLower&&o.handleScrollToLower(...n),r.liveId),ag:t.o(o.close,r.liveId),ah:t.o(o.openViews,r.liveId),ai:"471975a0-4-"+p,aj:"471975a0-7-"+p+","+("471975a0-6-"+p),ak:t.o([n=>r.inputInfo=n.detail.value,(...n)=>o.handleSearchInput&&o.handleSearchInput(...n)],r.liveId),al:r.inputInfo,am:t.o(n=>o.goOrderList(r),r.liveId),an:t.f(a.products,(n,l,f)=>t.e({a:n.imgUrl,b:t.t(l+1),c:t.t(n.productName),d:t.t(n.sales),e:t.t(Math.trunc(n.price)),f:t.t(o.getPureDecimal(n.price)?o.getPureDecimal(n.price):"00"),g:n.isFavorite},n.isFavorite?{h:t.o(P=>o.onGoodsCollect(n),l),i:h._imports_11}:{j:t.o(P=>o.onGoodsCollect(n),l),k:h._imports_12},{l:n.status==1},n.status==1?{m:t.o(P=>o.goShop(n.productId,n.goodsId),l)}:n.status==0?{}:{},{n:n.status==0,o:l})),ao:t.o(o.closeShop,r.liveId),ap:t.o(o.openShop,r.liveId),aq:"471975a0-6-"+p,ar:t.p({show:r.shopping,round:"20rpx",bgColor:"f3f5f9"}),as:a.currentSwiperIndex===g?1:"",at:r.liveId})}),b:h._imports_0$2,c:Array.isArray(o.filteredViewers),d:t.t(a.liveUserTotal||0),e:h._imports_1$2,f:h._imports_2,g:a.showPurchasePrompt&&((d=a.orderUser)==null?void 0:d.count),h:h._imports_5,i:h._imports_6,j:h._imports_7,k:h._imports_8,l:a.viewNoMoreData&&a.liveViewers.length>0,m:a.scrollHeight+"px",n:t.p({show:a.showadd,round:"20rpx",bgColor:"#ffffff"}),o:t.p({src:a.store.logoUrl,size:"36"}),p:h._imports_1$3,q:h._imports_10,r:a.boxHeight+"px",s:a.currentSwiperIndex,t:t.o((...r)=>o.onSwiperChange&&o.onSwiperChange(...r)),v:a.swiperDuration}}const A=t._export_sfc(U,[["render",R],["__scopeId","data-v-471975a0"]]);U.__runtimeHooks=2;wx.createPage(A);