import{d as M,y as S,g as o,U as n,P as X,Q as J,S as q,V as G,f as Q,j as a,F as E,A as Y,bd as Z,C as K,aS as W}from"./ResizeObserver.es.b7226882.js";import{S as $}from"./index.f6c44874.js";import{L as ee}from"./index.9fec2202.js";import{S as te}from"./index.deda73db.js";import"./index.cf00521e.js";import{T as ae,a as _}from"./index.dc988884.js";import{S as R}from"./index.521acd0b.js";import{S as se}from"./select-tag.09b8e6bc.js";import{g as le}from"./music.e5884c70.js";import{a as N,S as k}from"./hooks.a4ed20cb.js";import{S as oe}from"./index.f4934f0d.js";import{C as re}from"./index.969bba7f.js";import{c as ne}from"./index.1eaf642c.js";import{T as ue}from"./index.1743594f.js";import"./use-tab-status.db1f6d2e.js";import"./use-id.5d5e6e63.js";import"./use-refs.428b450a.js";import"./index.40f703b6.js";import"./index.021f1c7b.js";import"./index.ed3a5560.js";import"./index.1799aedf.js";import"./index.b1e15d61.js";import"./index.926ca9c5.js";import"./index.5f9ef71b.js";import"./icon_uploader.21a85a4d.js";import"./icon-xin.797feb04.js";import"./icon_album.4957b8e0.js";import"./icon_album_active.cb923735.js";import"./icon_exquisite.01ddc5aa.js";import"./icon_music_active.f55820b3.js";import"./index.20c0f4c5.js";import"./icon-play.bc9e7aab.js";const ie="_sticky_lhjbw_1",ce="_listContainer_lhjbw_5",pe="_line_lhjbw_17",me="_active_lhjbw_23",fe="_searchGroup_lhjbw_26",de="_label_lhjbw_33",ge="_searchs_lhjbw_38",be="_alumnList_lhjbw_49",he="_alumnListOnly_lhjbw_55",ve="_bgImg_lhjbw_58",Ae="_tagTabs_lhjbw_66",Se="_fleg_lhjbw_100";var i={sticky:ie,listContainer:ce,line:pe,active:me,searchGroup:fe,label:de,searchs:ge,alumnList:be,alumnListOnly:he,bgImg:ve,tagTabs:Ae,fleg:Se},ye="./assets/bgImg.2964f21d.png",we="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA6BJREFUWEe9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prOeklRvCH14mFT95NfgYskhbruOHYjxi+quX6a/QbEXRJPs62SInhnBdq3xyOlGo7tmStpy4grMIqlb51iezlwV/WH40RdMSYAZTtuBEKQ5pwbxwygQFwX/QSIR0wopfljClAgFgDnAwsl7f0PfUtCHGOyShkAAAAASUVORK5CYII=";const D=()=>{};var at=M({name:"MusicList",props:{hideSearch:{type:Boolean,default:!1},onlySearch:{type:Boolean,default:!1},height:{type:Number,default:0},defauleParams:{type:Object,default:()=>({})},onItemClick:{type:Function,default:D},teacherId:{type:String||Number,default:""},myself:{type:Boolean,default:!1}},setup({hideSearch:y,onlySearch:w,height:L,defauleParams:U,onItemClick:d,teacherId:x,myself:F},{expose:O}){const{isLoading:Ie,state:I}=ne(S(o.platformApi+"/MusicTag/tree",{params:{type:"MUSIC"}}),null),B=n(L||0),P=e=>{B.value=e},j=n({id:"",name:""});if(o.platformType==="TEACHER"){const e=o.user.data;j.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else{const t=o.user.data.instrumentId;localStorage.setItem("userInstrumentId",t)}localStorage.setItem("behaviorId",le());const b=X(),V=J(),p={};o.version&&(p.version=o.version||"",p.platform=o.platformType==="STUDENT"?"ios-student":"ios-teacher");const u=n(!1);if(!y){if(o.platformType==="TEACHER")p.subjectIds=j.value.id;else{const t=o.user.data,l=t.subjectId?Number(t.subjectId.split(",")[0]):"";p.subjectIds=l}const e=N(k.MUSIC_FREE);u.value=e.chargeType}const r=q({search:b.query.search||"",musicTagIds:b.query.tagids||"",page:1,...U,...p}),s=n(null),m=n(!1),T=n(!1),h=n(!1),v=n(!1),g=n(!0),H=n(o.platformType==="STUDENT"?"/api-student":"/api-teacher"),A=e=>{r.page=1,r.search=e,s.value=null,f()},f=async()=>{var t;if(m.value)return;m.value=!0,h.value=!1;const e={...r,auditStatus:"PASS",idAndName:r.search,createBy:x};u.value&&(e.chargeType="FREE"),F?e.myself=!0:e.myself=!1;try{const l=await S.post(`${H.value}/music/sheet/list`,{data:e});if(s.value){const c=(((t=s.value)==null?void 0:t.rows)||[]).concat(l.data.rows||[]);s.value.rows=c}s.value=s.value||l.data,r.page=l.data.pageNo+1,T.value=l.data.pageNo>=l.data.totalPage}catch{h.value=!0}m.value=!1},C=e=>{const t={};for(const c in e)Number(c)===-1?u.value=!!e[c][0]:t[c]=e[c];const l=Object.values(t).flat().filter(Boolean).join(",");r.musicTagIds=l,r.page=1,s.value=null,f(),v.value=!1},z=e=>{};return G(async()=>{try{if(!Q().iPhone){g.value=!1;return}const{data:e}=await S.get("/api-admin/appVersionInfo/queryByPlatform",{params:{platform:o.platformType==="TEACHER"?"ios-teacher":"ios-student"}});o.version>e.version?g.value=!0:g.value=!1}catch{}}),O({onSearch:A,onComfirm:C,updateStickyHeight:P,onComfirmSubject:z}),()=>{const e=I.value&&I.value.data||[];return a(E,null,[!y&&a(E,null,[a(ue,{class:i.sticky},{default:()=>[a(re,{background:"transparent",isFixed:!1,border:!1,backIconColor:"white",color:"#fff"},{right:()=>!g.value&&a("span",{class:i.fleg,onClick:()=>{u.value!=u.value,N(k.MUSIC_FREE,JSON.stringify({chargeType:u.value}),"set"),s.value=null,r.page=1,f()}},[a(te,{modelValue:u.value,"onUpdate:modelValue":t=>u.value=t,size:"20px"},null),a("span",null,[Y("\u514D\u8D39")])])}),a(R,{onSearch:A,background:"transparent",inputBackground:"transparent",leftIcon:we},null),a(ae,{shrink:!0,class:i.tagTabs,lineHeight:0,"onClick-tab":t=>{r.musicTagIds=t.name,s.value=null,r.page=1,f()}},{default:()=>[a(_,{title:"\u5168\u90E8",name:""},null),e.map(t=>a(_,{title:t.name,name:t.id},null))]})]}),a("img",{class:i.bgImg,src:ye},null)]),w?a($,{position:"top",offsetTop:B.value},{default:()=>[a(R,{onSearch:A,background:"transparent",inputBackground:"white",class:i.searchGroup},null)]}):"",a("div",{class:[i.alumnList,w&&i.alumnListOnly]},[a(ee,{loading:m.value,finished:T.value,"finished-text":(s.value&&s.value.rows.length,""),onLoad:f,error:h.value},{default:()=>[s.value&&s.value.rows.length?a(oe,{list:s.value.rows,onDetail:t=>{if(d===D){const l=location.origin+location.pathname+"#/music-detail?id="+t.id;Z(l,()=>{V.push({path:"/music-detail",query:{id:t.id}})})}else d==null||d(t)}},null):!m.value&&a(K,{tips:"\u6682\u65E0\u66F2\u76EE",classImgSize:"SMALL",btnStatus:!1},null)]})]),a(W,{show:v.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":t=>v.value=t},{default:()=>[a(se,{exquisiteFlag:!0,onConfirm:C,onCancel:()=>{},defaultValue:b.query.tagids},null)]})])}}});export{at as default};