import{d as b,Q as y,U as s,y as T,g as h,j as t,F as A,bg as w,P as I,S as C,a3 as N,C as L,V as M}from"./ResizeObserver.es.f28023e0.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as R,a as q}from"./index.aa87c0e3.js";import{c as F}from"./index.9a41251d.js";import{C as _}from"./index.3b2e70c8.js";import{S as E}from"./index.dc99e92f.js";import{L as S}from"./index.79f59946.js";import{M as x}from"./index.95a422d1.js";import{b as P}from"./bg-image-1.a320f35c.js";import{g as H}from"./music.480e4a23.js";import{u as k}from"./hooks.19957bf3.js";import{T as z}from"./index.787d69a0.js";import{C as D}from"./index.bd375ca9.js";import{C as V}from"./index.2a22730e.js";import{I as U}from"./index.7a1af785.js";import"./use-id.cc14bbe9.js";import"./use-tab-status.653933d8.js";import"./use-refs.b4f9d723.js";import"./icon-xin2.4ab2a52d.js";import"./index.f0f901ab.js";const W="_personal_197ar_1",j="_bgImg_197ar_44",K="_pTitle_197ar_51",O="_practice_197ar_56",Q="_personalSong_197ar_57",$="_musicGrid_197ar_69",B="_tennatCellGroup_197ar_72",J="_tenantLogo_197ar_84",X="_tenantCoverImg_197ar_90",Y="_tenantContent_197ar_97";var d={personal:W,bgImg:j,pTitle:K,practice:O,personalSong:Q,musicGrid:$,tennatCellGroup:B,tenantLogo:J,tenantCoverImg:X,tenantContent:Y},Z=b({name:"Practice",emits:["favorite"],setup(p,{expose:r,emit:c}){const u=y(),i=s(0),{isLoading:e,state:l,execute:n}=F(o=>T.get("/music/sheet/practice",{prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",params:{rows:(o==null?void 0:o.rows)||3}}),null);return r({reload:n}),()=>{var a;const o=((a=l.value)==null?void 0:a.data.rows)||[];return i.value===0&&(i.value=o.length),t(A,null,[i.value>0&&t(A,null,[t(_,{titleClass:d.pTitle,title:"\u6700\u8FD1\u7EC3\u4E60",border:!1},null),t("div",{class:d.practice},[t(E,{showTitleImg:!0,list:o,onDetail:v=>{const g=location.origin+location.pathname+"#/music-detail?id="+v.id;w(g,()=>{u.push({path:"/music-detail",query:{id:v.id}})})}},null)])])])}}}),aa=b({name:"MusicList",emits:["favorite"],props:{gift:{type:Number,default:0}},setup(p,{expose:r,emit:c}){const u=I(),i=y(),e=C({search:u.query.search||"",musicTagIds:u.query.tagids||"",gift:p.gift,page:1}),l=s(null),n=s([]),o=s(!1),a=s(!1),v=s(!1),g=async()=>{if(!o.value){o.value=!0,v.value=!1;try{const m=await T("/music/sheet/my",{method:h.platformType==="TEACHER"?"POST":"GET",prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",params:e,data:h.platformType==="TEACHER"?e:{}});n.value=[...n.value,...m.data.rows],l.value=m.data,e.page=m.data.pageNo+1,a.value=m.data.pageNo>=m.data.totalPage}catch{v.value=!0}o.value=!1}};return N(()=>p.gift,m=>{v.value=!1,n.value=[],e.page=1,a.value=!1,e.gift=m,g()}),r({reset:()=>{v.value=!1,n.value=[],e.page=1,a.value=!1,g()},FetchList:g}),()=>t(S,{loading:o.value,finished:a.value,"finished-text":n.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:g,error:v.value},{default:()=>[n.value.length?t("div",{class:d.personalSong},[t(E,{showTitleImg:!0,list:n.value,onDetail:m=>{const f=location.origin+location.pathname+"#/music-detail?id="+m.id;w(f,()=>{i.push({path:"/music-detail",query:{id:m.id}})})}},null)]):!o.value&&t(L,{tips:"\u6682\u65E0\u5355\u66F2",classImgSize:"SMALL",btnStatus:!1},null)]})}}),ea=b({name:"MusicList",emits:["favorite"],setup(p,{expose:r,emit:c}){const u=I(),i=y(),e=C({search:u.query.search||"",musicTagIds:u.query.tagids||"",page:1}),l=s([]),n=s(null),o=s(!1),a=s(!1),v=s(!1),g=async()=>{if(!o.value){o.value=!0,v.value=!1;try{const f=await T("/music/sheet/favorite",{prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",params:e});l.value=[...l.value,...f.data.rows],n.value=f.data,e.page=f.data.pageNo+1,a.value=f.data.pageNo>=f.data.totalPage}catch{v.value=!0}o.value=!1}};return r({reset:()=>{v.value=!1,l.value=[],e.page=1,a.value=!1,g()},FetchList:g}),()=>t(S,{loading:o.value,finished:a.value,"finished-text":l.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:g,error:v.value},{default:()=>[l.value.length?t("div",{class:d.personalSong},[t(E,{showTitleImg:!0,list:l.value,onDetail:f=>{const G=location.origin+location.pathname+"#/music-detail?id="+f.id;w(G,()=>{i.push({path:"/music-detail",query:{id:f.id}})})}},null)]):!o.value&&t(L,{tips:"\u6682\u65E0\u6536\u85CF\u5355\u66F2",classImgSize:"SMALL",btnStatus:!1},null)]})}}),ta=b({name:"MusicList",setup(){const p=I(),r=y(),c=C({search:p.query.search||"",musicTagIds:p.query.tagids||"",page:1}),u=s([]),i=s(null),e=s(!1),l=s(!1),n=s(!1),o=async()=>{if(!e.value){e.value=!0,n.value=!1;try{const a=await T("/music/album/favorite",{prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",params:c});u.value=[...u.value,...a.data.rows],i.value=a.data,c.page=a.data.pageNo+1,l.value=a.data.pageNo>=a.data.totalPage}catch{n.value=!0}e.value=!1}};return()=>t(S,{loading:e.value,finished:l.value,"finished-text":u.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:o,error:n.value},{default:()=>[u.value.length?t("div",{class:d.musicGrid},[t(x,{list:i.value.rows,onGoto:a=>{r.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!e.value&&t(L,{tips:"\u6682\u65E0\u6536\u85CF\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]})}}),la=b({name:"MusicList",props:{gift:{type:Number,default:0}},setup(p){I();const r=y(),c=C({page:1,gift:p.gift}),u=s([]),i=s(null),e=s(!1),l=s(!1),n=s(!1),o=async()=>{if(!e.value){e.value=!0,n.value=!1;try{const a=await T("/music/album/purchased",{prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",params:c});u.value=[...u.value,...a.data.rows],i.value=a.data,c.page=a.data.pageNo+1,l.value=a.data.pageNo>=a.data.totalPage}catch{n.value=!0}e.value=!1}};return N(()=>p.gift,a=>{n.value=!1,u.value=[],c.page=1,l.value=!1,c.gift=a,o()}),()=>t(S,{loading:e.value,finished:l.value,"finished-text":u.value.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:o,error:n.value},{default:()=>[u.value.length?t("div",{class:d.musicGrid},[t(x,{isHiddenTag:!0,list:i.value.rows,onGoto:a=>{r.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!e.value&&t(L,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]})}}),sa=b({name:"tenant-album",setup(){const p=y(),r=C({page:1,rows:20}),c=s([]),u=s(null),i=s(!1),e=s(!1),l=s(!1),n=async()=>{if(!i.value){i.value=!0,l.value=!1;try{const a=await T.post("/userTenantAlbumRecord/page",{prefix:h.platformType==="TEACHER"?"/api-teacher":"/api-student",data:r});c.value=[...c.value,...a.data.rows],u.value=a.data,console.log(u.value),r.page=a.data.pageNo+1,e.value=a.data.pageNo>=a.data.totalPage}catch{l.value=!0}i.value=!1}},o=a=>{p.push({path:"/train-tool",query:{albumId:a.id,buy:"1"}})};return()=>t(S,{loading:i.value,finished:e.value,"finished-text":c.value.length?" ":"",onLoad:n,error:l.value},{default:()=>[c.value.length?c.value.map(a=>t(V,{class:d.tennatCellGroup,border:!1,onClick:()=>o(a)},{default:()=>[t(_,{isLink:!0,clickable:!1},{icon:()=>t("img",{src:a.tenantImg,class:d.tenantLogo},null),title:()=>t("div",{class:d.tenantName},[a.tenantName])}),t(_,null,{icon:()=>t(U,{src:a.coverImg,class:d.tenantCoverImg},null),title:()=>t("div",{class:d.tenantContent},[t("h2",null,[a.name]),t("p",null,[a.describe])])})]})):!i.value&&t(L,{tips:"\u6682\u65E0\u8BAD\u7EC3\u6559\u7A0B",classImgSize:"SMALL",btnStatus:!1},null)]})}}),wa=b({name:"MusicPersonal",setup(){localStorage.setItem("behaviorId",H());const p=sessionStorage.getItem("music-personal-tab-value");sessionStorage.removeItem("music-personal-tab-value");const r=s(p||"train-course");sessionStorage.setItem("music-personal-tab-value",r.value);const c=s(),u=s(),i=s();return M(()=>{k("\u6211\u7684\u4E50\u8C31")}),()=>t("div",{class:d.personal},[t(z,{position:"top"},{default:()=>[t(D,{background:"transparent",isFixed:!1,border:!1,color:"#131415"},null)]}),t("img",{class:d.bgImg,src:P},null),t(Z,{ref:i,onFavorite:()=>{var e,l,n,o;r.value==="personal"?(l=(e=c.value)==null?void 0:e.reset)==null||l.call(e):r.value==="collection"&&((o=(n=u.value)==null?void 0:n.reset)==null||o.call(n))}},null),t(R,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:r.value,"onUpdate:active":e=>r.value=e,onChange:e=>{r.value=e,sessionStorage.setItem("music-personal-tab-value",e)}},{default:()=>[t(q,{title:"\u8BAD\u7EC3\u6559\u7A0B",name:"train-course"},null)]}),r.value==="train-course"&&t(sa,null,null),(r.value==="personal"||r.value==="personal-gift")&&t(aa,{ref:c,gift:r.value==="personal-gift"?1:0,onFavorite:()=>{var e,l;(l=(e=i.value)==null?void 0:e.reload)==null||l.call(e)}},null),(r.value==="personal-album"||r.value==="album-gift")&&t(la,{gift:r.value==="album-gift"?1:0},null),r.value==="collection"&&t(ea,{ref:u,onFavorite:()=>{var e,l;(l=(e=i.value)==null?void 0:e.reload)==null||l.call(e)}},null),r.value==="album"&&t(ta,null,null)])}});export{wa as default};