var M=Object.defineProperty,O=Object.defineProperties;var D=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var T=(o,a,s)=>a in o?M(o,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[a]=s,h=(o,a)=>{for(var s in a||(a={}))U.call(a,s)&&T(o,s,a[s]);if(I)for(var s of I(a))V.call(a,s)&&T(o,s,a[s]);return o},E=(o,a)=>O(o,D(a));import{d as z,u as J,h as R,l as c,a as r,F as K,M as k,S as _,K as $,P as A}from"./vendor.cd162bf7.js";/* empty css               *//* empty css               */import{C as G}from"./index.a64b1b02.js";import{s as m,C as Q,r as W}from"./index.a9c80450.js";import{I as X}from"./item.6f8e93af.js";import{S as Y}from"./select-tag.2e1a0f9d.js";import{s as P}from"./index.module.da27480e.js";import{g as Z,m as ee}from"./music.2b301688.js";import{S as se}from"./select-subject.22f886db.js";import{u as f,S as p}from"./hooks.9d08351a.js";/* empty css              *//* empty css               *//* empty css               *//* empty css                */import"./index.926ca9c5.js";import"./music-icon.c20abf48.js";import"./init-user-icon.6387573f.js";import"./favorite.cb69f4f9.js";import"./index.bf04a798.js";/* empty css              */import"./code-down-load.47d90056.js";import"./logo.bcac726b.js";import"./browser.ebb85846.js";import"./icon_teacher.cb128c00.js";import"./index.a576332b.js";/* empty css                *//* empty css                */import"./orderStatus.86d72629.js";import"./index.339fc024.js";const L=()=>{};var He=z({name:"MusicList",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})},onItemClick:{type:Function,default:L},teacherId:{type:String||Number,default:""}},setup({hideSearch:o,defauleParams:a,onItemClick:s,teacherId:F},{expose:H}){if(!f(p.SEARCH).id){const e=m.user.data,u=e.subjectId?Number(e.subjectId.split(",")[0]):"",n=e.subjectName?e.subjectName.split(",")[0]:"";u&&f(p.SEARCH,JSON.stringify({id:u,name:n}),"set")}localStorage.setItem("behaviorId",Z());const g=J(),j={};if(m.version&&(j.version=m.version||"",j.platform=m.platformType==="STUDENT"?"ios-student":"ios-teacher"),!o){const e=f(p.SEARCH);j.subjectIds=e.id}const i=R(h(h({search:g.query.search||"",musicTagIds:g.query.tagids||"",page:1},a),j)),t=c(null),d=c(!1),y=c(!1),S=c(!1),b=c(!1),q=c(m.platformType==="STUDENT"?"/api-student":"/api-teacher"),w=e=>{i.page=1,i.search=e,t.value=null,v()},v=async()=>{var u;if(d.value)return;d.value=!0,S.value=!1;const e=E(h({},i),{idAndName:i.search,createBy:F});e.myself=!1;try{const n=await W.post(`${q.value}/music/sheet/list`,{data:e});if(t.value){const B=(((u=t.value)==null?void 0:u.rows)||[]).concat(n.data.rows||[]);t.value.rows=B}t.value=t.value||n.data,i.page=n.data.pageNo+1,y.value=n.data.pageNo>=n.data.totalPage}catch{S.value=!0}d.value=!1},x=e=>{const u=Object.values(e).flat().filter(Boolean).join(",");i.musicTagIds=u,i.page=1,t.value=null,v(),b.value=!1},C=e=>{i.page=1,i.subjectIds=e.id,l.id=e.id,l.name=e.name,t.value=null,f(p.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set"),v(),l.show=!1},N=f(p.SEARCH),l=R({show:!1,name:N.name||"\u5168\u90E8\u58F0\u90E8",id:N.id||""});return H({onSearch:w,onComfirm:x,onComfirmSubject:C}),()=>r(K,null,[r(k,{loading:d.value,finished:y.value,"finished-text":t.value&&t.value.rows.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:v,error:S.value},{default:()=>[!o&&r(_,{class:P.sticky},{default:()=>[r(G,{showAction:!0,onSearch:w,onFilter:()=>b.value=!0,filterDot:!!i.musicTagIds},{left:()=>r("div",{class:P.label,onClick:()=>l.show=!0},[l.name,r($,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),t.value&&t.value.rows.length?t.value.rows.map(e=>r(X,{data:e,onClick:()=>{s===L?ee(e):s==null||s(e)}},null)):!d.value&&r(Q,{tips:"\u6682\u65E0\u66F2\u76EE",classImgSize:"SMALL",btnStatus:!1},null)]}),r(A,{show:b.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>b.value=e},{default:()=>[r(Y,{onConfirm:x,onCancel:()=>{},defaultValue:g.query.tagids},null)]}),r(A,{show:l.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>l.show=!1,onClosed:()=>l.show=!1},{default:()=>[r(se,{isReset:!0,searchParams:l,onComfirm:C},null)]})])}});export{He as default};
