import{d as M,S as L,U as C,W as T,V as m,j as e,B as R,F as E,a0 as W,y as O,A as G,bf as V,Q as P,O as k,bk as q}from"./ResizeObserver.es.62ab429c.js";import{d as D}from"./index.a6e5e68b.js";import x from"./index.309e98e0.js";import{s as i,m as p}from"./header.ea2a8e68.js";import{g as F}from"./music.9463d067.js";import{b as N,S as B}from"./hooks.3b599d36.js";import{s as S}from"./all-search.module.dc7766ff.js";import{M as H}from"./index.16b0645f.js";import{S as U,a as _}from"./index.3d6f6bcd.js";import"./index.00698f4b.js";import"./use-tab-status.a98984d2.js";import"./index.b0c6821a.js";import"./index.ffd89e39.js";import"./use-id.1bbe472d.js";import"./use-refs.259e72cb.js";import"./index.021584f9.js";import"./index.da737397.js";import"./index.d7a13e47.js";import"./index.002d8e53.js";import"./index.82be4917.js";import"./select-subject.87733b5b.js";import"./index.0eba5ce9.js";import"./index.786e83cc.js";import"./index.1db64c88.js";import"./bg-image.e9966434.js";import"./index.2a571689.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";function K(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!W(o)}var A=M({name:"music-list",props:{title:{type:String,default:"\u6700\u70ED\u66F2\u76EE"},music:{type:Array,default:()=>[]},defauleParams:{type:Object,default:()=>({})}},setup(o){const h=L(),r=C({musicList:[]}),u=(a,s)=>{const l=[];return s.forEach((n,b)=>{b<=11&&l.push(n)}),l},f=async()=>{try{const s=(await O.post("/api-student/music/sheet/appMusicSheet",{data:{...o.defauleParams}})).data||[];r.musicList=[u(12,s.topMusicSheet||[]),u(12,s.newMusicSheet||[]),u(12,s.hotMusicSheet||[])]}catch{}},v=a=>{const s=G()+location.pathname+"#/music-detail?id="+a.id;V(s,()=>{h.push({path:"/music-detail",query:{id:a.id}})})};T(()=>{j(),f()});const c=m(260),g=m(!1),j=()=>{g.value=!1;const a=document.body.clientWidth>750?750:document.body.clientWidth;c.value=a-120,g.value=!0};return()=>{let a;return e(E,null,[e("div",{class:i.hotMusic},[g.value&&e(U,{showIndicators:!1,loop:!1,width:c.value},K(a=r.musicList.map((s,l)=>e(_,{class:i.swipeItem},{default:()=>[e("div",{class:i.swipeChild},[e("div",{class:i.swipeTitle},[l===0&&"\u63A8\u8350\u66F2\u76EE",l===1&&"\u6700\u65B0\u66F2\u76EE",l===2&&"\u6700\u70ED\u66F2\u76EE"]),e("div",{class:i.swipeContent},[s.map((n,b)=>e("div",{class:[i.swipe,b<=2&&i.swipeTop],onClick:()=>v(n)},[e("div",{class:i.num},[b+1]),n.musicSheetName,n.exquisiteFlag==="YES"&&e("span",{class:i.hot},[R("\u70ED")])]))])])]})))?a:{default:()=>[a]})])])}}}),Q=M({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(o){P();const h=L(),r=C({albumList:[]}),u=async()=>{try{const{data:f}=await O.post("/api-student/music/album/list",{data:{...o.defauleParams,page:1,rows:3}});r.albumList=f.rows||[]}catch{}};return T(()=>{u()}),()=>e("div",{class:S.allSearch},[e("div",{class:S.albumSection},[e("div",{class:S.albumTitle},[e("p",null,[R("\u70ED\u95E8\u4E13\u8F91")]),e(k,{name:"arrow",class:S.iconArrow,onClick:()=>{h.push({path:"/music-album"})}},null)]),e("div",{class:S.musicGrid},[e(H,{list:r.albumList,onGoto:f=>{h.push({name:"music-album-detail",params:{id:f.id}})}},null)])]),e("div",{class:S.musicGroup},[e(A,{defauleParams:o.defauleParams},null)])])}}),Ie=M({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",F());const o=P();L();const h=m(o.query.keyword||""),r=m(o.query.tagids||""),u=m(),f=m(!1),v=D("music-search",[]),c=m("all"),g=N(B.SEARCH);u.value=g.id;const j=t=>{var d,y;console.log(t,"val"),h.value=t;const w=v.value.indexOf(t);w>-1&&v.value.splice(w,1),t&&(v.value.unshift(t),v.value.length=Math.min(v.value.length,10)),(y=(d=(c.value==="album"?l:n).value).onSearch)==null||y.call(d,t)},a=t=>{var d,y;const w=Object.values(t).flat().filter(Boolean).join(",");r.value=w,(y=(d=(c.value==="album"?l:n).value).onComfirm)==null||y.call(d,t),f.value=!1},s=t=>{var I,d;u.value=t.id,(d=(I=(c.value==="album"?l:n).value).onComfirmSubject)==null||d.call(I,t)},l=m(null),n=m(null),b=t=>{console.log(t,"val"),c.value=t};return T(()=>{p.on("changeTab",b),p.on("search",j),p.on("confirm",a),p.on("confirmSubject",s),console.log(c.value,"activeTab.value")}),q(()=>{p.off("changeTab",b),p.off("search",j),p.off("confirm",a),p.off("confirmSubject",s)}),()=>e("div",{class:i.search},[c.value==="all"&&e(Q,{defauleParams:{albumTagIds:r.value,subjectIds:u.value}},null),c.value==="album"&&e("div",{class:i.alubmGroupSearch},[e(x,{hideSearch:!0,ref:l,defauleParams:{albumTagIds:r.value,subjectIds:u.value}},null)]),c.value==="songe"&&e("div",{class:[i.musicGroup,"mt8"]},[e(A,{defauleParams:{musicTagIds:r.value,subjectIds:u.value}},null)])])}});export{Ie as default};
