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,9 +1,9 @@
---
import Layout from "@/layouts/Layout.astro";
import PostList from "@/components/PostList.astro";
import type {Post} from "@/types/post";
import type {CategoriesStats, Post} from "@/types/post";
import {createHttp} from "@/lib/request";
import {metadata} from "@/consts.ts";
import IndexView from "@/components/IndexView.astro";
const {page} = Astro.params
@@ -25,8 +25,10 @@ const totalPage = Math.ceil(total / metadata.postPageSize)
if (totalPage < page) {
return Astro.redirect('/404')
}
const {data: categories} = await http.get<ApiPageResponse<CategoriesStats>>("category/stats");
---
<Layout>
<PostList posts={list} page={Number(page)} totalPage={totalPage}/>
<IndexView categories={categories} posts={list} page={Number(page)} totalPage={totalPage}/>
</Layout>