import{d as a,r as l,o as e,a as s,c as t,w as c,g as u,i as n,b as o,e as d,f,h as r,S as i,j as _,F as b,k,n as m,t as p,l as v,m as g,p as y,s as h}from"./index-Co9nPWLO.js";import{_ as x}from"./_plugin-vue_export-helper.BCo6x5W8.js";const C=x(a({__name:"index",setup(a){const x=l([]),C=l(1);l(0);const w=l(!1),j=l(!0),S=[["#4f46e5","#818cf8"],["#ef4444","#f87171"],["#f97316","#fb923c"],["#22c55e","#4ade80"],["#3b82f6","#60a5fa"],["#a855f7","#c084fc"],["#ec4899","#f472b6"],["#14b8a6","#2dd4bf"]];function $(a){const l=S[a.id%S.length]||S[0];return`linear-gradient(135deg, ${l[0]} 0%, ${l[1]} 100%)`}async function F(a=!1){if(!w.value){a||(C.value=1),w.value=!0;try{const l=await u("/book-generator/books");a?x.value.push(...l.books):x.value=l.books||[],j.value=!1}catch(l){console.error("获取书籍列表失败:",l)}finally{w.value=!1}}}function I(){j.value&&!w.value&&(C.value++,F(!0))}function q(){h({url:"/pages/create/index"})}function z(){y({url:"/pages/search/index"})}function A(){h({url:"/pages/create/index"})}return e(async()=>{await F()}),s(()=>{F()}),(a,l)=>{const e=f,s=n,u=i,h=g;return o(),t(s,{class:"page"},{default:c(()=>[d(s,{class:"search-bar",onClick:z},{default:c(()=>[d(e,{class:"search-icon"},{default:c(()=>[r("🔍")]),_:1}),d(e,{class:"search-placeholder"},{default:c(()=>[r("搜索专辑...")]),_:1})]),_:1}),w.value&&0===x.value.length?(o(),t(u,{key:0,"scroll-y":"",class:"album-list",onScrolltolower:I},{default:c(()=>[d(s,{class:"skeleton-grid"},{default:c(()=>[(o(),_(b,null,k(6,a=>d(s,{key:a,class:"skeleton-card"},{default:c(()=>[d(s,{class:"skeleton-cover"}),d(s,{class:"skeleton-info"},{default:c(()=>[d(s,{class:"skeleton-title"}),d(s,{class:"skeleton-meta"})]),_:1})]),_:2},1024)),64))]),_:1})]),_:1})):(o(),t(u,{key:1,"scroll-y":"",class:"album-list",onScrolltolower:I},{default:c(()=>[0!==x.value.length||w.value?(o(),t(s,{key:1,class:"album-grid"},{default:c(()=>[(o(!0),_(b,null,k(x.value,a=>(o(),t(s,{key:a.id,class:"album-card",onClick:l=>function(a){y({url:`/pages/album/index?id=${a.id}`})}(a)},{default:c(()=>[d(s,{class:"album-cover",style:m({background:$(a)})},{default:c(()=>[d(e,{class:"cover-icon"},{default:c(()=>[r("📖")]),_:1}),d(s,{class:"album-count"},{default:c(()=>[r(p(a.completedChapters||0)+"/"+p(a.totalChapters||0)+"章",1)]),_:2},1024)]),_:2},1032,["style"]),d(s,{class:"album-info"},{default:c(()=>[d(e,{class:"album-title"},{default:c(()=>[r(p(a.title),1)]),_:2},1024),d(e,{class:"album-desc"},{default:c(()=>[r(p(a.description||"暂无描述"),1)]),_:2},1024),d(e,{class:"album-meta"},{default:c(()=>[r("进度 "+p(a.progress||0)+"%",1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})):(o(),t(s,{key:0,class:"empty"},{default:c(()=>[d(e,{class:"empty-icon"},{default:c(()=>[r("📚")]),_:1}),d(e,{class:"empty-text"},{default:c(()=>[r("暂无书籍")]),_:1}),d(e,{class:"empty-hint"},{default:c(()=>[r("点击下方按钮创建第一本书籍")]),_:1})]),_:1})),w.value?(o(),t(s,{key:2,class:"loading"},{default:c(()=>[d(e,null,{default:c(()=>[r("加载中...")]),_:1})]),_:1})):v("",!0),!j.value&&x.value.length>0?(o(),t(s,{key:3,class:"no-more"},{default:c(()=>[d(e,null,{default:c(()=>[r("没有更多了")]),_:1})]),_:1})):v("",!0)]),_:1})),d(s,{class:"bottom-bar"},{default:c(()=>[d(h,{class:"action-btn",onClick:q},{default:c(()=>[d(e,{class:"btn-icon"},{default:c(()=>[r("📚")]),_:1}),d(e,{class:"btn-text"},{default:c(()=>[r("管理书籍")]),_:1})]),_:1}),d(h,{class:"generate-btn",onClick:A},{default:c(()=>[d(e,{class:"btn-icon"},{default:c(()=>[r("+")]),_:1}),d(e,{class:"btn-text"},{default:c(()=>[r("新建生成")]),_:1})]),_:1})]),_:1})]),_:1})}}}),[["__scopeId","data-v-b30501ff"]]);export{C as default};
