1 |
- import{d as I,P as L,Q as C,U as T,S as m,j as e,z as P,F as A,Z as W,w as R,be as q,O as E,bC as D}from"./index.cf487d9e.js";import{c as G}from"./index.dffaafe3.js";import V from"./index.bf56d242.js";import{s as l,m as p}from"./header.5dc46b12.js";import{g as x}from"./music.070d0add.js";import{a as F,S as N}from"./hooks.d9eb54a1.js";import{s as y}from"./all-search.module.92b53b61.js";import{M as k}from"./index.47719f7e.js";import{S as U,a as _}from"./index.c6b3d658.js";import"./index.f45751d0.js";import"./use-tab-status.56c677c5.js";import"./index.801123b8.js";import"./index.e0acffb1.js";import"./use-id.f045e77e.js";import"./use-refs.48cf5796.js";import"./index.bc1a15dc.js";import"./index.d4b11cb0.js";import"./index.e3693273.js";import"./index.1c8c6ce9.js";import"./select-subject.38c2fc8b.js";import"./index.f3f705ee.js";import"./index.36fcf68d.js";import"./index.b915e986.js";import"./use-height.6b216291.js";import"./index.0656d807.js";import"./bg-image.e9966434.js";import"./index.a4c92fe8.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";function z(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!W(i)}var O=I({name:"music-list",props:{title:{type:String,default:"\u6700\u70ED\u66F2\u76EE"},music:{type:Array,default:()=>[]},defauleParams:{type:Object,default:()=>({})}},setup(i){const h=L(),r=C({musicList:[]}),o=(a,s)=>{const c=[];return s.forEach((n,b)=>{b<=11&&c.push(n)}),c},f=async()=>{try{const s=(await R.post("/api-student/music/sheet/appMusicSheet",{data:{...i.defauleParams}})).data||[];r.musicList=[o(12,s.topMusicSheet||[]),o(12,s.newMusicSheet||[]),o(12,s.hotMusicSheet||[])]}catch{}},v=a=>{const s=location.origin+location.pathname+"#/music-detail?id="+a.id;q(s,()=>{h.push({path:"/music-detail",query:{id:a.id}})})};T(()=>{j(),f()});const u=m(260),S=m(!1),j=()=>{S.value=!1;const a=document.body.clientWidth>750?750:document.body.clientWidth;u.value=a-120,S.value=!0};return()=>{let a;return e(A,null,[e("div",{class:l.hotMusic},[S.value&&e(U,{showIndicators:!1,loop:!1,width:u.value},z(a=r.musicList.map((s,c)=>e(_,{class:l.swipeItem},{default:()=>[e("div",{class:l.swipeChild},[e("div",{class:l.swipeTitle},[c===0&&"\u63A8\u8350\u66F2\u76EE",c===1&&"\u6700\u65B0\u66F2\u76EE",c===2&&"\u6700\u70ED\u66F2\u76EE"]),e("div",{class:l.swipeContent},[s.map((n,b)=>e("div",{class:[l.swipe,b<=2&&l.swipeTop],onClick:()=>v(n)},[e("div",{class:l.num},[b+1]),n.musicSheetName,n.exquisiteFlag==="YES"&&e("span",{class:l.hot},[P("\u70ED")])]))])])]})))?a:{default:()=>[a]})])])}}}),B=I({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(i){E();const h=L(),r=C({albumList:[]}),o=async()=>{try{const{data:f}=await R.post("/api-student/music/album/list",{data:{...i.defauleParams,page:1,rows:3}});r.albumList=f.rows||[]}catch{}};return T(()=>{o()}),()=>e("div",{class:y.allSearch},[e("div",{class:y.albumSection},[e("div",{class:y.albumTitle},[P("\u70ED\u95E8\u4E13\u8F91")]),e("div",{class:y.musicGrid},[e(k,{list:r.albumList,onGoto:f=>{h.push({name:"music-album-detail",params:{id:f.id}})}},null)])]),e("div",{class:y.musicGroup},[e(O,{defauleParams:i.defauleParams},null)])])}}),je=I({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",x());const i=E();L();const h=m(i.query.keyword||""),r=m(i.query.tagids||""),o=m(),f=m(!1),v=G("music-search",[]),u=m("all"),S=F(N.SEARCH);o.value=S.id;const j=t=>{var d,w;console.log(t,"val"),h.value=t;const g=v.value.indexOf(t);g>-1&&v.value.splice(g,1),t&&(v.value.unshift(t),v.value.length=Math.min(v.value.length,10)),(w=(d=(u.value==="album"?c:n).value).onSearch)==null||w.call(d,t)},a=t=>{var d,w;const g=Object.values(t).flat().filter(Boolean).join(",");r.value=g,(w=(d=(u.value==="album"?c:n).value).onComfirm)==null||w.call(d,t),f.value=!1},s=t=>{var M,d;o.value=t.id,(d=(M=(u.value==="album"?c:n).value).onComfirmSubject)==null||d.call(M,t)},c=m(null),n=m(null),b=t=>{console.log(t,"val"),u.value=t};return T(()=>{p.on("changeTab",b),p.on("search",j),p.on("confirm",a),p.on("confirmSubject",s),console.log(u.value,"activeTab.value")}),D(()=>{p.off("changeTab",b),p.off("search",j),p.off("confirm",a),p.off("confirmSubject",s)}),()=>e("div",{class:l.search},[u.value==="all"&&e(B,{defauleParams:{albumTagIds:r.value,subjectIds:o.value}},null),u.value==="album"&&e(V,{hideSearch:!0,ref:c,defauleParams:{albumTagIds:r.value,subjectIds:o.value}},null),u.value==="songe"&&e("div",{class:l.musicGroup},[e(O,{defauleParams:{musicTagIds:r.value,subjectIds:o.value}},null)])])}});export{je as default};
|