import{d as S,Q as y,S as A,V as s,U as I,W as j,bk as C,j as l,A as E,bf as N,C as R,y as k}from"./ResizeObserver.es.62ab429c.js";import{m as f,s as h}from"./header.ea2a8e68.js";import{g as q}from"./music.9463d067.js";import{b as L,S as V}from"./hooks.3b599d36.js";import{L as x}from"./index.00698f4b.js";import{S as D}from"./index.6fbb4850.js";import"./index.0eba5ce9.js";import"./index.b0c6821a.js";import"./index.3d6f6bcd.js";import"./index.ffd89e39.js";import"./use-id.1bbe472d.js";import"./use-tab-status.a98984d2.js";import"./use-refs.259e72cb.js";import"./index.da737397.js";import"./index.d7a13e47.js";import"./index.b6ce06cf.js";import"./index.002d8e53.js";import"./index.82be4917.js";import"./index.a6e5e68b.js";import"./index.926ca9c5.js";import"./select-subject.87733b5b.js";import"./index.1db64c88.js";import"./index.786e83cc.js";import"./icon-xin2.4ab2a52d.js";import"./index.021584f9.js";var ue=S({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",q());const c=y(),g=A(),o=s(c.query.keyword||""),b=s(),w=L(V.SEARCH);b.value=w.id;const p=a=>{o.value=a,e.value&&(e.value.rows=[]),r.name=a,r.page=1,m()},r=I({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 k.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=E()+location.pathname+"#/music-detail?id="+a.id+"&tenantAlbumId="+a.tenantAlbumId+"&type=search";N(t,()=>{g.push({path:"/music-detail",query:{id:a.id,tenantAlbumId:a.tenantAlbumId,type:"search"}})})}},null)]}):!u.value&&l(R,{tips:"\u6682\u65E0\u66F2\u76EE",btnStatus:!1},null)])}});export{ue as default};
