var H=Object.defineProperty,L=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var E=(t,a,o)=>a in t?H(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,h=(t,a)=>{for(var o in a||(a={}))q.call(a,o)&&E(t,o,a[o]);if(N)for(var o of N(a))F.call(a,o)&&E(t,o,a[o]);return t},R=(t,a)=>L(t,_(a));import{d as O,u as V,h as T,l as d,a as r,M as z,S as B,K as D,P as k,F as J}from"./vendor.cd162bf7.js";/* empty css               *//* empty css               */import{C as M}from"./index.a64b1b02.js";import{s as m,C as U,r as K}from"./index.a9c80450.js";import{I as G}from"./item.3ab561a9.js";import{S as Q}from"./select-tag.2e1a0f9d.js";import{S as W}from"./select-subject.22f886db.js";import{u as f,S as p}from"./hooks.9d08351a.js";/* empty css              *//* empty css               *//* empty css               */import"./favorite.cb69f4f9.js";import"./index.a576332b.js";/* empty css                *//* empty css                *//* empty css                */import"./index.926ca9c5.js";const X="_sticky_1xjt9_1",Y="_label_1xjt9_4";var P={sticky:X,label:Y},ve=O({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})}},setup({hideSearch:t,defauleParams:a},{expose:o}){const y=f(p.SEARCH);if(!y.id){const e=m.user.data,l=e.subjectId?Number(e.subjectId.split(",")[0]):"",v=e.subjectName?e.subjectName.split(",")[0]:"";console.log(v,l,y),l&&f(p.SEARCH,JSON.stringify({id:l,name:v}),"set")}const g=V(),u={};if(m.version&&(u.version=m.version||"",u.platform=m.platformType==="STUDENT"?"ios-student":"ios-teacher"),u.myself=!1,!t){const e=f(p.SEARCH);u.subjectIds=e.id}const n=T(h(h({search:g.query.search||"",albumTagIds:g.query.tagids||"",page:1},a),u)),s=d(null),c=d(!1),C=d(!1),S=d(!1),b=d(!1),w=e=>{n.page=1,n.search=e,s.value=null,j()},j=async()=>{var e;if(!c.value){c.value=!0,S.value=!1;try{const l=await K.post("/music/album/list",{prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",data:R(h({},n),{idAndName:n.search})});if(s.value){let v=(((e=s.value)==null?void 0:e.rows)||[]).concat(l.data.rows||[]);s.value.rows=v}s.value=s.value||l.data,n.page=l.data.pageNo+1,C.value=l.data.pageNo>=l.data.totalPage}catch{S.value=!0}c.value=!1}},x=e=>{const l=Object.values(e).flat().filter(Boolean).join(",");n.albumTagIds=l,n.page=1,s.value=null,j(),b.value=!1},I=e=>{n.page=1,n.subjectIds=e.id,i.id=e.id,i.name=e.name,s.value=null,f(p.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set"),j(),i.show=!1};o({onSearch:w,onComfirm:x,onComfirmSubject:I});const A=f(p.SEARCH),i=T({show:!1,name:A.name||"\u5168\u90E8\u58F0\u90E8",id:A.id||""});return()=>r(J,null,[r(z,{loading:c.value,finished:C.value,"finished-text":s.value&&s.value.rows.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:j,error:S.value},{default:()=>[!t&&r(B,{class:P.sticky},{default:()=>[r(M,{modelValue:n.search,showAction:!0,onSearch:w,onFilter:()=>b.value=!0,filterDot:!!n.albumTagIds},{left:()=>r("div",{class:P.label,onClick:()=>i.show=!0},[i.name,r(D,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),s.value&&s.value.rows.length?s.value.rows.map(e=>r(G,{data:e},null)):!c.value&&r(U,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]}),r(k,{show:b.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>b.value=e},{default:()=>[r(Q,{defaultValue:g.query.tagids,onConfirm:x,onCancel:()=>{}},null)]}),r(k,{show:i.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>i.show=!1,onClosed:()=>i.show=!1},{default:()=>[r(W,{isReset:!0,searchParams:i,onComfirm:I},null)]})])}});export{ve as default};
