import{d as M,y,g as l,U as n,P as J,Q as X,S as D,V as q,f as Q,j as t,F as U,A as Y,N as Z,bg as K,C as G,aS as k}from"./ResizeObserver.es.f28023e0.js";import{L as W}from"./index.79f59946.js";import{S as $}from"./index.8b5ee282.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as ee,a as H}from"./index.aa87c0e3.js";import{S as ae}from"./index.22776016.js";import{S as te}from"./select-tag.89981fc2.js";import{g as se}from"./music.96a1c334.js";import{S as le}from"./select-subject.c9c8869a.js";import{a as p,S as m}from"./hooks.19957bf3.js";import{S as oe}from"./index.9f739f31.js";import{C as re}from"./index.bd375ca9.js";import{c as ie}from"./index.9a41251d.js";import{T as ne}from"./index.787d69a0.js";import"./use-tab-status.653933d8.js";import"./use-id.cc14bbe9.js";import"./use-refs.b4f9d723.js";import"./index.3b2e70c8.js";import"./index.975e8f79.js";import"./index.af901340.js";import"./index.b5553db8.js";import"./index.49ee134a.js";import"./index.926ca9c5.js";import"./index.3bbba552.js";import"./icon_uploader.5826c51d.js";import"./icon-xin.575e2987.js";import"./icon_album.eca1da54.js";import"./icon_album_active.a67a159e.js";import"./icon_exquisite.7cf228c5.js";import"./icon_music_active.5a84cf57.js";import"./index.7a1af785.js";import"./icon-play.bc9e7aab.js";const ue="_sticky_wg0y2_1",ce="_listContainer_wg0y2_5",pe="_line_wg0y2_17",me="_active_wg0y2_23",fe="_label_wg0y2_26",de="_alumnList_wg0y2_39",ge="_bgImg_wg0y2_45",be="_tagTabs_wg0y2_53",Ae="_fleg_wg0y2_87";var d={sticky:ue,listContainer:ce,line:pe,active:me,label:fe,alumnList:de,bgImg:ge,tagTabs:be,fleg:Ae},ve="./assets/bgImg.2964f21d.png",Se="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA6BJREFUWEe9l2molVUUhp+32YKoSBNEKAoriawfShRhpIRNVkg/kiCHhCAzikiEjEQztJnyRzRB9SOwbBCKirLBkg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51iezlwV/WH40RdMSYAZTtuBEKQ5pwbxwygQFwX/QSIR0wopfljClAgFgDnAwsl7f0PfUtCHGOyShkAAAAASUVORK5CYII=";const L=()=>{};var ea=M({name:"MusicList",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})},onItemClick:{type:Function,default:L},teacherId:{type:String||Number,default:""},myself:{type:Boolean,default:!1}},setup({hideSearch:E,defauleParams:x,onItemClick:v,teacherId:P,myself:_},{expose:F}){const{isLoading:ye,state:I}=ie(y(l.platformApi+"/MusicTag/tree",{params:{type:"MUSIC"}}),null),g=n({id:"",name:""});if(l.platformType==="TEACHER"){const e=l.user.data;g.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!p(m.SEARCH).id){const a=l.user.data,o=a.subjectId?Number(a.subjectId.split(",")[0]):"",c=a.subjectName?a.subjectName.split(",")[0]:"";o&&p(m.SEARCH,JSON.stringify({id:o,name:c}),"set")}localStorage.setItem("behaviorId",se());const h=J(),V=X(),b={};l.version&&(b.version=l.version||"",b.platform=l.platformType==="STUDENT"?"ios-student":"ios-teacher");const u=n(!1);if(!E){if(l.platformType==="TEACHER")b.subjectIds=g.value.id;else{const a=p(m.SEARCH);b.subjectIds=a.id}const e=p(m.MUSIC_FREE);u.value=e.chargeType}const r=D({search:h.query.search||"",musicTagIds:h.query.tagids||"",page:1,...x,...b}),s=n(null),A=n(!1),j=n(!1),w=n(!1),C=n(!1),S=n(!0),O=n(l.platformType==="STUDENT"?"/api-student":"/api-teacher"),B=e=>{r.page=1,r.search=e,s.value=null,f()},f=async()=>{var a;if(A.value)return;A.value=!0,w.value=!1;const e={...r,auditStatus:"PASS",idAndName:r.search,createBy:P};u.value&&(e.chargeType="FREE"),_?e.myself=!0:e.myself=!1;try{const o=await y.post(`${O.value}/music/sheet/list`,{data:e});if(s.value){const c=(((a=s.value)==null?void 0:a.rows)||[]).concat(o.data.rows||[]);s.value.rows=c}s.value=s.value||o.data,r.page=o.data.pageNo+1,j.value=o.data.pageNo>=o.data.totalPage}catch{w.value=!0}A.value=!1},z=async e=>{try{await y.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},R=e=>{const a={};for(const c in e)Number(c)===-1?u.value=!!e[c][0]:a[c]=e[c];const o=Object.values(a).flat().filter(Boolean).join(",");r.musicTagIds=o,r.page=1,s.value=null,f(),C.value=!1},N=e=>{r.page=1,r.subjectIds=e.id,s.value=null,l.platformType==="TEACHER"?(g.value={name:e.name,id:e.id},z(e.id)):(i.id=e.id,i.name=e.name,p(m.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),f(),i.show=!1},T=p(m.SEARCH),i=D({show:!1,name:T.id?T.name:"\u5168\u90E8\u58F0\u90E8",id:T.id||""});return q(async()=>{try{if(!Q().iPhone){S.value=!1;return}const{data:e}=await y.get("/api-admin/appVersionInfo/queryByPlatform",{params:{platform:l.platformType==="TEACHER"?"ios-teacher":"ios-student"}});l.version>e.version?S.value=!0:S.value=!1}catch{}}),F({onSearch:B,onComfirm:R,onComfirmSubject:N}),()=>{const e=I.value&&I.value.data||[];return t(U,null,[!E&&t(U,null,[t(ne,{class:d.sticky},{default:()=>[t(re,{background:"transparent",isFixed:!1,border:!1,backIconColor:"white",color:"#fff"},{right:()=>!S.value&&t("span",{class:d.fleg,onClick:()=>{u.value!=u.value,p(m.MUSIC_FREE,JSON.stringify({chargeType:u.value}),"set"),s.value=null,r.page=1,f()}},[t($,{modelValue:u.value,"onUpdate:modelValue":a=>u.value=a,size:"20px"},null),t("span",null,[Y("\u514D\u8D39")])])}),t(ae,{onSearch:B,background:"transparent",inputBackground:"transparent",leftIcon:Se},{left:()=>t("div",{class:d.label,onClick:()=>i.show=!0},[l.platformType==="TEACHER"?g.value.name:i.name,t(Z,{classPrefix:"iconfont",name:"down",size:12,color:"#fff"},null)])}),t(ee,{shrink:!0,class:d.tagTabs,lineHeight:0,"onClick-tab":a=>{r.musicTagIds=a.name,s.value=null,r.page=1,f()}},{default:()=>[t(H,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(H,{title:a.name,name:a.id},null))]})]}),t("img",{class:d.bgImg,src:ve},null)]),t("div",{class:d.alumnList},[t(W,{loading:A.value,finished:j.value,"finished-text":(s.value&&s.value.rows.length,""),onLoad:f,error:w.value},{default:()=>[s.value&&s.value.rows.length?t(oe,{list:s.value.rows,onDetail:a=>{if(v===L){const o=location.origin+location.pathname+"#/music-detail?id="+a.id;K(o,()=>{V.push({path:"/music-detail",query:{id:a.id}})})}else v==null||v(a)}},null):!A.value&&t(G,{tips:"\u6682\u65E0\u66F2\u76EE",classImgSize:"SMALL",btnStatus:!1},null)]})]),t(k,{show:C.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":a=>C.value=a},{default:()=>[t(te,{exquisiteFlag:!0,onConfirm:R,onCancel:()=>{},defaultValue:h.query.tagids},null)]}),t(k,{show:i.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>i.show=!1,onClosed:()=>i.show=!1},{default:()=>[t(le,{type:"MUSIC",searchParams:l.platformType==="TEACHER"?g.value:i,onComfirm:N},null)]})])}}});export{ea as default};