import{d as y,L as C,M as I,N as T,O as l,P as k,i as t,S as O,w as c,U as S,V as A,e as h}from"./index.afa1b71c.js";import{I as u}from"./index.637c8eb4.js";import"./index.db3b0e47.js";import"./index.7c0d35f2.js";import{T as M,a as E}from"./index.0daa711a.js";import{I as R,c as j,d as w}from"./icon_level3.83490474.js";import{i as x}from"./icon_teacher.40b6f077.js";import"./use-id.237d90a3.js";import"./use-tab-status.7451baf9.js";import"./use-refs.fee02e7b.js";const N="_headImg_15rgb_1",B="_tabs_15rgb_4",V="_tabContent_15rgb_27",q="_itemContent_15rgb_33",D="_item_15rgb_33",U="_left_15rgb_46",$="_center_15rgb_52",H="_right_15rgb_56",P="_fraction_15rgb_60",F="_time_15rgb_66",z="_user_15rgb_77",G="_userContent_15rgb_80",J="_name_15rgb_85",K="_tag_15rgb_94",Q="_times_15rgb_102";var e={headImg:N,tabs:B,tabContent:V,itemContent:q,item:D,left:U,center:$,right:H,fraction:P,time:F,user:z,userContent:G,name:J,tag:K,times:Q},W="./assets/icon-emtry.76ea3a6a.png";function X(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!A(o)}var ct=y({name:"leaderboard",setup(){const o=C();I();const a=T({tabIndex:0,musicList:[],rankingMethod:""}),L=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=l(),_=l(!1),v=l(100);k(async()=>{await L(),await d()});const b=l();return()=>{let i;return t("div",{class:e.leaderboard},[t("div",{class:e.container},[t("div",{class:e.headImg,ref:b},[t(u,{width:"100%",fit:"cover",src:g.value,onLoad:s=>{O(()=>{var n;_.value=!0,v.value=((n=b.value)==null?void 0:n.offsetHeight)||100})},onError:s=>{console.log(s)}},null)]),_.value&&t(M,{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()},X(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(u,{src:R},null),r==1&&t(u,{src:j},null),r==2&&t(u,{src:w},null),r!=0&&r!=1&&r!=2&&m]),t("div",{class:e.center},[t(u,{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(S,{image:W,description:`\u8BE5${a.rankingMethod==="TOTAL_SCORE"?"\u58F0\u90E8":"\u66F2\u76EE"}\u6682\u65E0\u6392\u540D\u5594\uFF5E`},null)])])]})))?i:{default:()=>[i]})])])}}});export{ct as default};
