index.370f2572.js 2.6 KB

1
  1. import{d as y,O as C,P as T,S as a,U as x,bD as L,j as v}from"./index.40f4b64d.js";import{d as M}from"./index.489876c1.js";import O from"./index.443f34df.js";import k from"./index.2712a902.js";import{m as o,s as q}from"./header.20ef3c5e.js";import{g as w}from"./music.5471694f.js";import{a as P,S as A}from"./hooks.2e42c921.js";import"./index.5e0f25ab.js";import"./use-tab-status.7423f29c.js";import"./index.56cebac4.js";import"./index.df9064eb.js";import"./index.54e6d83c.js";import"./use-id.d148d155.js";import"./use-refs.fee9cfed.js";import"./index.f15d9073.js";import"./index.7d1a23c4.js";import"./index.1014dabb.js";import"./select-subject.4a4e01a1.js";import"./index.fc52eb63.js";import"./index.86767dad.js";import"./index.a66f307e.js";import"./index.21ebe2ef.js";import"./icon-xin.62588855.js";import"./index.c44a09c1.js";import"./index.c51e1e5e.js";import"./index.d5da1d8a.js";import"./select-tag.be44cf57.js";import"./index.0e3dd7fb.js";import"./index.04092a81.js";import"./index.926ca9c5.js";import"./index.a822915c.js";import"./index.84929eb7.js";import"./icon_uploader.ff962490.js";import"./icon_album.ed729d4a.js";import"./icon_album_active.469423f9.js";import"./icon_exquisite.4b18ad76.js";import"./icon_music_active.1e7b47ef.js";import"./icon-play.bc9e7aab.js";var Se=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",w());const p=C(),j=T(),d=a(p.query.keyword||""),r=a(p.query.tagids||""),c=a(),R=a(!1),i=M("music-search",[]),s=a("songe"),I=P(A.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const m=i.value.indexOf(e);m>-1&&i.value.splice(m,1),e&&(i.value.unshift(e),i.value.length=Math.min(i.value.length,5)),(u=(t=(s.value==="album"?n:l).value).onSearch)==null||u.call(t,e)},h=e=>{var t,u;const m=Object.values(e).flat().filter(Boolean).join(",");r.value=m,(u=(t=(s.value==="album"?n:l).value).onComfirm)==null||u.call(t,e),R.value=!1},g=e=>{var f,t;c.value=e.id,(t=(f=(s.value==="album"?n:l).value).onComfirmSubject)==null||t.call(f,e)},n=a(null),l=a(null),S=e=>{s.value=e};return x(()=>{o.on("changeTab",S),o.on("search",b),o.on("confirm",h),o.on("confirmSubject",g)}),L(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:q.search},[s.value==="album"?v(O,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:r.value,albumTagIds:r.value,subjectIds:c.value}},null):v(k,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:p.params.id}})},defauleParams:{search:d.value,tagids:r.value,musicTagIds:r.value,subjectIds:c.value}},null)])}});export{Se as default};