searchAlbum.f03cc91b.js 2.3 KB

1
  1. import{d as S,P as y,Q as I,U as s,S as A,V as E,bE as j,j as l,bg as C,C as N,y as R}from"./ResizeObserver.es.f28023e0.js";import{m as f,s as h}from"./header.d6a4cd23.js";import{g as q}from"./music.480e4a23.js";import{a as L,S as k}from"./hooks.19957bf3.js";import{L as V}from"./index.79f59946.js";import{S as x}from"./index.dc99e92f.js";import"./index.af901340.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import"./index.aa87c0e3.js";import"./use-id.cc14bbe9.js";import"./use-tab-status.653933d8.js";import"./use-refs.b4f9d723.js";import"./index.d7f07972.js";import"./index.3b2e70c8.js";import"./index.b6ce06cf.js";import"./index.22776016.js";import"./index.975e8f79.js";import"./index.9a41251d.js";import"./index.926ca9c5.js";import"./select-subject.996c9d04.js";import"./index.787d69a0.js";import"./index.bd375ca9.js";import"./icon-xin2.4ab2a52d.js";import"./index.7a1af785.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 E(()=>{f.on("search",p),m()}),j(()=>{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";C(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};