import{d as G,S as u,x as v,g as l,P as B,O,Q as I,j as t,F as P,C as F}from"./index.3bfa6a0e.js";import{L as U}from"./index.0a290e73.js";import"./index.6bd4dfa5.js";import"./index.e9acc943.js";import{T as V,a as H}from"./index.cd00eeaf.js";import{I as J}from"./index.0fd5538f.js";import{D as z,a as Q}from"./index.60cf2b6f.js";import"./index.79997a38.js";import{S as $}from"./index.8a87fb9c.js";import{S as K}from"./select-subject.47bcf99b.js";import{a as f,S as p}from"./hooks.435f47d5.js";import{M as W}from"./index.48fb74ae.js";import{c as X}from"./index.b1671445.js";import{C as Y}from"./index.645e7ddc.js";import{T as Z}from"./index.52c97b40.js";import{b as ee}from"./bg-image.e9966434.js";import"./use-tab-status.c0d730a9.js";import"./use-id.7c44c16f.js";import"./use-refs.7efc98f2.js";import"./index.983bfd1a.js";import"./index.c171ade0.js";import"./index.8711ee78.js";import"./icon-xin2.4ab2a52d.js";import"./index.4a8093e5.js";const ae="_memberHeader_12ffq_1",te="_headerImg_12ffq_7",se="_headerContent_12ffq_16",le="_sticky_12ffq_51",re="_label_12ffq_54",oe="_musicGrid_12ffq_66",ue="_tagTabs_12ffq_69";var n={memberHeader:ae,headerImg:te,headerContent:se,sticky:le,label:re,musicGrid:oe,tagTabs:ue},qe=G({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})},showLight:{type:Boolean,default:!1},lightText:{type:String,default:""}},setup({hideSearch:y,defauleParams:R,showLight:w,lightText:L},{expose:N}){const g=u(L),{isLoading:ie,state:S}=X(v(l.platformApi+"/MusicTag/tree",{params:{type:"ALBUM"}}),null),c=u({id:"",name:""});if(l.platformType==="TEACHER"){const e=l.user.data;c.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!f(p.SEARCH).id){const a=l.user.data,o=a.subjectId?Number(a.subjectId.split(",")[0]):"",D=a.subjectName?a.subjectName.split(",")[0]:"";o&&f(p.SEARCH,JSON.stringify({id:o,name:D}),"set")}const q=B(),T=O(),i={};if(l.version&&(i.version=l.version||"",i.platform=l.platformType==="STUDENT"?"ios-student":"ios-teacher"),i.myself=!1,!y)if(l.platformType==="TEACHER")i.subjectIds=c.value.id;else{const e=f(p.SEARCH);i.subjectIds=e.id}const r=I({search:T.query.search||"",albumTagIds:T.query.tagids||"",page:1,...R,...i}),s=u(null),b=u(!1),j=u(!1),h=u(!1),x=u(!1),C=e=>{r.page=1,r.search=e,g.value=e,s.value=null,m()},m=async()=>{var e;if(!b.value){b.value=!0,h.value=!1;try{const a=await v.post("/music/album/list",{prefix:l.platformType==="TEACHER"?"/api-teacher":"/api-student",data:{...r,idAndName:g.value}});if(s.value){const o=(((e=s.value)==null?void 0:e.rows)||[]).concat(a.data.rows||[]);s.value.rows=o}s.value=s.value||a.data,r.page=a.data.pageNo+1,j.value=a.data.pageNo>=a.data.totalPage}catch{h.value=!0}b.value=!1}},k=async e=>{try{await v.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},M=e=>{const a=Object.values(e).flat().filter(Boolean).join(",");r.albumTagIds=a,r.page=1,s.value=null,m(),x.value=!1},_=u(),A=e=>{r.page=1,r.subjectIds=e.id,_.value.toggle(),s.value=null,l.platformType==="TEACHER"?(c.value={name:e.name,id:e.id},k(e.id)):(d.id=e.id,d.name=e.name,f(p.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),m(),d.show=!1};N({onSearch:C,onComfirm:M,onComfirmSubject:A});const E=f(p.SEARCH),d=I({show:!1,name:E.name||"\u5168\u90E8\u58F0\u90E8",id:E.id||""});return()=>{const e=S.value&&S.value.data||[];return t("div",null,[t(U,{finished:j.value,"finished-text":s.value&&s.value.rows.length?" ":"",onLoad:m,error:h.value},{default:()=>[!y&&t(P,null,[t(Z,{position:"top"},{default:()=>[t(Y,{class:n.memberHeader,background:"transparent",border:!1,isFixed:!1,color:"#131415"},{default:()=>t("div",{class:n.headerContent},[t($,{type:"tenant",modelValue:r.search,onSearch:C,placeholder:"\u8BF7\u8F93\u5165\u4E13\u8F91\u540D\u79F0 ",background:"transparent"},{left:()=>t(z,null,{default:()=>[t(Q,{titleClass:n.titleActive,title:"\u7B5B\u9009",ref:_},{default:()=>[t(K,{type:"ALBUM",isReset:!0,searchParams:l.platformType==="TEACHER"?c.value:d,onComfirm:A},null)]})]})}),t(V,{shrink:!0,class:n.tagTabs,lineHeight:0,"onClick-tab":a=>{r.albumTagIds=a.name,s.value=null,r.page=1,m()}},{default:()=>[t(H,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(H,{title:a.name,name:a.id},null))]})])})]}),t(J,{class:n.headerImg,src:ee},null)]),s.value&&s.value.rows.length?t("div",{class:n.musicGrid},[t(W,{showLight:w,lightText:g.value,list:s.value.rows,onGoto:a=>{const o=l.platformType==="TEACHER"?c.value:d;console.log(o),q.push({name:"music-album-detail",params:{id:a.id},query:{subjectId:o.id,subjectName:o.name}})}},null)]):!b.value&&t("div",{style:"height: calc(100vh - var(--header-height));display: flex;align-items: center;"},[t(F,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)])]})])}}});export{qe as default};
