import{d as w,Q as C,S as x,U as $,V as c,W as M,bk as N,j as e,B as T,A as j,O as k,C as q,y as G}from"./ResizeObserver.es.62ab429c.js";import{d as V}from"./index.a6e5e68b.js";import E from"./index.309e98e0.js";import{m as u,o as A,s as P}from"./header.ea2a8e68.js";import{g as F}from"./music.9463d067.js";import{b as W,S as B}from"./hooks.3b599d36.js";import{s as i}from"./all-search.module.dc7766ff.js";import{M as H}from"./index.16b0645f.js";import O from"./index.3cd8c726.js";import"./index.00698f4b.js";import"./use-tab-status.a98984d2.js";import"./index.b0c6821a.js";import"./index.3d6f6bcd.js";import"./index.ffd89e39.js";import"./use-id.1bbe472d.js";import"./use-refs.259e72cb.js";import"./index.021584f9.js";import"./index.da737397.js";import"./index.d7a13e47.js";import"./index.002d8e53.js";import"./index.82be4917.js";import"./select-subject.87733b5b.js";import"./index.0eba5ce9.js";import"./index.786e83cc.js";import"./index.1db64c88.js";import"./bg-image.e9966434.js";import"./index.2a571689.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";import"./index.2745b15c.js";import"./index.9a52dc9a.js";import"./index.5d843ffa.js";import"./index.6fbb4850.js";var U=w({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(n){C();const p=x(),a=$({albumList:[],loading:!1,defauleParams:n.defauleParams}),d=async()=>{a.loading=!0;try{const{data:t}=await G.post("/api-student/music/album/list",{data:{...a.defauleParams,page:1,rows:3}});a.albumList=t.rows||[]}catch{}a.loading=!1},r=c(null),v=t=>{var b,h;a.defauleParams.idAndName=t,d(),(h=(b=r.value).onSearch)==null||h.call(b,t)};return M(()=>{d(),u.on("search",v)}),N(()=>{u.off("search",v)}),()=>e("div",{class:i.allSearch},[a.albumList.length>0&&e("div",{class:[i.albumSection,i.searchAllTitle]},[e("div",{class:i.albumTitle},[e("span",null,[T("\u4E13\u8F91")]),e("span",{class:i.more,onClick:()=>{A(`${j()}/tenant/#/music-album`,()=>{p.push({path:"/music-album"})})}},[T("\u66F4\u591A "),e(k,{name:"arrow"},null)])]),e("div",{class:i.musicGrid},[e(H,{showLight:!0,lightText:a.defauleParams.idAndName,list:a.albumList,onGoto:t=>{A(`${j()}/tenant/#/music-album-detail/${t.id}`,()=>{p.push({name:"music-album-detail",params:{id:t.id}})})}},null),a.albumList.length<=0&&!a.loading&&e(q,{tips:"\u6682\u65E0\u4E13\u8F91",btnStatus:!1,classImgSize:"SMALL"},null)])]),e("div",{class:[i.albumSection,i.searchAllTitle,i.musicGroup]},[e("div",{class:i.albumTitle},[T("\u5355\u66F2")]),e(O,{hideSearch:!0,ref:r,onItemClick:t=>{A(`${j()}/tenant/#/music-detail?id=${t.id}`,()=>{p.push({path:"/music-detail",query:{id:t.id}})})},showLight:!0,lightText:a.defauleParams.idAndName,defauleParams:{...n.defauleParams,idAndName:n.defauleParams.search}},null)])])}}),Ra=w({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",F());const n=C(),p=x(),a=c(n.query.search||""),d=c(n.query.tagids||""),r=c(),v=c(!1),t=V("music-search",[]),l=c("all"),b=W(B.SEARCH);r.value=b.id;const h=s=>{var o,f;if(l.value!=="all"){a.value=s;const m=t.value.indexOf(s);m>-1&&t.value.splice(m,1),s&&(t.value.unshift(s),t.value.length=Math.min(t.value.length,10)),(f=(o=(l.value==="album"?g:S).value)==null?void 0:o.onSearch)==null||f.call(o,s)}},I=s=>{var m,L;const o=Object.values(s).flat().filter(Boolean).join(",");d.value=o,(L=(m=(l.value==="album"?g:S).value).onComfirm)==null||L.call(m,s),v.value=!1},R=s=>{var f,m;r.value=s.id,(m=(f=(l.value==="album"?g:S).value).onComfirmSubject)==null||m.call(f,s)},g=c(null),S=c(null),y=(s,o)=>{a.value=o,l.value=s};return M(()=>{u.on("changeTab",y),u.on("search",h),u.on("confirm",I),u.on("confirmSubject",R)}),N(()=>{u.off("changeTab",y),u.off("search",h),u.off("confirm",I),u.off("confirmSubject",R)}),()=>e("div",{class:P.search},[l.value==="all"&&e(U,{defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value}},null),l.value==="album"&&e("div",{class:"mt12"},[e(E,{hideSearch:!0,showLight:!0,lightText:a.value,ref:g,defauleParams:{search:a.value,albumTagIds:d.value,subjectIds:r.value}},null)]),l.value==="songe"&&e("div",{class:[P.musicGroup]},[e(O,{hideSearch:!0,showLight:!0,lightText:a.value,defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value},ref:S,onItemClick:s=>{p.push({path:"/music-detail",query:{id:s.id,albumId:n.params.id}})}},null)])])}});export{Ra as default};
