import{_ as a,aj as e,s as t,u as s,az as i,m as l,f as o,r,eK as c,bF as n,o as d,c as u,d as m,v as g,b as v,F as p,g as A,a0 as h,p as y,aF as U,t as k,e as E,$ as N,q as C,bI as b,E as f,bJ as G,aH as V,aU as B,bH as S}from"./index-BhrLSE9x.js";import{_ as F}from"./theme-C6sWowPh.js";const j={key:0,class:"recent-list"},w={class:"lists"},z={class:"item-wrapper"},I=["onClick"],M={class:"img-box"},P=["data-src","data-error"],q={class:"tags"},D={key:1,class:"tag ellipsis"},Q=["onClick","src"],R=["onClick"],T={key:0,class:"maintain"},Y={class:"time"},J={key:1,class:"empty"},K=a({__name:"recentlyList",emits:["updateFavorite"],setup(a,{emit:K}){const Z=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAAAM1BMVEUAAABVUEpYUEhWUEpVUElVUElVUElVUElQUFBVUElUUEhWUElWUEpVUElXUElTUElVUEkKNPNHAAAAEHRSTlMAnyCA379g7xCQQK8wz3BQu6ngDQAAAVhJREFUWMPtltuSwiAMhiFAQs95/6fdcSqbuBwsU71avrtq/Az/BKgZDAb/hJ34OttasUTuIlQ0wF34hmaz16C2xplrhKEZmi9r7Ec0yNMHNOCZ8b7GMjOtdzRybPh4U+ObhxPgckmD/KA1ArGlkXwTR9YI4gzy3NJM/AuBrpnoeaLjBQ2woGN2+mN8q1lYY1PBxi+4NxrkV/YzU89/cG1NVj+f83gScE8FR0vj8jsJjEF1P80p/ljXAAuqnU2vRJZV1VjOIGNWfrLof/JVDZbv610pzcEJqGk850x6BkBPJ1Y0eb6nPcgv9cNe1gDVNdIayTdljWV+t6ggcdcWtXARq+OgiGoSck3zlehQUi/KvrctMJGKbfZpnNoiYUUSfZeGomzwVYKypqRptzNLqgvX741IrXZkj/spWcCUmG0D9yjwrAhi6QQsqaP4BhFt8H6ZZjMYDL7ID9MvRjXvYVkzAAAAAElFTkSuQmCC",import.meta.url).href,L=e(),{userInfo:x}=t(L),W=s(),O=i(),{theme:_}=l(),X=K;o((()=>{ea()}));const H=r(!1),$=r(!1),aa=r({pageNo:1,list:[],totalCount:0,pageSize:30}),ea=async(a=!1)=>{if(!x.value.token)return;if(a&&(aa.value.pageNo=1,aa.value.list=[],aa.value.totalCount=0,H.value=!0,$.value=!1),$.value)return;const e={pageNo:aa.value.pageNo,pageSize:aa.value.pageSize,queryType:0};try{const a=await c(e);aa.value.totalCount=a.data.totalCount,1===a.data.pageNo?aa.value.list=a.data.records:aa.value.list.push(...a.data.records||[]),H.value=!1,aa.value.list.length>=a.data.totalCount?$.value=!0:aa.value.pageNo++}catch(t){H.value=!1,$.value=!0}},ta={0:"",1:"NEW",2:"热门",3:"推荐"},sa={0:"",1:"#4B64AC",2:"#EB544D",3:"#EB544D"},ia=async a=>{x.value.token?(1==+a.isFavorite?b({thirdSubGameId:a.gameId?a.gameId:a.id}).then((()=>{aa.value.list.forEach((e=>{e.id===a.id&&(e.isFavorite=0)})),f({message:"取消收藏成功!",type:"success"})})):G({thirdSubGameId:a.gameId?a.gameId:a.id}).then((()=>{aa.value.list.forEach((e=>{e.id===a.id&&(e.isFavorite=1)})),f({message:"收藏成功!",type:"success"})})),V((()=>{X("updateFavorite")}))):W.setLoginShowAction(!0)},la=a=>{const e=Number(B(new Date).diff(a,"hour"));let t="";if(e>=0)switch(!0){case 0<=e&&e<=24:t="最近";break;case 24<e&&e<=720:t=`${Math.ceil(e/24)}天前`;break;case 720<e&&e<=8640:t=`${Math.ceil(e/24/30)}个月前`;break;case 8640<e:t=`${Math.ceil(e/24/30/12)}年前`}return t};return(a,e)=>{const t=S,s=n("lazy-container");return aa.value.list.length>0?(d(),u("div",j,[e[0]||(e[0]=m("div",{class:"tips"},"我访问过的游戏",-1)),m("div",w,[aa.value.list.length>0?(d(),g(t,{key:0},{default:v((()=>[m("div",z,[(d(!0),u(p,null,A(aa.value.list,(a=>(d(),u("div",{class:"items",key:a.id,onClick:e=>(async a=>{if(!x.value.token)return void W.setLoginShowAction(!0);if("ZYCP"===a.thirdGameCode)return void O.push({path:"/home/lottery",query:{lotteryId:a.gameCode??80032}});const e={thirdGameCode:a.thirdGameCode,gameCode:a.gameCode||a.pcRedirectParam||"",gameName:a.gameName||a.thirdGameName,id:a.id};O.push({name:"ThirdGame",params:{game:JSON.stringify(e)}})})(a)},[h((d(),u("div",M,[m("img",{class:"img","data-src":a.gamePcLogoUrl?a.gamePcLogoUrl:y(Z),"data-error":y(Z),alt:""},null,8,P)])),[[s,{selector:"img"}]]),m("div",q,[0!==a.cornerType?(d(),u("span",{key:0,class:"tag tag1",style:U({"background-color":sa[a.cornerType]})},k(ta[a.cornerType]),5)):E("",!0),a.thirdGameShortName?(d(),u("span",D,k(a.thirdGameShortName),1)):E("",!0),1===a.isFavorite?(d(),u("img",{key:2,class:"icon",onClick:N((e=>ia(a)),["stop"]),src:y(C)(`main/collected_${y(_)}.png`),alt:""},null,8,Q)):(d(),u("img",{key:3,class:"icon",onClick:N((e=>ia(a)),["stop"]),src:F,alt:""},null,8,R))]),1===a.isMaintain?(d(),u("div",T,"维护中")):E("",!0),m("div",Y,k(la(a.lastDateTime)),1)],8,I)))),128))])])),_:1})):(d(),u("div",J,"还未访问过任何游戏"))])])):E("",!0)}}},[["__scopeId","data-v-d8609bb1"]]);export{K as default};
