import{d as S,P as y,Q as I,U as s,S as A,V as j,bi as C,j as l,bd as E,C as N,y as R}from"./ResizeObserver.es.b7226882.js";import{m as f,s as h}from"./header.3dca94d7.js";import{g as q}from"./music.7cc0b22d.js";import{a as L,S as k}from"./hooks.a4ed20cb.js";import{L as V}from"./index.9fec2202.js";import{S as x}from"./index.3532de0c.js";import"./index.ed3a5560.js";import"./index.f6c44874.js";import"./index.cf00521e.js";import"./index.dc988884.js";import"./use-id.5d5e6e63.js";import"./use-tab-status.db1f6d2e.js";import"./use-refs.428b450a.js";import"./index.287fb1bf.js";import"./index.40f703b6.js";import"./index.b6ce06cf.js";import"./index.521acd0b.js";import"./index.021f1c7b.js";import"./index.1eaf642c.js";import"./index.926ca9c5.js";import"./select-subject.355ffa48.js";import"./index.1743594f.js";import"./index.969bba7f.js";import"./icon-xin2.4ab2a52d.js";import"./index.20c0f4c5.js";var re=S({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",q());const c=y(),g=I(),o=s(c.query.keyword||""),b=s(),w=L(k.SEARCH);b.value=w.id;const p=a=>{o.value=a,e.value&&(e.value.rows=[]),r.name=a,r.page=1,m()},r=A({name:c.query.search||"",rows:20,page:1}),e=s(null),u=s(!1),d=s(!1),n=s(!1),m=async()=>{var a;if(!u.value){u.value=!0,n.value=!1;try{const t=await R.post("/api-student/music/sheet/searchTenant",{data:r});if(e.value){const i=(((a=e.value)==null?void 0:a.rows)||[]).concat(t.data.music.rows||[]);e.value.rows=i}e.value=e.value||t.data.music;const v=e.value.rows||[];v.forEach(i=>{o.value&&(i.musicSheetName=i.musicSheetName.replace(o.value,`${o.value}`))}),e.value.rows=v,r.page=t.data.music.pageNo+1,d.value=t.data.music.pageNo>=t.data.music.totalPage}catch{n.value=!0}u.value=!1}};return j(()=>{f.on("search",p),m()}),C(()=>{f.off("search",p)}),()=>l("div",{class:[h.search,h.searchAlbum]},[e.value&&e.value.rows.length?l(V,{finished:d.value,"finished-text":(e.value&&e.value.rows.length,""),onLoad:m,error:n.value,immediateCheck:!1},{default:()=>[l(x,{showTitleImg:!0,list:e.value.rows,onDetail:a=>{const t=location.origin+location.pathname+"#/music-detail?id="+a.id+"&tenantAlbumId="+a.tenantAlbumId+"&type=search";E(t,()=>{g.push({path:"/music-detail",query:{id:a.id,tenantAlbumId:a.tenantAlbumId,type:"search"}})})}},null)]}):!u.value&&l(N,{tips:"\u6682\u65E0\u66F2\u76EE",btnStatus:!1},null)])}});export{re as default};