1 |
- import{d as L,P as C,Q as I,S as T,U as l,V as k,i as t,X as S,A as c,Z as A,$ as O,e as h}from"./index.6b776f4b.js";import{I as u}from"./index.7cc0b0e7.js";import"./index.998c3386.js";import"./index.570314c1.js";import{T as E,a as M}from"./index.21339447.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.40b6af6b.js";import"./use-tab-status.ad41a764.js";import"./use-refs.a68d4385.js";const B="_headImg_15rgb_1",N="_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",Q="_user_15rgb_77",X="_userContent_15rgb_80",Z="_name_15rgb_85",z="_tag_15rgb_94",G="_times_15rgb_102";var e={headImg:B,tabs:N,tabContent:V,itemContent:q,item:D,left:U,center:$,right:H,fraction:P,time:F,user:Q,userContent:X,name:Z,tag:z,times:G},J="./assets/icon-emtry.76ea3a6a.png";function K(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!O(o)}var ct=L({name:"leaderboard",setup(){const o=C();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=l(),_=l(!1),v=l(100);k(async()=>{await y(),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=>{S(()=>{var n;_.value=!0,v.value=((n=b.value)==null?void 0:n.offsetHeight)||100})},onError:s=>{console.log(s)}},null)]),_.value&&t(E,{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(M,{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(A,{image:J,description:`\u8BE5${a.rankingMethod==="TOTAL_SCORE"?"\u58F0\u90E8":"\u66F2\u76EE"}\u6682\u65E0\u6392\u540D\u5594\uFF5E`},null)])])]})))?i:{default:()=>[i]})])])}}});export{ct as default};
|