search-result.c769cd4f.js 4.3 KB

1
  1. import{d as w,O as y,P as C,Q as O,S as c,U as M,bC as x,j as e,z as T,M as $,C as q,w as G}from"./index.b4a0de7c.js";import{d as k}from"./index.bd7d996a.js";import V from"./index.69c7a1f8.js";import{m as l,o as j,s as R}from"./header.3bbe0cf6.js";import{g as E}from"./music.95a41d2b.js";import{a as F,S as z}from"./hooks.806a8450.js";import{s as i}from"./all-search.module.dc7766ff.js";import{M as U}from"./index.4bc66b58.js";import N from"./index.87c83229.js";import"./index.a8cf8476.js";import"./index.49a7e792.js";import"./use-tab-status.ebba8d99.js";import"./index.14d6a3bc.js";import"./index.6e8f6d03.js";import"./index.ad95864c.js";import"./use-id.0bfd97f9.js";import"./use-refs.0df81815.js";import"./index.aeaf5bd0.js";import"./index.dc154740.js";import"./index.acc28693.js";import"./index.aa631a7e.js";import"./index.5972a35c.js";import"./select-subject.9ee54505.js";import"./index.e5d17ac7.js";import"./index.f1be2c7e.js";import"./index.54d07301.js";import"./bg-image.e9966434.js";import"./index.ffd3fadc.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";import"./index.fd6e375c.js";import"./index.982b5f8e.js";import"./index.2ec1ac97.js";import"./index.5de45cf3.js";var W=w({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(n){y();const p=C(),a=O({albumList:[],loading:!1,defauleParams:n.defauleParams}),d=async()=>{a.loading=!0;try{const{data:t}=await G.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,h;a.defauleParams.idAndName=t,d(),(h=(b=r.value).onSearch)==null||h.call(b,t)};return M(()=>{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`,()=>{p.push({path:"/music-album"})})}},[T("\u66F4\u591A "),e($,{name:"arrow"},null)])]),e("div",{class:i.musicGrid},[e(U,{showLight:!0,lightText:a.defauleParams.idAndName,list:a.albumList,onGoto:t=>{j(`${location.origin}/tenant/#/music-album-detail/${t.id}`,()=>{p.push({name:"music-album-detail",params:{id:t.id}})})}},null),a.albumList.length<=0&&!a.loading&&e(q,{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(N,{hideSearch:!0,ref:r,onItemClick:t=>{j(`${location.origin}/tenant/#/music-detail?id=${t.id}`,()=>{p.push({path:"/music-detail",query:{id:t.id}})})},showLight:!0,lightText:a.defauleParams.idAndName,defauleParams:{...n.defauleParams,idAndName:n.defauleParams.search}},null)])])}}),Pa=w({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",E());const n=y(),p=C(),a=c(n.query.search||""),d=c(n.query.tagids||""),r=c(),v=c(!1),t=k("music-search",[]),u=c("all"),b=F(z.SEARCH);r.value=b.id;const h=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 M(()=>{l.on("changeTab",P),l.on("search",h),l.on("confirm",A),l.on("confirmSubject",I)}),x(()=>{l.off("changeTab",P),l.off("search",h),l.off("confirm",A),l.off("confirmSubject",I)}),()=>e("div",{class:R.search},[u.value==="all"&&e(W,{defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value}},null),u.value==="album"&&e("div",{class:"mt12"},[e(V,{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(N,{hideSearch:!0,showLight:!0,lightText:a.value,defauleParams:{idAndName:a.value,albumTagIds:d.value,subjectIds:r.value},ref:S,onItemClick:s=>{p.push({path:"/music-detail",query:{id:s.id,albumId:n.params.id}})}},null)])])}});export{Pa as default};