import{d as a,r as e,o as l,c as s,w as t,g as u,i as n,b as c,e as o,f as d,h as r,j as f,F as i,k as _,S as v,n as b,t as k,l as m,J as p,p as y}from"./index-Co9nPWLO.js";import{_ as g}from"./_plugin-vue_export-helper.BCo6x5W8.js";const h=g(a({__name:"index",setup(a){const g=e([]),h=e(1),x=e(0),C=e(!1),j=e(!0),w={default:["#4f46e5","#818cf8"],red:["#ef4444","#f87171"],orange:["#f97316","#fb923c"],green:["#22c55e","#4ade80"],blue:["#3b82f6","#60a5fa"],purple:["#a855f7","#c084fc"]};function $(a){const e=Object.keys(w),l=e[a.id%e.length]||"default",s=w[l];return`linear-gradient(135deg, ${s[0]} 0%, ${s[1]} 100%)`}function S(){p()}async function F(a=!1){if(!C.value){a||(h.value=1),C.value=!0;try{const a=(await u("/book-generator/books")).books||[];g.value=a.map(a=>({id:a.id,name:a.title,description:a.description,subscriberCount:a.completedChapters||0})),x.value=a.length,j.value=!1}catch(e){console.error("获取专辑列表失败:",e)}finally{C.value=!1}}}function I(){j.value&&!C.value&&(h.value++,F(!0))}return l(async()=>{await F()}),(a,e)=>{const l=d,u=n,p=v;return c(),s(u,{class:"page"},{default:t(()=>[o(u,{class:"nav-bar"},{default:t(()=>[o(u,{class:"nav-btn",onClick:S},{default:t(()=>[o(l,{class:"nav-icon"},{default:t(()=>[r("←")]),_:1})]),_:1}),o(l,{class:"nav-title"},{default:t(()=>[r("专辑")]),_:1}),o(u,{class:"nav-btn"})]),_:1}),C.value&&0===g.value.length?(c(),s(u,{key:0,class:"skeleton-grid"},{default:t(()=>[(c(),f(i,null,_(6,a=>o(u,{key:a,class:"skeleton-card"},{default:t(()=>[o(u,{class:"skeleton-cover"}),o(u,{class:"skeleton-info"},{default:t(()=>[o(u,{class:"skeleton-title"}),o(u,{class:"skeleton-meta"})]),_:1})]),_:2},1024)),64))]),_:1})):(c(),s(p,{key:1,"scroll-y":"",class:"album-list",onScrolltolower:I},{default:t(()=>[0!==g.value.length||C.value?(c(),s(u,{key:1,class:"album-grid"},{default:t(()=>[(c(!0),f(i,null,_(g.value,a=>(c(),s(u,{key:a.id,class:"album-card",onClick:e=>{return l=a.id,void y({url:`/pages/album/index?id=${l}`});var l}},{default:t(()=>[o(u,{class:"album-cover",style:b({background:$(a)})},{default:t(()=>[o(l,{class:"cover-icon"},{default:t(()=>[r("🎵")]),_:1}),o(u,{class:"album-count"},{default:t(()=>[r(k(a.subscriberCount||0)+"人订阅",1)]),_:2},1024)]),_:2},1032,["style"]),o(u,{class:"album-info"},{default:t(()=>[o(l,{class:"album-title"},{default:t(()=>[r(k(a.name),1)]),_:2},1024),o(l,{class:"album-desc"},{default:t(()=>[r(k(a.description||"暂无描述"),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})):(c(),s(u,{key:0,class:"empty"},{default:t(()=>[o(l,{class:"empty-icon"},{default:t(()=>[r("📚")]),_:1}),o(l,{class:"empty-text"},{default:t(()=>[r("暂无专辑")]),_:1}),o(l,{class:"empty-hint"},{default:t(()=>[r("创建你的第一个专辑吧")]),_:1})]),_:1})),C.value?(c(),s(u,{key:2,class:"loading"},{default:t(()=>[o(l,null,{default:t(()=>[r("加载中...")]),_:1})]),_:1})):m("",!0),!j.value&&g.value.length>0?(c(),s(u,{key:3,class:"no-more"},{default:t(()=>[o(l,null,{default:t(()=>[r("没有更多了")]),_:1})]),_:1})):m("",!0)]),_:1}))]),_:1})}}}),[["__scopeId","data-v-3910c89d"]]);export{h as default};
