import{d as h,P as y,Q as _,S as T,U as t,a3 as w,j as i,y as L,g as m,bd as C,C as S}from"./ResizeObserver.es.b7226882.js";import{L as E}from"./index.9fec2202.js";import{S as A}from"./index.f4934f0d.js";import{M as G}from"./index.320010a3.js";const M="_personal_tq7si_1",N="_songEfficacy_tq7si_20",P="_songContainer_tq7si_24",x="_title_tq7si_29",R="_btnGroup_tq7si_41",H="_practice_tq7si_50",I="_personalSong_tq7si_51",z="_musicGrid_tq7si_60";var b={personal:M,songEfficacy:N,songContainer:P,title:x,btnGroup:R,practice:H,personalSong:I,musicGrid:z},O=h({name:"MusicList",emits:["favorite"],props:{gift:{type:Number,default:0}},setup(d,{expose:g,emit:p}){const l=y(),v=_(),e=T({search:l.query.search||"",musicTagIds:l.query.tagids||"",gift:d.gift,page:1}),o=t(null),s=t([]),r=t(!1),a=t(!1),c=t(!1),f=async()=>{if(!r.value){r.value=!0,c.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],o.value=n.data,e.page=n.data.pageNo+1,a.value=n.data.pageNo>=n.data.totalPage}catch{c.value=!0}r.value=!1}};return w(()=>d.gift,n=>{c.value=!1,s.value=[],e.page=1,a.value=!1,e.gift=n,f()}),g({reset:()=>{c.value=!1,s.value=[],e.page=1,a.value=!1,f()},FetchList:f}),()=>i(E,{loading:r.value,finished:a.value,"finished-text":s.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:f,error:c.value},{default:()=>[s.value.length?i("div",{class:b.personalSong},[i(A,{list:s.value,onDetail:n=>{const u=location.origin+location.pathname+"#/music-detail?id="+n.id;C(u,()=>{v.push({path:"/music-detail",query:{id:n.id}})})}},null)]):!r.value&&i(S,{tips:"\u6682\u65E0\u5355\u66F2",classImgSize:"SMALL",btnStatus:!1},null)]})}}),Q=h({name:"MusicList",emits:["favorite"],setup(d,{expose:g,emit:p}){const l=y(),v=_(),e=T({search:l.query.search||"",musicTagIds:l.query.tagids||"",page:1}),o=t([]),s=t(null),r=t(!1),a=t(!1),c=t(!1),f=async()=>{if(!r.value){r.value=!0,c.value=!1;try{const u=await L("/music/sheet/favorite",{prefix:m.platformType==="TEACHER"?"/api-teacher":"/api-student",params:e});o.value=[...o.value,...u.data.rows],s.value=u.data,e.page=u.data.pageNo+1,a.value=u.data.pageNo>=u.data.totalPage}catch{c.value=!0}r.value=!1}};return g({reset:()=>{c.value=!1,o.value=[],e.page=1,a.value=!1,f()},FetchList:f}),()=>i(E,{loading:r.value,finished:a.value,"finished-text":o.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:f,error:c.value},{default:()=>[o.value.length?i("div",{class:b.personalSong},[i(A,{list:o.value,onDetail:u=>{let q=location.origin+location.pathname+"#/music-detail?id="+u.id;u.favoriteProviderType&&(q+=`&providerType=${u.favoriteProviderType}`),C(q,()=>{v.push({path:"/music-detail",query:{id:u.id,providerType:u.favoriteProviderType}})})}},null)]):!r.value&&i(S,{tips:"\u6682\u65E0\u6536\u85CF\u5355\u66F2",classImgSize:"SMALL",btnStatus:!1},null)]})}}),U=h({name:"MusicList",setup(){const d=y(),g=_(),p=T({search:d.query.search||"",musicTagIds:d.query.tagids||"",page:1}),l=t([]),v=t(null),e=t(!1),o=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,o.value=a.data.pageNo>=a.data.totalPage}catch{s.value=!0}e.value=!1}};return()=>i(E,{loading:e.value,finished:o.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(S,{tips:"\u6682\u65E0\u6536\u85CF\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]})}}),W=h({name:"MusicList",props:{gift:{type:Number,default:0}},setup(d){y();const g=_(),p=T({page:1,gift:d.gift}),l=t([]),v=t(null),e=t(!1),o=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,o.value=a.data.pageNo>=a.data.totalPage}catch{s.value=!0}e.value=!1}};return w(()=>d.gift,a=>{s.value=!1,l.value=[],p.page=1,o.value=!1,p.gift=a,r()}),()=>i(E,{loading:e.value,finished:o.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(S,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]})}});export{W as A,Q as C,O as P,U as a,b as s};