index.2c44ca99.js 3.6 KB

1
  1. import{d as L,O as C,P as I,Q as T,S as l,U as k,j as t,W as O,z as c,Y as S,Z as A,w as h}from"./index.e6d6174e.js";import{I as u}from"./index.67c54471.js";import"./index.9093bc60.js";import"./index.b4a53c6a.js";import{T as j,a as E}from"./index.54627972.js";import{I as M,c as R,d as w}from"./icon_level3.83490474.js";import{i as x}from"./icon_teacher.40b6f077.js";import"./use-id.f239f36f.js";import"./use-tab-status.e9ba8498.js";import"./use-refs.eb803454.js";const B="_headImg_15rgb_1",N="_tabs_15rgb_4",q="_tabContent_15rgb_27",D="_itemContent_15rgb_33",U="_item_15rgb_33",V="_left_15rgb_46",$="_center_15rgb_52",H="_right_15rgb_56",P="_fraction_15rgb_60",z="_time_15rgb_66",F="_user_15rgb_77",Q="_userContent_15rgb_80",W="_name_15rgb_85",Y="_tag_15rgb_94",Z="_times_15rgb_102";var e={headImg:B,tabs:N,tabContent:q,itemContent:D,item:U,left:V,center:$,right:H,fraction:P,time:z,user:F,userContent:Q,name:W,tag:Y,times:Z},G="./assets/icon-emtry.76ea3a6a.png";function J(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!A(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=>{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()},J(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:M},null),r==1&&t(u,{src:R},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:G,description:`\u8BE5${a.rankingMethod==="TOTAL_SCORE"?"\u58F0\u90E8":"\u66F2\u76EE"}\u6682\u65E0\u6392\u540D\u5594\uFF5E`},null)])])]})))?i:{default:()=>[i]})])])}}});export{ct as default};