index.0c001612.js 4.7 KB

1
  1. import{d as I,P as C,Q as T,U as L,S as m,j as e,z as P,F as A,Z as G,w as R,be as W,O as E,M as q,bC as D}from"./index.394decd7.js";import{d as V}from"./index.75a0444f.js";import k from"./index.cc6e5587.js";import{s as o,m as p}from"./header.a67ec441.js";import{g as x}from"./music.a1b63125.js";import{a as F,S as N}from"./hooks.9e5ee122.js";import{s as S}from"./all-search.module.dc7766ff.js";import{M as U}from"./index.9edf267d.js";import{S as _,a as z}from"./index.f1b52763.js";import"./index.b9aedd1d.js";import"./index.dc786267.js";import"./use-tab-status.723110ee.js";import"./index.3bbf4ddb.js";import"./index.ae00317c.js";import"./use-id.e2f22365.js";import"./use-refs.09b2d19c.js";import"./index.ae2dd816.js";import"./index.5d26697d.js";import"./index.9e0d46e4.js";import"./index.ada5e712.js";import"./index.224299a1.js";import"./select-subject.fa696791.js";import"./index.dab716ce.js";import"./index.e6e212d8.js";import"./index.88270f6d.js";import"./bg-image.e9966434.js";import"./index.9849c993.js";import"./icon-xin2.4ab2a52d.js";import"./index.b6ce06cf.js";import"./index.926ca9c5.js";function B(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!G(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 b=C(),r=T({musicList:[]}),u=(a,s)=>{const l=[];return s.forEach((n,h)=>{h<=11&&l.push(n)}),l},f=async()=>{try{const s=(await R.post("/api-student/music/sheet/appMusicSheet",{data:{...i.defauleParams}})).data||[];r.musicList=[u(12,s.topMusicSheet||[]),u(12,s.newMusicSheet||[]),u(12,s.hotMusicSheet||[])]}catch{}},v=a=>{const s=location.origin+location.pathname+"#/music-detail?id="+a.id;W(s,()=>{b.push({path:"/music-detail",query:{id:a.id}})})};L(()=>{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(A,null,[e("div",{class:o.hotMusic},[g.value&&e(_,{showIndicators:!1,loop:!1,width:c.value},B(a=r.musicList.map((s,l)=>e(z,{class:o.swipeItem},{default:()=>[e("div",{class:o.swipeChild},[e("div",{class:o.swipeTitle},[l===0&&"\u63A8\u8350\u66F2\u76EE",l===1&&"\u6700\u65B0\u66F2\u76EE",l===2&&"\u6700\u70ED\u66F2\u76EE"]),e("div",{class:o.swipeContent},[s.map((n,h)=>e("div",{class:[o.swipe,h<=2&&o.swipeTop],onClick:()=>v(n)},[e("div",{class:o.num},[h+1]),n.musicSheetName,n.exquisiteFlag==="YES"&&e("span",{class:o.hot},[P("\u70ED")])]))])])]})))?a:{default:()=>[a]})])])}}}),H=I({name:"MusicSearch",props:{defauleParams:{type:Object,default:()=>({})}},emits:["confirm"],setup(i){E();const b=C(),r=T({albumList:[]}),u=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 L(()=>{u()}),()=>e("div",{class:S.allSearch},[e("div",{class:S.albumSection},[e("div",{class:S.albumTitle},[e("p",null,[P("\u70ED\u95E8\u4E13\u8F91")]),e(q,{name:"arrow",class:S.iconArrow,onClick:()=>{b.push({path:"/music-album"})}},null)]),e("div",{class:S.musicGrid},[e(U,{list:r.albumList,onGoto:f=>{b.push({name:"music-album-detail",params:{id:f.id}})}},null)])]),e("div",{class:S.musicGroup},[e(O,{defauleParams:i.defauleParams},null)])])}}),Me=I({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",x());const i=E();C();const b=m(i.query.keyword||""),r=m(i.query.tagids||""),u=m(),f=m(!1),v=V("music-search",[]),c=m("all"),g=F(N.SEARCH);u.value=g.id;const j=t=>{var d,y;console.log(t,"val"),b.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 M,d;u.value=t.id,(d=(M=(c.value==="album"?l:n).value).onComfirmSubject)==null||d.call(M,t)},l=m(null),n=m(null),h=t=>{console.log(t,"val"),c.value=t};return L(()=>{p.on("changeTab",h),p.on("search",j),p.on("confirm",a),p.on("confirmSubject",s),console.log(c.value,"activeTab.value")}),D(()=>{p.off("changeTab",h),p.off("search",j),p.off("confirm",a),p.off("confirmSubject",s)}),()=>e("div",{class:o.search},[c.value==="all"&&e(H,{defauleParams:{albumTagIds:r.value,subjectIds:u.value}},null),c.value==="album"&&e("div",{class:o.alubmGroupSearch},[e(k,{hideSearch:!0,ref:l,defauleParams:{albumTagIds:r.value,subjectIds:u.value}},null)]),c.value==="songe"&&e("div",{class:[o.musicGroup,"mt8"]},[e(O,{defauleParams:{musicTagIds:r.value,subjectIds:u.value}},null)])])}});export{Me as default};