import{d as h,Q as y,S as T,U as _,V as t,a4 as A,j as i,y as L,g as m,A as w,bf as N,C as E}from"./ResizeObserver.es.62ab429c.js";import{L as S}from"./index.00698f4b.js";import{S as C}from"./index.df4cff80.js";import{M as G}from"./index.281d2be5.js";const M="_personal_tq7si_1",P="_songEfficacy_tq7si_20",R="_songContainer_tq7si_24",x="_title_tq7si_29",H="_btnGroup_tq7si_41",I="_practice_tq7si_50",F="_personalSong_tq7si_51",z="_musicGrid_tq7si_60";var b={personal:M,songEfficacy:P,songContainer:R,title:x,btnGroup:H,practice:I,personalSong:F,musicGrid:z},Q=h({name:"MusicList",emits:["favorite"],props:{gift:{type:Number,default:0}},setup(c,{expose:g,emit:p}){const l=y(),v=T(),e=_({search:l.query.search||"",musicTagIds:l.query.tagids||"",gift:c.gift,page:1}),u=t(null),s=t([]),r=t(!1),a=t(!1),d=t(!1),f=async()=>{if(!r.value){r.value=!0,d.value=!1;try{const n=await L("/music/sheet/my",{method:m.platformType==="TEACHER"?"POST":"GET",prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",params:e,data:m.platformType==="TEACHER"?e:{}});s.value=[...s.value,...n.data.rows],u.value=n.data,e.page=n.data.pageNo+1,a.value=n.data.pageNo>=n.data.totalPage}catch{d.value=!0}r.value=!1}};return A(()=>c.gift,n=>{d.value=!1,s.value=[],e.page=1,a.value=!1,e.gift=n,f()}),g({reset:()=>{d.value=!1,s.value=[],e.page=1,a.value=!1,f()},FetchList:f}),()=>i(S,{loading:r.value,finished:a.value,"finished-text":s.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:f,error:d.value},{default:()=>[s.value.length?i("div",{class:b.personalSong},[i(C,{list:s.value,onDetail:n=>{const o=w()+location.pathname+"#/music-detail?id="+n.id;N(o,()=>{v.push({path:"/music-detail",query:{id:n.id}})})}},null)]):!r.value&&i(E,{tips:"\u6682\u65E0\u5185\u5BB9",classImgSize:"SMALL",btnStatus:!1},null)]})}}),U=h({name:"MusicList",props:{type:{type:String,default:""}},emits:["favorite"],setup(c,{expose:g,emit:p}){const l=y(),v=T(),e=_({search:l.query.search||"",musicTagIds:l.query.tagids||"",providerType:c.type==="TENANT"?"TENANT":"PLATFORM",page:1}),u=t([]),s=t(null),r=t(!1),a=t(!1),d=t(!1),f=async()=>{if(!r.value){r.value=!0,d.value=!1;try{const o=await L("/music/sheet/favorite",{prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",params:e});u.value=[...u.value,...o.data.rows],s.value=o.data,e.page=o.data.pageNo+1,a.value=o.data.pageNo>=o.data.totalPage}catch{d.value=!0}r.value=!1}};return g({reset:()=>{d.value=!1,u.value=[],e.page=1,a.value=!1,f()},FetchList:f}),()=>i(S,{loading:r.value,finished:a.value,"finished-text":u.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:f,error:d.value},{default:()=>[u.value.length?i("div",{class:b.personalSong},[i(C,{list:u.value,onDetail:o=>{let q=w()+location.pathname+"#/music-detail?id="+o.id;o.favoriteProviderType&&(q+=`&providerType=${o.favoriteProviderType}`),N(q,()=>{v.push({path:"/music-detail",query:{id:o.id,providerType:o.favoriteProviderType}})})}},null)]):!r.value&&i(E,{tips:"\u6682\u65E0\u5185\u5BB9",classImgSize:"SMALL",btnStatus:!1},null)]})}}),W=h({name:"MusicList",setup(){const c=y(),g=T(),p=_({search:c.query.search||"",musicTagIds:c.query.tagids||"",page:1}),l=t([]),v=t(null),e=t(!1),u=t(!1),s=t(!1),r=async()=>{if(!e.value){e.value=!0,s.value=!1;try{const a=await L("/music/album/favorite",{prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",params:p});l.value=[...l.value,...a.data.rows],v.value=a.data,p.page=a.data.pageNo+1,u.value=a.data.pageNo>=a.data.totalPage}catch{s.value=!0}e.value=!1}};return()=>i(S,{loading:e.value,finished:u.value,"finished-text":l.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:r,error:s.value},{default:()=>[l.value.length?i("div",{class:b.musicGrid},[i(G,{list:v.value.rows,onGoto:a=>{g.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!e.value&&i(E,{tips:"\u6682\u65E0\u5185\u5BB9",classImgSize:"SMALL",btnStatus:!1},null)]})}}),$=h({name:"MusicList",props:{gift:{type:Number,default:0}},setup(c){y();const g=T(),p=_({page:1,gift:c.gift}),l=t([]),v=t(null),e=t(!1),u=t(!1),s=t(!1),r=async()=>{if(!e.value){e.value=!0,s.value=!1;try{const a=await L("/music/album/purchased",{prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",params:p});l.value=[...l.value,...a.data.rows],v.value=a.data,p.page=a.data.pageNo+1,u.value=a.data.pageNo>=a.data.totalPage}catch{s.value=!0}e.value=!1}};return A(()=>c.gift,a=>{s.value=!1,l.value=[],p.page=1,u.value=!1,p.gift=a,r()}),()=>i(S,{loading:e.value,finished:u.value,"finished-text":l.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:r,error:s.value},{default:()=>[l.value.length?i("div",{class:b.musicGrid},[i(G,{isHiddenTag:!0,list:v.value.rows,onGoto:a=>{g.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!e.value&&i(E,{tips:"\u6682\u65E0\u5185\u5BB9",classImgSize:"SMALL",btnStatus:!1},null)]})}});export{$ as A,U as C,Q as P,W as a,b as s};
