1 |
- import{d as O,g as N,S as c,P as I,O as E,bD as H,a2 as A,U as K,Q as M,j as o,M as S,R as P,aR as _,Z as V}from"./index.e6d6174e.js";import{S as x}from"./index.9093bc60.js";import{T as U}from"./index.05f2b7dd.js";import"./index.b4a53c6a.js";import{T as z,a as y}from"./index.54627972.js";import{m as B}from"./mitt.550594b0.js";import{S as J}from"./index.c42f80e3.js";import{c as D}from"./index.684ca989.js";import{c as L}from"./index.926ca9c5.js";import{S as Q}from"./select-tag.3f6ab952.js";import{g as W}from"./music.ce788382.js";import{S as Z}from"./select-subject.5521b320.js";import{a as i,S as u}from"./hooks.00b5b341.js";const $="_search_ngdof_1",q="_sticky_ngdof_9",F="_title_ngdof_15",G="_keywords_ngdof_21",X="_content_ngdof_28",Y="_searchKeyword_ngdof_38",ee="_remove_ngdof_46",oe="_label_ngdof_49";var n={search:$,sticky:q,title:F,keywords:G,content:X,searchKeyword:Y,remove:ee,label:oe};function te(d){return typeof d=="function"||Object.prototype.toString.call(d)==="[object Object]"&&!V(d)}const m=B(),j=c();var se=O({name:"MusicSearchHeader",setup(){if(!i(u.SEARCH).id){const e=N.user.data,s=e.subjectId?Number(e.subjectId.split(",")[0]):"",r=e.subjectName?e.subjectName.split(",")[0]:"";s&&i(u.SEARCH,JSON.stringify({id:s,name:r}),"set")}const k=c();localStorage.setItem("behaviorId",W());const w=I(),f=E(),h=c(""),p=c(""),b=c(!1),a=D("music-search",[]),l=c("songe");H(()=>{var s,r;const e=i(u.SEARCH);if(t.name=e.name||"\u5168\u90E8\u58F0\u90E8",t.id=e.id,f.path==="/music-songbook/search"){h.value="",p.value="",l.value="songe";try{(r=(s=j.value)==null?void 0:s.resetTags)==null||r.call(s)}catch(T){console.log(T)}}return!0}),A(l,e=>{m.emit("changeTab",e)});const g=e=>{h.value=e;const s=a.value.indexOf(e);s>-1&&a.value.splice(s,1),e&&(a.value.unshift(e),a.value.length=Math.min(a.value.length,5)),m.emit("search",e)},C=(e,s="")=>{const r=Object.values(e).flat().filter(Boolean).join(",");p.value=r,m.emit("confirm",e),b.value=!1},R=e=>{t.name=e.name,t.id=e.id,i(u.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set"),m.emit("confirmSubject",t),t.show=!1};K(()=>{});const v=i(u.SEARCH),t=M({show:!1,name:v.name||"\u5168\u90E8\u58F0\u90E8",id:v.id||""});return()=>o("div",{class:n.search},[o(x,{class:n.sticky},{default:()=>[o(J,{modelValue:h.value,ref:k,onSearch:g,onClick:()=>{f.path==="/music-songbook"&&w.push({path:"/music-songbook/search"})}},{left:()=>o("div",{class:n.label,onClick:()=>t.show=!0},[t.name,o(S,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),f.path==="/music-songbook/search"&&o(z,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:l.value,"onUpdate:active":e=>l.value=e,onChange:e=>l.value=e},{default:()=>[o(y,{title:"\u5355\u66F2",name:"songe"},null),o(y,{title:"\u4E13\u8F91",name:"album"},null)]})]}),a.value.length>0&&f.path==="/music-songbook/search"&&o("div",{class:L(n.keywords,"van-hairline--bottom")},[o("div",{class:n.content},[a.value.map(e=>o(U,{round:!0,class:n.searchKeyword,key:e,onClick:()=>g(e)},te(e)?e:{default:()=>[e]}))]),o(S,{class:n.remove,name:"delete-o",onClick:()=>a.value=[]},null)]),o(P,null,null),o(_,{show:b.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>b.value=e},{default:()=>[o(Q,{ref:j,onConfirm:C,onCancel:()=>{}},null)]}),o(_,{show:t.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>t.show=!1,onClosed:()=>t.show=!1},{default:()=>[o(Z,{searchParams:t,onComfirm:R},null)]})])}}),ge=Object.freeze(Object.defineProperty({__proto__:null,mitter:m,default:se},Symbol.toStringTag,{value:"Module"}));export{ge as h,m,n as s};
|