import{d as h,u as r,P as D,O as N,Q as g,V as Y,g as w,U as q,j as e,F as o,M as L,f as M,n as A,z as a,C,w as j}from"./index.394decd7.js";import{T as y}from"./index.88270f6d.js";import{C as F}from"./index.e6e212d8.js";import"./index.3bbf4ddb.js";import"./index.f1b52763.js";import{T as R,a as T}from"./index.ae00317c.js";import{I as m}from"./index.ae2dd816.js";import"./index.cf474e9d.js";import{C as U}from"./index.d83352a2.js";import{C as k}from"./index.9e0d46e4.js";import{i as P}from"./isBetween.e03a58d0.js";import{s as u}from"./icon_student.c3c58354.js";import"./index.75a0444f.js";import"./index.b9aedd1d.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./use-refs.09b2d19c.js";import"./utils.ae753603.js";const x="_rankListPage_t8t3q_1",B="_timeRange_t8t3q_38",S="_iconArrow_t8t3q_44",E="_bgImg_t8t3q_52",V="_sticky_t8t3q_60",W="_backArrow_t8t3q_65",H="_rankContainer_t8t3q_78",O="_rankLevel_t8t3q_81",$="_levelItem_t8t3q_88",z="_levelUserImg_t8t3q_98",Q="_img_t8t3q_116",G="_levelTime_t8t3q_129",J="_level1_t8t3q_135",K="_level2_t8t3q_152",X="_level3_t8t3q_163",Z="_rankList_t8t3q_1",ee="_rankTitle_t8t3q_183",se="_titleName_t8t3q_189",te="_rankItem_t8t3q_206",ae="_selfInfo_t8t3q_207",le="_active_t8t3q_215",ne="_num_t8t3q_219",ie="_userImg_t8t3q_230",re="_userName_t8t3q_239",oe="_subjectName_t8t3q_246",me="_times_t8t3q_252",ce="_rankListDay_t8t3q_279",ue="_emptyResult_t8t3q_298";var s={rankListPage:x,timeRange:B,iconArrow:S,bgImg:E,sticky:V,backArrow:W,rankContainer:H,rankLevel:O,levelItem:$,levelUserImg:z,img:Q,levelTime:G,level1:J,level2:K,level3:X,rankList:Z,rankTitle:ee,titleName:se,rankItem:te,selfInfo:ae,active:le,num:ne,userImg:ie,userName:re,subjectName:oe,times:me,rankListDay:ce,emptyResult:ue},de="./assets/time-bg.02131fc7.png",ve="./assets/day-bg.9df67bae.png",fe="./assets/time-title.4d40ddc5.png",pe="./assets/day-title.ab321456.png",p="./assets/empty-logo.7a66ef7e.png";r.extend(P);var Fe=h({name:"ranking-list",setup(){var _;const b=D();N();const t=g({showPopoverTime:!1,tabActive:"timeBill",firstInfo:{},secondInfo:{},threeInfo:{},myInfo:{},list:[],loading:!1,beforListShow:!0,listShow:!0}),v=Y(()=>t.tabActive==="dayBill"),I=i=>{const l=r(i).day();let c="",d="";return l===0?(c=r(i).subtract(6,"day").format("YYYY-MM-DD"),d=r(i).format("YYYY-MM-DD")):l===1?(c=r(i).format("YYYY-MM-DD"),d=r(i).add(6,"day").format("YYYY-MM-DD")):(c=r(i).subtract(l-1,"day").format("YYYY-MM-DD"),d=r(i).add(7-l,"day").format("YYYY-MM-DD")),{startTime:c,endTime:d}},n=g({...I(),studentIds:(_=w.user.data)==null?void 0:_.userId,orderType:0,page:1,rows:20}),f=async()=>{t.loading=!0;try{const{data:i}=await j.post("/api-tenant/studentMusicCompareRecord/rankingList",{data:{...n}});t.beforListShow=i.detail&&i.detail.length>0,t.myInfo=i.head||{},t.list=i.detail||[],t.firstInfo=t.list.length>0?t.list.splice(0,1)[0]:{},t.secondInfo=t.list.length>0?t.list.splice(0,1)[0]:{},t.threeInfo=t.list.length>0?t.list.splice(0,1)[0]:{},t.listShow=t.list.length>0}catch{}t.loading=!1};return q(()=>{f()}),()=>{var i;return e("div",{class:[s.rankListPage,v.value?s.rankListDay:s.rankListTime]},[e("div",{class:s.sticky},[e(y,{position:"top"},{default:()=>[e(F,{background:"transparent",isFixed:!1,border:!1,title:" ",color:"#131415"},{content:()=>e(o,null,[e(L,{name:"arrow-left",class:s.backArrow,onClick:()=>{M().isApp?A({api:"goBack"}):b.back()}},null),e(R,{lineWidth:22,lineHeight:4,shrink:!0,active:t.tabActive,"onUpdate:active":l=>t.tabActive=l,onChange:l=>{l==="dayBill"?n.orderType=2:n.orderType=0,f()}},{default:()=>[e(T,{title:"\u65F6\u957F\u699C",name:"timeBill"},null),e(T,{title:"\u5929\u6570\u699C",name:"dayBill"},null)]})])})]}),e("img",{class:s.bgImg,src:v.value?ve:de},null)]),e("div",{class:s.rankContainer},[e("div",{class:s.rankLevel},[e("div",{class:[s.levelItem,s.level2]},[t.secondInfo.userId?e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:t.secondInfo.avatar||u},null)]),e("h2",{class:"van-ellipsis"},[t.secondInfo.studentName]),n.orderType===2?e("p",{class:[s.levelTime,"van-ellipsis"]},[t.secondInfo.subjectName,a("-"),t.secondInfo.trainDays,a("\u5929")]):e("p",{class:[s.levelTime,"van-ellipsis"]},[t.secondInfo.subjectName,a("-"),t.secondInfo.trainTime,a("\u5206\u949F")])]):e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:p},null)]),e("h2",{class:"van-ellipsis"},[a("\u865A\u4F4D\u4EE5\u5F85")]),e("p",{class:[s.levelTime,"van-ellipsis"]},[a("\xA0")])])]),e("div",{class:[s.levelItem,s.level1]},[t.firstInfo.userId?e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:t.firstInfo.avatar||u},null)]),e("h2",{class:"van-ellipsis"},[t.firstInfo.studentName]),n.orderType===2?e("p",{class:[s.levelTime,"van-ellipsis"]},[t.firstInfo.subjectName,a("-"),t.firstInfo.trainDays,a("\u5929")]):e("p",{class:[s.levelTime,"van-ellipsis"]},[t.firstInfo.subjectName,a("-"),t.firstInfo.trainTime,a("\u5206\u949F")])]):e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:p},null)]),e("h2",{class:"van-ellipsis"},[a("\u865A\u4F4D\u4EE5\u5F85")]),e("p",{class:[s.levelTime,"van-ellipsis"]},[a("\xA0")])])]),e("div",{class:[s.levelItem,s.level3]},[t.threeInfo.userId?e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:t.threeInfo.avatar||u},null)]),e("h2",{class:"van-ellipsis"},[t.threeInfo.studentName]),n.orderType===2?e("p",{class:[s.levelTime,"van-ellipsis"]},[t.threeInfo.subjectName,a("-"),t.threeInfo.trainDays,a("\u5929")]):e("p",{class:[s.levelTime,"van-ellipsis"]},[t.threeInfo.subjectName,a("-"),t.threeInfo.trainTime,a("\u5206\u949F")])]):e(o,null,[e("div",{class:s.levelUserImg},[e(m,{class:s.img,src:p},null)]),e("h2",{class:"van-ellipsis"},[a("\u865A\u4F4D\u4EE5\u5F85")]),e("p",{class:[s.levelTime,"van-ellipsis"]},[a("\xA0")])])])]),e("div",{class:s.rankList},[e("div",{class:s.rankTitle},[e("div",{class:s.titleName},[e("img",{src:v.value?pe:fe},null)]),e("span",{class:s.timeRange,onClick:()=>t.showPopoverTime=!0},[r(n.startTime).format("YYYY-MM-DD"),a("\u81F3"),r(n.endTime).format("YYYY-MM-DD"),e("i",{class:s.iconArrow},null)])]),t.list.map(l=>e(k,{class:[s.rankItem,t.myInfo.userId===l.userId?s.active:""],border:!1,center:!0},{icon:()=>e(o,null,[e("span",{class:s.num},[l.rankNum]),e(m,{class:s.userImg,src:l.avatar||u},null)]),title:()=>e("div",{class:s.userInfo},[e("p",{class:s.userName},[l.studentName]),e("p",{class:s.subjectName},[l.subjectName])]),value:()=>n.orderType===2?e("div",{class:s.times},[e("span",null,[l.trainDays]),a("\u5929")]):e("div",{class:s.times},[e("span",null,[l.trainTime]),a("\u5206\u949F")])})),!t.loading&&!t.listShow&&e(C,{tips:"\u6682\u65E0\u6570\u636E",btnStatus:!1},null)]),(i=t.myInfo)!=null&&i.userId?e(y,{position:"bottom",varName:"--bottom-height"},{default:()=>[e(k,{class:s.selfInfo,border:!1,center:!0},{icon:()=>e(o,null,[e("span",{class:s.num},[t.myInfo.rankNum==-1?"-":t.myInfo.rankNum]),e(m,{src:t.myInfo.avatar||u,class:s.userImg},null)]),title:()=>e("div",{class:s.userInfo},[e("p",{class:s.userName},[t.myInfo.studentName]),e("p",{class:s.subjectName},[t.myInfo.subjectName])]),value:()=>n.orderType===2?e("div",{class:s.times},[e("span",null,[t.myInfo.trainDays]),a("\u5929")]):e("div",{class:s.times},[e("span",null,[t.myInfo.trainTime]),a("\u5206\u949F")])})]}):""]),e(U,{show:t.showPopoverTime,"onUpdate:show":l=>t.showPopoverTime=l,firstDayOfWeek:1,showConfirm:!1,type:"range",title:"\u5468\u671F\u9009\u62E9",maxRange:7,minDate:new Date("2023-02-27"),defaultDate:[r(n.startTime).toDate(),r(n.endTime).toDate()],style:{height:"70%"},onSelect:l=>{if(n.startTime="",n.endTime="",!r(l[0]).isBetween(r(n.startTime),r(n.endTime))){const c=I(l[0]);n.startTime=c.startTime,n.endTime=c.endTime}t.showPopoverTime=!1,f()}},null)])}}});export{Fe as default};