var D=Object.defineProperty;var f=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var y=(a,s,e)=>s in a?D(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,I=(a,s)=>{for(var e in s||(s={}))x.call(s,e)&&y(a,e,s[e]);if(f)for(var e of f(s))F.call(s,e)&&y(a,e,s[e]);return a};var k=(a,s)=>{var e={};for(var i in a)x.call(a,i)&&s.indexOf(i)<0&&(e[i]=a[i]);if(a!=null&&f)for(var i of f(a))s.indexOf(i)<0&&F.call(a,i)&&(e[i]=a[i]);return e};import{d as R,h as T,V as l,_ as V,a4 as q,a7 as A,a as t,S as E,I as H,B as K,u as M,j as P,w as U,v as z}from"./vendor.a0144ce9.js";import{r as w}from"./index.3d95a92c.js";import{C as G}from"./index.fc7d34d1.js";/* empty css               *//* empty css               *//* empty css               */import{c as J}from"./index.926ca9c5.js";import{F as O}from"./footer.b1c4a2d9.js";import{F as Q}from"./favorite.9bdf4305.js";import{F as W,I as X}from"./item.e115375c.js";import{g as Y,m as Z}from"./music.21b5a533.js";/* empty css               *//* empty css                */import"./init-user-icon.d5c3c464.js";import"./orderStatus.243cb96a.js";import"./index.339fc024.js";const $="_base_ub4p9_1",ee="_detail_ub4p9_4",ae="_img_ub4p9_10",te="_detailContent_ub4p9_33",se="_main_ub4p9_38",oe="_favoriteContaineer_ub4p9_43",ie="_favorite_ub4p9_43",le="_content_ub4p9_60",ne="_footerBar_ub4p9_78";var n={base:$,detail:ee,img:ae,detailContent:te,main:se,favoriteContaineer:oe,favorite:ie,content:le,footerBar:ne};const B=()=>{};var Ie=R({name:"AlbumDetail",props:{onItemClick:{type:Function,default:B}},setup({onItemClick:a}){localStorage.setItem("behaviorId",Y());const s=T({search:"",page:1}),e=l(null),i=l(null),v=l([]),m=l(!1),_=l(!1),h=l(!1),u=l(0),p=l(0),g=l(null);let C=l(0);const S=V(),N=async()=>{if(!m.value){m.value=!0,h.value=!1;try{const o=(await w.post("/api-student/music/album/detail",{data:I({id:S.params.id},s)})).data,{musicSheetList:r}=o,c=k(o,["musicSheetList"]);v.value=[...v.value,...r.rows],e.value=c,i.value=r,s.page=r.pageNo+1,_.value=r.pageNo>=r.totalPage,u.value=c.favorite,p.value=c.albumFavoriteCount}catch{h.value=!0}m.value=!1}},b=l(!1),L=async o=>{b.value=!0;try{await w.post("/api-student/music/album/favorite/"+o),u.value=u.value===1?0:1,p.value+=u.value?1:-1}catch{}b.value=!1};return q(()=>{A(()=>{setTimeout(()=>{const{height:o}=z(g);console.log(o,"height"),C.value=o},100)})}),()=>t("div",{class:n.detail},[t(E,{class:[n.base,"sticky"],style:{height:C.value+"px !important",width:"100%"}},{default:()=>{var o,d,r,c;return[t("div",{ref:g},[t(G,{class:n.header,background:"transparent",color:"#fff",title:"\u4E13\u8F91\u8BE6\u60C5",backIconColor:"white",border:!1,isFixed:!1},null),t("div",{class:n.detailContent},[t("div",{class:J(n.main,"van-hairline--bottom")},[t(H,{class:n.img,src:(o=e.value)==null?void 0:o.albumCoverUrl},null),t("div",{class:n.content},[t("h4",{class:"van-ellipsis"},[(d=e.value)==null?void 0:d.albumName]),t("p",{class:"van-multi-ellipsis--l2"},[(r=e.value)==null?void 0:r.albumDesc])])]),t("div",{class:n.footerBar},[t(O,{musicSheetCount:(c=e.value)==null?void 0:c.musicSheetCount,albumFavoriteCount:p.value},null),t(K,{class:n.favoriteContaineer,loading:b.value,onClick:()=>{var j;return L((j=e.value)==null?void 0:j.id)}},{default:()=>[t(M,{key:u.value,class:n.favorite,name:u.value?W:Q},null)," ",t("span",null,[u.value?"\u5DF2":"",P("\u6536\u85CF")])]})])])])]}}),t(U,{loading:m.value,finished:_.value,"finished-text":"\u6CA1\u6709\u66F4\u591A\u4E86",onLoad:N},{default:()=>[v.value.length?v.value.map(o=>t(X,{data:o,onClick:()=>{a===B||!a?Z(o):a(o)}},null)):null]})])}});export{Ie as default};
