import{d as S,O as y,P as I,S as s,Q as A,U as j,bD as C,j as l,bf as E,C as N,x as R}from"./index.3bfa6a0e.js";import{m as f,s as h}from"./header.cf45b287.js";import{g as q}from"./music.c4f2ecac.js";import{a as L,S as k}from"./hooks.435f47d5.js";import{L as x}from"./index.0a290e73.js";import{S as D}from"./index.9cbf9013.js";import"./index.c171ade0.js";import"./index.6bd4dfa5.js";import"./index.e9acc943.js";import"./index.cd00eeaf.js";import"./use-id.7c44c16f.js";import"./use-tab-status.c0d730a9.js";import"./use-refs.7efc98f2.js";import"./index.60cf2b6f.js";import"./index.79997a38.js";import"./index.b6ce06cf.js";import"./index.8a87fb9c.js";import"./index.983bfd1a.js";import"./index.b1671445.js";import"./index.4a8093e5.js";import"./index.926ca9c5.js";import"./select-subject.47bcf99b.js";import"./index.52c97b40.js";import"./index.645e7ddc.js";import"./icon-xin2.4ab2a52d.js";import"./index.0fd5538f.js";var ue=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(x,{finished:d.value,"finished-text":(e.value&&e.value.rows.length,""),onLoad:m,error:n.value,immediateCheck:!1},{default:()=>[l(D,{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{ue as default};
