1 |
- import{d as N,g as O,U as f,Q as I,P as H,bG as E,a3 as V,V as x,S as A,j as t,N as _,R as K,aS as y,$ as M}from"./ResizeObserver.es.39b48a47.js";import{T as P}from"./index.34ac729a.js";import"./index.608320e9.js";import"./index.0e35d2fb.js";import{T as U,a as j}from"./index.5d4d28cc.js";import{S as z}from"./index.e10a1ae2.js";import{d as B}from"./index.dc19bc54.js";import{c as J}from"./index.926ca9c5.js";import{S as $}from"./select-tag.c133608d.js";import{g as G}from"./music.27f3de35.js";import{S as L}from"./select-subject.5a3e156f.js";import{a as b,S as h}from"./hooks.6df65925.js";import{C as Q}from"./index.970ad07b.js";import{T as W}from"./index.e90d2179.js";function q(a){return{all:a=a||new Map,on:function(r,c){var o=a.get(r);o?o.push(c):a.set(r,[c])},off:function(r,c){var o=a.get(r);o&&(c?o.splice(o.indexOf(c)>>>0,1):a.set(r,[]))},emit:function(r,c){var o=a.get(r);o&&o.slice().map(function(i){i(c)}),(o=a.get("*"))&&o.slice().map(function(i){i(r,c)})}}}const D="_search_152bw_1",F="_sticky_152bw_9",X="_title_152bw_12",Y="_keywords_152bw_18",Z="_content_152bw_25",ee="_searchKeyword_152bw_35",te="_remove_152bw_43",oe="_label_152bw_46";var u={search:D,sticky:F,title:X,keywords:Y,content:Z,searchKeyword:ee,remove:te,label:oe};function ae(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!M(a)}const p=q(),k=f();var se=N({name:"MusicSearchHeader",setup(){if(!b(h.SEARCH).id){const e=O.user.data,n=e.subjectId?Number(e.subjectId.split(",")[0]):"",m=e.subjectName?e.subjectName.split(",")[0]:"";n&&b(h.SEARCH,JSON.stringify({id:n,name:m}),"set")}const r=f();localStorage.setItem("behaviorId",G());const c=I(),o=H(),i=f(""),g=f(""),v=f(!1),l=B("music-search",[]),d=f("songe");E(()=>{var n,m;const e=b(h.SEARCH);if(s.name=e.name||"\u5168\u90E8\u58F0\u90E8",s.id=e.id,o.path==="/music-songbook/search"){i.value="",g.value="",d.value="songe";try{(m=(n=k.value)==null?void 0:n.resetTags)==null||m.call(n)}catch(T){console.log(T)}}return!0}),V(d,e=>{p.emit("changeTab",e)});const S=e=>{i.value=e;const n=l.value.indexOf(e);n>-1&&l.value.splice(n,1),e&&(l.value.unshift(e),l.value.length=Math.min(l.value.length,5)),p.emit("search",e)},C=(e,n="")=>{const m=Object.values(e).flat().filter(Boolean).join(",");g.value=m,p.emit("confirm",e),v.value=!1},R=e=>{s.name=e.name,s.id=e.id,b(h.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set"),p.emit("confirmSubject",s),s.show=!1};x(()=>{});const w=b(h.SEARCH),s=A({show:!1,name:w.name||"\u5168\u90E8\u58F0\u90E8",id:w.id||""});return()=>t("div",{class:u.search},[t(W,{class:u.sticky},{default:()=>[t(Q,{border:!1},null),t(z,{modelValue:i.value,ref:r,onSearch:S,onClick:()=>{o.path==="/music-songbook"&&c.push({path:"/music-songbook/search"})}},{left:()=>t("div",{class:u.label,onClick:()=>s.show=!0},[s.name,t(_,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),o.path==="/music-songbook/search"&&t(U,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:d.value,"onUpdate:active":e=>d.value=e,onChange:e=>d.value=e},{default:()=>[t(j,{title:"\u5355\u66F2",name:"songe"},null),t(j,{title:"\u4E13\u8F91",name:"album"},null)]})]}),l.value.length>0&&o.path==="/music-songbook/search"&&t("div",{class:J(u.keywords,"van-hairline--bottom")},[t("div",{class:u.content},[l.value.map(e=>t(P,{round:!0,class:u.searchKeyword,key:e,onClick:()=>S(e)},ae(e)?e:{default:()=>[e]}))]),t(_,{class:u.remove,name:"delete-o",onClick:()=>l.value=[]},null)]),t(K,null,null),t(y,{show:v.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>v.value=e},{default:()=>[t($,{ref:k,onConfirm:C,onCancel:()=>{}},null)]}),t(y,{show:s.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>s.show=!1,onClosed:()=>s.show=!1},{default:()=>[t(L,{searchParams:s,onComfirm:R},null)]})])}}),Se=Object.freeze(Object.defineProperty({__proto__:null,mitter:p,default:se},Symbol.toStringTag,{value:"Module"}));export{Se as h,p as m,u as s};
|