"use strict";const e=require("../../../common/vendor.js"),t=require("../../../components/request.js"),r=require("../../../components/formatDate.js"),o={data:()=>({triggered:!1,current:1,buttonWidth:238.55,gap:0,slidetext:"我发布的PK",pkmyRecordlist:[],pkInvitationRecordlist:[],pkRecordlist:[],userinfo:{},page:0}),onLoad(){e.index.getStorage({key:"userinfo",success:e=>{this.userinfo=e.data,this.getPkRecordList(1),this.getPkRecordList(2)}})},computed:{sliderPosition(){const{current:e,buttonWidth:t,gap:r}=this;return 0+(t+r)*(e-1)+375}},methods:{onRefresherRefresh(){this.pkRecordlist=[],this.triggered=!0,this.page=0,1===this.current?this.pkmyRecordlist=[]:this.pkInvitationRecordlist=[],this.getPkRecordList(this.current)},onScrollToLower(){this.page++,this.getPkRecordList(this.current)},onItemClick(t){e.index.navigateTo({url:"/pages/Mine/minecomponents/DetailsPKRecords/DetailsPKRecords",success:e=>{e.eventChannel.emit("itemDetail",{item:t})}})},onBack(){e.index.navigateBack({delta:1})},formatDate:r.formatDate,getPkRecordList(e){t.request({url:"user/handlePkInfo",method:"POST",data:{type:e,userId:this.userinfo.id,page:this.page,size:10},userInfo:!0}).then((t=>{200===t.code?(this.triggered=!1,1===e?(this.pkmyRecordlist.push(...t.data),1===this.current&&(this.pkRecordlist=this.pkmyRecordlist)):(this.pkInvitationRecordlist.push(...t.data),2===this.current&&(this.pkRecordlist=this.pkInvitationRecordlist))):console.log(t.msg)}))},toggleActive(e){this.current=e,this.slidetext=1===e?"我发布的PK":"我邀请的PK",this.pkRecordlist=1===e?this.pkmyRecordlist:this.pkInvitationRecordlist}}};if(!Array){e.resolveComponent("uni-card")()}const i=e._export_sfc(o,[["render",function(t,r,o,i,s,n){return e.e({a:e.o$1(((...e)=>n.onBack&&n.onBack(...e))),b:e.o$1((e=>n.toggleActive(1))),c:1===s.current?1:"",d:e.o$1((e=>n.toggleActive(2))),e:2===s.current?1:"",f:e.t(s.slidetext),g:n.sliderPosition+"rpx",h:0!==s.pkRecordlist.length},0!==s.pkRecordlist.length?{i:e.f(s.pkRecordlist,((t,r,o)=>e.e({a:t.anchorIconA,b:t.winnerAnchorId==t.anchorIdA},(t.winnerAnchorId,t.anchorIdA,{}),{c:e.t(t.anchorIdA),d:e.t(n.formatDate(t.pkTime)),e:null!==t.userACoins},null!==t.userACoins?{f:e.t(t.userACoins)}:{},{g:e.t(t.anchorIdB),h:e.t(n.formatDate(t.pkTime)),i:null!==t.userBCoins},null!==t.userBCoins?{j:e.t(t.userBCoins)}:{},{k:t.anchorIconB,l:t.winnerAnchorId==t.anchorIdB},(t.winnerAnchorId,t.anchorIdB,{}),{m:e.o$1((e=>n.onItemClick(t)),r),n:r,o:"100ab26e-0-"+o}))),j:e.o$1(((...e)=>n.onRefresherRefresh&&n.onRefresherRefresh(...e))),k:e.o$1(((...e)=>n.onScrollToLower&&n.onScrollToLower(...e))),l:s.triggered}:{},{m:0===s.pkRecordlist.length},(s.pkRecordlist.length,{}))}],["__scopeId","data-v-100ab26e"]]);wx.createPage(i);
