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,bg as E,C as N,y as R}from"./ResizeObserver.es.45df6c0f.js";import{m as f,s as h}from"./header.34abd325.js";import{g as q}from"./music.d2b7a78f.js";import{a as L,S as k}from"./hooks.d8170117.js";import{L as V}from"./index.3c3f214d.js";import{S as x}from"./index.ede8c9f4.js";import"./index.b5f25372.js";import"./index.41214d91.js";import"./index.ba862406.js";import"./index.cbe24982.js";import"./use-id.41c465c4.js";import"./use-tab-status.b9a2b892.js";import"./use-refs.4c6f1efb.js";import"./index.4f6dc541.js";import"./index.5034ef43.js";import"./index.b6ce06cf.js";import"./index.ec19e463.js";import"./index.0acff0f0.js";import"./index.f6378dda.js";import"./index.926ca9c5.js";import"./select-subject.8e7e7c10.js";import"./index.d1be830c.js";import"./index.1a59558b.js";import"./icon-xin2.4ab2a52d.js";import"./index.e11fdb7d.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,`<span style="color: #FE2451">${o.value}</span>`))}),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};
