search-result.0518d85e.js 4.3 KB

1
  1. import{d as y,P as w,Q as C,S as $,U as c,V as N,bi as x,j as e,A as T,N as q,C as G,y as O}from"./ResizeObserver.es.b7226882.js";import{d as V}from"./index.1eaf642c.js";import k from"./index.1ef16482.js";import{m as l,o as j,s as R}from"./header.3dca94d7.js";import{g as E}from"./music.7cc0b22d.js";import{a as F,S as U}from"./hooks.a4ed20cb.js";import{s as i}from"./all-search.module.dc7766ff.js";import{M as W}from"./index.03e3393d.js";import M from"./index.7bc348a0.js";import"./index.9fec2202.js";import"./use-tab-status.db1f6d2e.js";import"./index.f6c44874.js";import"./index.cf00521e.js";import"./index.dc988884.js";import"./use-id.5d5e6e63.js";import"./use-refs.428b450a.js";import"./index.20c0f4c5.js";import"./index.287fb1bf.js";import"./index.40f703b6.js";import"./index.521acd0b.js";import"./index.021f1c7b.js";import"./select-subject.355ffa48.js";import"./index.ed3a5560.js";import"./index.969bba7f.js";import"./index.1743594f.js";import"./bg-image.e9966434.js";import"./index.023f50db.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";import"./index.1799aedf.js";import"./index.b1e15d61.js";import"./index.5f9ef71b.js";import"./index.3532de0c.js";var z=y({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(n){w();const h=C(),a=$({albumList:[],loading:!1,defauleParams:n.defauleParams}),d=async()=>{a.loading=!0;try{const{data:t}=await O.post("/api-student/music/album/list",{data:{...a.defauleParams,page:1,rows:3}});a.albumList=t.rows||[]}catch{}a.loading=!1},r=c(null),v=t=>{var b,p;a.defauleParams.idAndName=t,d(),(p=(b=r.value).onSearch)==null||p.call(b,t)};return N(()=>{d(),l.on("search",v)}),x(()=>{l.off("search",v)}),()=>e("div",{class:i.allSearch},[a.albumList.length>0&&e("div",{class:[i.albumSection,i.searchAllTitle]},[e("div",{class:i.albumTitle},[e("span",null,[T("\u4E13\u8F91")]),e("span",{class:i.more,onClick:()=>{j(`${location.origin}/tenant/#/music-album`,()=>{h.push({path:"/music-album"})})}},[T("\u66F4\u591A "),e(q,{name:"arrow"},null)])]),e("div",{class:i.musicGrid},[e(W,{showLight:!0,lightText:a.defauleParams.idAndName,list:a.albumList,onGoto:t=>{j(`${location.origin}/tenant/#/music-album-detail/${t.id}`,()=>{h.push({name:"music-album-detail",params:{id:t.id}})})}},null),a.albumList.length<=0&&!a.loading&&e(G,{tips:"\u6682\u65E0\u4E13\u8F91",btnStatus:!1,classImgSize:"SMALL"},null)])]),e("div",{class:[i.albumSection,i.searchAllTitle,i.musicGroup]},[e("div",{class:i.albumTitle},[T("\u5355\u66F2")]),e(M,{hideSearch:!0,ref:r,onItemClick:t=>{j(`${location.origin}/tenant/#/music-detail?id=${t.id}`,()=>{h.push({path:"/music-detail",query:{id:t.id}})})},showLight:!0,lightText:a.defauleParams.idAndName,defauleParams:{...n.defauleParams,idAndName:n.defauleParams.search}},null)])])}}),Ia=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",E());const n=w(),h=C(),a=c(n.query.search||""),d=c(n.query.tagids||""),r=c(),v=c(!1),t=V("music-search",[]),u=c("all"),b=F(U.SEARCH);r.value=b.id;const p=s=>{var o,f;if(u.value!=="all"){a.value=s;const m=t.value.indexOf(s);m>-1&&t.value.splice(m,1),s&&(t.value.unshift(s),t.value.length=Math.min(t.value.length,10)),(f=(o=(u.value==="album"?g:S).value)==null?void 0:o.onSearch)==null||f.call(o,s)}},A=s=>{var m,L;const o=Object.values(s).flat().filter(Boolean).join(",");d.value=o,(L=(m=(u.value==="album"?g:S).value).onComfirm)==null||L.call(m,s),v.value=!1},I=s=>{var f,m;r.value=s.id,(m=(f=(u.value==="album"?g:S).value).onComfirmSubject)==null||m.call(f,s)},g=c(null),S=c(null),P=(s,o)=>{a.value=o,u.value=s};return N(()=>{l.on("changeTab",P),l.on("search",p),l.on("confirm",A),l.on("confirmSubject",I)}),x(()=>{l.off("changeTab",P),l.off("search",p),l.off("confirm",A),l.off("confirmSubject",I)}),()=>e("div",{class:R.search},[u.value==="all"&&e(z,{defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value}},null),u.value==="album"&&e("div",{class:"mt12"},[e(k,{hideSearch:!0,showLight:!0,lightText:a.value,ref:g,defauleParams:{search:a.value,albumTagIds:d.value,subjectIds:r.value}},null)]),u.value==="songe"&&e("div",{class:[R.musicGroup]},[e(M,{hideSearch:!0,showLight:!0,lightText:a.value,defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value},ref:S,onItemClick:s=>{h.push({path:"/music-detail",query:{id:s.id,albumId:n.params.id}})}},null)])])}});export{Ia as default};