import{d as y,O as L,P as I,Q as T,S as u,U as k,j as t,W as O,z as c,Y as S,Z as A,w as h}from"./index.394decd7.js";import{I as l}from"./index.ae2dd816.js";import"./index.3bbf4ddb.js";import"./index.f1b52763.js";import{T as j,a as E}from"./index.ae00317c.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.e6e212d8.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./use-refs.09b2d19c.js";const N="_headImg_15rgb_1",q="_tabs_15rgb_4",D="_tabContent_15rgb_27",U="_itemContent_15rgb_33",V="_item_15rgb_33",H="_left_15rgb_46",$="_center_15rgb_52",P="_right_15rgb_56",z="_fraction_15rgb_60",F="_time_15rgb_66",Q="_user_15rgb_77",W="_userContent_15rgb_80",Y="_name_15rgb_85",Z="_tag_15rgb_94",G="_times_15rgb_102";var e={headImg:N,tabs:q,tabContent:D,itemContent:U,item:V,left:H,center:$,right:P,fraction:z,time:F,user:Q,userContent:W,name:Y,tag:Z,times:G},J="./assets/icon-emtry.76ea3a6a.png";function K(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!A(o)}var ut=y({name:"leaderboard",setup(){const o=L();I();const a=T({tabIndex:0,musicList:[],rankingMethod:""}),C=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 C(),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=>{O(()=>{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()},K(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(S,{image:J,description:`\u8BE5${a.rankingMethod==="TOTAL_SCORE"?"\u58F0\u90E8":"\u66F2\u76EE"}\u6682\u65E0\u6392\u540D\u5594\uFF5E`},null)])])]})))?i:{default:()=>[i]})])])}}});export{ut as default};