@cpany/app
Version:
CPany web app
2 lines (1 loc) • 3.51 kB
JavaScript
import{m as S,o as p,c as f,a as t,d as N,y as x,G as V,z as w,g as F,h as o,i as e,H as M,I as j,w as a,j as K,t as r,k as d,J as H,l as R,K as Y,L as G}from"./index-DQ3P2Jm7.js";import{I as J}from"./account-Cn5wceoV.js";import{l as k}from"./load-Bav7-mWT.js";import{c as U}from"./codeforces-De0leWJ9.js";import{C as i,a as Z}from"./c-table-BNgV5wWB.js";const q={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},O=t("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14"},null,-1),P=[O];function Q(_,c){return p(),f("svg",q,P)}const W=S({name:"ic-baseline-search",render:Q}),X={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},ee=t("path",{fill:"currentColor",d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"},null,-1),te=[ee];function se(_,c){return p(),f("svg",X,te)}const oe=S({name:"mdi-close",render:se}),ne=[],ae=k(U),le=k(ne),m=[...ae,...le].sort((_,c)=>c.startTime-_.startTime),ce={class:"divide-y"},ue=t("h2",{class:"mb-4"},"所有比赛",-1),re={class:"my-4 relative"},ie={class:"font-600"},de={class:"flex flex-1 items-center justify-center"},_e=d(" "),he=t("div",{class:"my-4 px-3"},"好像都没有找到比赛?",-1),me={key:0,class:"mt-4 flex justify-center"},pe=d("↓ 浏览更多"),fe={class:"mt-4 pt-4 text-gray-400"},ve=d(" 共 "),Ce={class:"font-mono"},ge=d(" 场比赛 "),De=N({__name:"Contests",setup(_){const c=Y*2,b="contest.size",v="contest.search",y=s=>sessionStorage.getItem(s),A=()=>{const s=y(b);return s!==null?+s:c},C=(s,u)=>{sessionStorage.setItem(s,u)},n=x(y(v)??""),g=x([]),L=()=>{n.value!==""?(g.value=m.filter(s=>s.name.toLowerCase().includes(n.value.toLowerCase())),C(v,n.value)):C(v,"")};L();const I=G(L,500);V(n,()=>{I()});const h=x(m.slice(0,A())),B=w(()=>n.value===""?h.value:g.value),$=()=>{const s=h.value.length;h.value.push(...m.slice(s,s+c)),C(b,String(h.value.length))},D=w(()=>n.value===""?m.length:g.value.length);return(s,u)=>{const E=F("router-link"),T=F("c-button");return p(),f("div",ce,[ue,t("div",null,[t("div",re,[o(e(W),{class:"absolute text-xl icon-search"}),M(t("input",{type:"text",name:"contest_search",id:"contest_search",class:"input-search w-full py-2 pr-2 outline-transparent rounded-md <md:shadow-box border border-light-900","onUpdate:modelValue":u[0]||(u[0]=l=>n.value=l)},null,512),[[j,n.value]]),o(e(oe),{onClick:u[1]||(u[1]=l=>n.value=""),class:"absolute text-xl icon-close text-gray-400 outline-transparent rounded-full focus:bg-light-400"})]),o(e(Z),{data:e(B)},{columns:a(({row:l,index:z})=>[o(e(i),{label:"#",center:""},{default:a(()=>[t("span",ie,r(z+1),1)]),_:2},1024),o(e(i),{label:"比赛","mobile-header-class":["min-w-8"]},{default:a(()=>[o(E,{to:l.path},{default:a(()=>[d(r(l.name),1)]),_:2},1032,["to"])]),_:2},1024),o(e(i),{label:"平台",center:""},{default:a(()=>[t("span",null,r(e(H)(l)),1)]),_:2},1024),o(e(i),{label:"时间",align:"center",width:"10em"},{default:a(()=>[t("span",null,r(e(R)(l.startTime).value),1)]),_:2},1024),o(e(i),{label:"人数",align:"center",width:"5em"},{default:a(()=>[t("div",de,[o(e(J)),_e,t("span",null,"x "+r(l.participantNumber),1)])]),_:2},1024)]),empty:a(()=>[he]),_:1},8,["data"]),e(B).length<e(D)?(p(),f("div",me,[o(T,{onClick:$,success:""},{default:a(()=>[pe]),_:1})])):K("",!0)]),t("div",fe,[ve,t("span",Ce,r(e(D)),1),ge])])}}});export{De as default};