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