"use strict";const e=require("../../../../common/vendor.js"),t=require("../../../../components/request.js"),s=require("../../../../components/TimeFormatting.js"),o=require("../../../../components/goEasyTool/tool.js"),i={props:{oppositeId:{type:String,required:!0},myId:{type:String,required:!0},nickname:{type:String,required:!0},avatar:{type:String,required:!0}},data:()=>({select:null,mylist:[],oppositlist:[],selectedId:null,selectIndex:null,myselect:null,oppositselect:null,list:[]}),created(){this.getAnchorList(this.oppositeId),this.getAnchorList(this.myId)},methods:{send(){t.request({url:"pk/createPkRecord",method:"POST",data:{pkIdA:this.oppositselect.id,pkIdB:this.myselect.id,userIdA:this.oppositeId,userIdB:this.myId,pkTime:this.oppositselect.pkTime,pkNumber:this.oppositselect.pkNumber,anchorIdA:this.oppositselect.anchorId,anchorIdB:this.myselect.anchorId,anchorIconA:this.oppositselect.anchorIcon,anchorIconB:this.myselect.anchorIcon,piIdA:this.oppositselect.id,piIdB:this.myselect.id},userInfo:!0}).then((t=>{if(200==t.code){let s={customData:{id:t.data.id,pkIdA:this.oppositselect.id,pkIdB:this.myselect.id},link:"https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png",text:"PK邀请消息"},i="pk";o.sendCustomMessage(this.$goeasy,i,this.oppositeId,s,this.avatar,this.nickname).then((e=>{this.$emit("refreshMessage",{message:e})})),this.$refs.confirmpopup.close(),this.$refs.oppositepopup.close(),this.myselect=null,this.oppositselect=null,e.index.showToast({title:"发送成功",icon:"none"})}else e.index.showToast({title:t.msg,icon:"none"})}))},confirmClose(){this.$refs.confirmpopup.close()},sendMessage(){this.myselect&&this.oppositselect?this.$refs.confirmpopup.open("center"):e.index.showToast({title:"请选择相应的主播",icon:"none"})},Select(e,t){this.selectedId===e?(this.selectedId=null,this.selectIndex=null):(this.selectedId=this.selectedId===e?null:e,this.selectIndex=t)},close(){this.$refs.oppositepopup.close()},invite(){this.selectedId?1==this.select?(this.oppositselect=this.oppositlist[this.selectIndex],this.selectedId=null,this.selectIndex=null):(this.myselect=this.mylist[this.selectIndex],this.selectedId=null,this.selectIndex=null):e.index.showToast({title:"请选择主播",icon:"none"}),this.$refs.oppositepopup.close()},TimeFormatting:s.TimeFormatting,getAnchorList(s){t.request({url:"pk/listUninvitedPublishedAnchorsByUserId",method:"POST",data:{userId:s},userInfo:!1}).then((t=>{200==t.code?s==this.myId?(this.mylist=t.data,console.log("mylist",this.mylist)):(this.oppositlist=t.data,console.log("oppositlist",this.oppositlist)):e.index.showToast({title:t.msg,icon:"none"})}))},showPopup(e){this.list=1==e?this.oppositlist:this.mylist,this.select=e,this.$refs.oppositepopup.open("center")}}};if(!Array){e.resolveComponent("uni-popup")()}Math;const l=e._export_sfc(i,[["render",function(t,s,o,i,l,n){return e.e({a:null!=l.oppositselect},null!=l.oppositselect?{b:l.oppositselect.anchorIcon,c:e.t(l.oppositselect.anchorId),d:e.t(n.TimeFormatting(l.oppositselect.pkTime)),e:e.t(l.oppositselect.coin)}:{},{f:null==l.oppositselect},(l.oppositselect,{}),{g:e.o((e=>n.showPopup(1))),h:null!=l.myselect},null!=l.myselect?{i:l.myselect.anchorIcon,j:e.t(l.myselect.anchorId),k:e.t(n.TimeFormatting(l.myselect.pkTime)),l:e.t(l.myselect.coin)}:{},{m:null==l.myselect},(l.myselect,{}),{n:e.o((e=>n.showPopup(0))),o:e.o((e=>n.sendMessage())),p:e.o((()=>{})),q:e.t(1==l.select?"点击选择您要参与PK的对方主播":"点击选择您要参与的主播"),r:l.list.length>0},l.list.length>0?{s:e.f(l.list,((t,s,o)=>({a:t.anchorIcon,b:e.t(t.anchorId),c:e.t(n.TimeFormatting(t.pkTime)),d:e.t(t.coin),e:e.o((e=>n.Select(t.id,s)),s),f:l.selectedId===t.id?"#b8ff8c74":"#ffffff",g:s})))}:{},{t:0==l.list.length},0==l.list.length?{v:e.t(1==l.select?"对方还没有发布过pk":"您还没有发布过pk")}:{},{w:e.o((e=>n.invite())),x:e.o((e=>n.close())),y:e.sr("oppositepopup","cbeee28e-0"),z:e.o(t.change),A:e.p({"background-color":"#fff","border-radius":"30px"}),B:e.o((e=>n.send())),C:e.o((e=>n.confirmClose())),D:e.sr("confirmpopup","cbeee28e-1"),E:e.o(t.change),F:e.p({"background-color":"#fff","border-radius":"30px"})})}],["__scopeId","data-v-cbeee28e"]]);wx.createComponent(l);
