1 |
- import{d as R,l as d,k as T,u as O,aC as K,_ as I,m as M,h as V,a as o,S as A,K as S,v as E,w as j,U as H,x as N,R as P,P as y}from"./vendor.0f683fb2.js";/* empty css *//* empty css *//* empty css *//* empty css */import{C as U}from"./index.30f2de60.js";import{c as z}from"./index.3db72433.js";import{c as B}from"./index.926ca9c5.js";import{S as D}from"./select-tag.713e43b2.js";import{g as F}from"./music.e671788b.js";import{S as J}from"./select-subject.adfa1e3c.js";import{u as v,S as b}from"./hooks.98aa8438.js";function L(s){return{all:s=s||new Map,on:function(r,a){var t=s.get(r);t?t.push(a):s.set(r,[a])},off:function(r,a){var t=s.get(r);t&&(a?t.splice(t.indexOf(a)>>>0,1):s.set(r,[]))},emit:function(r,a){var t=s.get(r);t&&t.slice().map(function(i){i(a)}),(t=s.get("*"))&&t.slice().map(function(i){i(r,a)})}}}const W="_search_ngdof_1",$="_sticky_ngdof_9",q="_title_ngdof_15",G="_keywords_ngdof_21",Q="_content_ngdof_28",X="_searchKeyword_ngdof_38",Y="_remove_ngdof_46",Z="_label_ngdof_49";var u={search:W,sticky:$,title:q,keywords:G,content:Q,searchKeyword:X,remove:Y,label:Z};function ee(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!N(s)}const f=L(),w=d();var oe=R({name:"MusicSearchHeader",setup(){const s=d();localStorage.setItem("behaviorId",F());const r=T(),a=O(),t=d(""),i=d(""),h=d(!1),c=z("music-search",[]),m=d("songe");K(()=>{var l,g;const e=v(b.SEARCH);if(n.name=e.name||"\u5168\u90E8\u58F0\u90E8",n.id=e.id,a.path==="/music-songbook/search"){t.value="",i.value="",m.value="songe";try{(g=(l=w.value)==null?void 0:l.resetTags)==null||g.call(l)}catch(x){console.log(x)}}return!0}),I(m,e=>{f.emit("changeTab",e)});const p=e=>{t.value=e;const l=c.value.indexOf(e);l>-1&&c.value.splice(l,1),e&&(c.value.unshift(e),c.value.length=Math.min(c.value.length,5)),f.emit("search",e)},k=(e,l="")=>{const g=Object.values(e).flat().filter(Boolean).join(",");i.value=g,f.emit("confirm",e),h.value=!1},C=e=>{n.name=e.name,n.id=e.id,v(b.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set"),f.emit("confirmSubject",n),n.show=!1};M(()=>{});const _=v(b.SEARCH),n=V({show:!1,name:_.name||"\u5168\u90E8\u58F0\u90E8",id:_.id||""});return()=>o("div",{class:u.search},[o(A,{class:u.sticky},{default:()=>[o(U,{modelValue:t.value,showAction:!0,ref:s,onSearch:p,onFilter:()=>h.value=!0,filterDot:!!i.value,onClick:()=>{a.path==="/music-songbook"&&r.push({path:"/music-songbook/search"})}},{left:()=>o("div",{class:u.label,onClick:()=>n.show=!0},[n.name,o(S,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),a.path==="/music-songbook/search"&&o(E,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:m.value,"onUpdate:active":e=>m.value=e,onChange:e=>m.value=e},{default:()=>[o(j,{title:"\u5355\u66F2",name:"songe"},null),o(j,{title:"\u4E13\u8F91",name:"album"},null)]})]}),c.value.length>0&&a.path==="/music-songbook/search"&&o("div",{class:B(u.keywords,"van-hairline--bottom")},[o("div",{class:u.content},[c.value.map(e=>o(H,{round:!0,class:u.searchKeyword,key:e,onClick:()=>p(e)},ee(e)?e:{default:()=>[e]}))]),o(S,{class:u.remove,name:"delete-o",onClick:()=>c.value=[]},null)]),o(P,null,null),o(y,{show:h.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>h.value=e},{default:()=>[o(D,{ref:w,onConfirm:k,onCancel:()=>{}},null)]}),o(y,{show:n.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>n.show=!1,onClosed:()=>n.show=!1},{default:()=>[o(J,{isReset:!0,searchParams:n,onComfirm:C},null)]})])}}),he=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mitter:f,default:oe});export{he as h,f as m,u as s};
|