import{d as C,P as L,Q as I,S as T,U as u,V as k,j as t,X as S,A as c,Z as A,$ as O,y as h}from"./ResizeObserver.es.45df6c0f.js";import{I as l}from"./index.e11fdb7d.js";import"./index.41214d91.js";import"./index.ba862406.js";import{T as j,a as E}from"./index.cbe24982.js";import{I as M,c as R,d as w}from"./icon_level3.c49980f2.js";import{i as x}from"./icon_teacher.40b6f077.js";import{C as B}from"./index.1a59558b.js";import"./use-id.41c465c4.js";import"./use-tab-status.b9a2b892.js";import"./use-refs.4c6f1efb.js";const N="_headImg_15rgb_1",V="_tabs_15rgb_4",q="_tabContent_15rgb_27",D="_itemContent_15rgb_33",U="_item_15rgb_33",$="_left_15rgb_46",H="_center_15rgb_52",P="_right_15rgb_56",F="_fraction_15rgb_60",Q="_time_15rgb_66",X="_user_15rgb_77",Z="_userContent_15rgb_80",z="_name_15rgb_85",G="_tag_15rgb_94",J="_times_15rgb_102";var e={headImg:N,tabs:V,tabContent:q,itemContent:D,item:U,left:$,center:H,right:P,fraction:F,time:Q,user:X,userContent:Z,name:z,tag:G,times:J},K="./assets/icon-emtry.76ea3a6a.png";function W(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!O(o)}var ut=C({name:"leaderboard",setup(){const o=L();I();const a=T({tabIndex:0,musicList:[],rankingMethod:""}),y=async()=>{try{const{data:{rankingMethod:i,subjectInfos:s,activityMusicVoList:n,shareUrl:r,subjectUrl:m}}=await h.post(`/api-student/open/activity/info/${o.query.id}`);a.rankingMethod=i;const f=i==="TOTAL_SCORE"?s:n;Array.isArray(f)&&(a.musicList=f.map(p=>(p.rankingList=[],p))),g.value=m}catch{}},d=async()=>{try{const{data:i}=await h.get("/api-student/open/activityEvaluationRecord/queryRankingList",{params:{activityPlanId:o.query.id,activityEvaluationId:a.rankingMethod==="TOTAL_SCORE"?a.musicList[a.tabIndex].subjectId:a.musicList[a.tabIndex].evaluationId,limit:10}});Array.isArray(i.rankingList)&&(a.musicList[a.tabIndex].rankingList=i.rankingList)}catch{}},g=u(),_=u(!1),v=u(100);k(async()=>{await y(),await d()});const b=u();return()=>{let i;return t("div",{class:e.leaderboard},[t(B,null,null),t("div",{class:e.container},[t("div",{class:e.headImg,ref:b},[t(l,{width:"100%",fit:"cover",src:g.value,onLoad:s=>{S(()=>{var n;_.value=!0,v.value=((n=b.value)==null?void 0:n.offsetHeight)||100})},onError:s=>{console.log(s)}},null)]),_.value&&t(j,{active:a.tabIndex,"onUpdate:active":s=>a.tabIndex=s,class:e.tabs,animated:!0,swipeable:!0,titleInactiveColor:"rgba(153,152,155,1)",titleActiveColor:"#fff",onChange:s=>d()},W(i=a.musicList.map(s=>t(E,{title:a.rankingMethod==="TOTAL_SCORE"?s.subjectName:s.musicSheetName},{default:()=>[t("div",{class:[e.tabContent,"van-safe-area-bottom"],style:{height:`calc(100vh - ${v.value}px)`}},[t("div",{class:e.itemContent},[t("div",{class:e.item},[t("div",{class:e.left},[c("\u6392\u540D")]),t("div",{class:e.center},[c("\u6635\u79F0")]),t("div",{class:e.right},[c("\u8BC4\u5206")])]),s.rankingList.map((n,r)=>{const m=(r+1).toString().padStart(2,"0");return t("div",{class:e.item},[t("div",{class:e.left},[r==0&&t(l,{src:M},null),r==1&&t(l,{src:R},null),r==2&&t(l,{src:w},null),r!=0&&r!=1&&r!=2&&m]),t("div",{class:e.center},[t(l,{width:"38px",height:"38px",fit:"cover",round:!0,src:n.userAvatar||x},null),t("div",{class:e.user},[t("div",{class:e.userContent},[t("span",{class:e.name},[n.username]),t("span",{class:e.tag},[n.userSubject])]),t("div",{class:e.times},[n.joinDate])])]),t("div",{class:e.right},[t("div",{class:e.fraction},[n.score,c("\u5206")]),a.rankingMethod!=="TOTAL_SCORE"&&t("div",{class:e.time},[c("\u7B2C "),n.times,c(" \u6B21\u8BC4\u6D4B")])])])}),!s.rankingList.length&&t(A,{image:K,description:`\u8BE5${a.rankingMethod==="TOTAL_SCORE"?"\u58F0\u90E8":"\u66F2\u76EE"}\u6682\u65E0\u6392\u540D\u5594\uFF5E`},null)])])]})))?i:{default:()=>[i]})])])}}});export{ut as default};
