feat: 首页改版

This commit is contained in:
2026-07-20 22:14:20 +08:00
parent 95320835b6
commit a5f4d0a28d
16 changed files with 359 additions and 130 deletions

View File

@@ -1,7 +1,7 @@
---
import Layout from "@/layouts/Layout.astro";
import PostList from "@/components/PostList.astro";
import type {Post} from "@/types/post";
import IndexView from "@/components/IndexView.astro";
import type {Post, CategoriesStats} from "@/types/post";
import {createHttp} from "@/lib/request";
import {metadata} from "@/consts.ts";
@@ -13,10 +13,11 @@ const {list, total} = await http.get<ApiPageResponse<Post>>("post", {
page_size: metadata.postPageSize
}
});
const totalPage = Math.ceil(total / metadata.postPageSize)
const {data: categories} = await http.get<ApiPageResponse<CategoriesStats>>("category/stats");
---
<Layout>
<PostList posts={list} page={1} totalPage={totalPage}/>
<IndexView categories={categories} posts={list} page={1} totalPage={totalPage}/>
</Layout>