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