feat: 去除访问统计信息
This commit is contained in:
BIN
src/assets/icon/client.png
Normal file
BIN
src/assets/icon/client.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -1,23 +1,25 @@
|
||||
---
|
||||
import Folder from "@/assets/icon/folder.png?url";
|
||||
import type {CategoriesStats} from "@/types";
|
||||
import type { CategoriesStats } from "@/types";
|
||||
import { createHttp } from "@/lib/request";
|
||||
const http = createHttp(Astro.request.headers);
|
||||
|
||||
interface Props {
|
||||
categories: CategoriesStats[]
|
||||
}
|
||||
const {categories} = Astro.props
|
||||
const { data: categories } =
|
||||
await http.get<ApiResponse<CategoriesStats[]>>("category/stats");
|
||||
---
|
||||
|
||||
<aside class="sidebar">
|
||||
<div class="widget">
|
||||
<h3 class="widget-title">
|
||||
<img src={Folder} alt="Folder">
|
||||
<img src={Folder} alt="Folder" />
|
||||
文章分类
|
||||
</h3>
|
||||
<ul class="category-list">
|
||||
{
|
||||
categories.map((category) => (
|
||||
<li>
|
||||
<a>{category.name}</a><span class="count">{category.post_count}</span>
|
||||
<a>{category.name}</a>
|
||||
<span class="count">{category.post_count}</span>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
@@ -29,6 +31,9 @@ const {categories} = Astro.props
|
||||
.sidebar {
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.widget {
|
||||
@@ -80,9 +85,14 @@ const {categories} = Astro.props
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.sidebar{
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.sidebar {
|
||||
gap: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
---
|
||||
import type {Post, CategoriesStats} from "@/types/post";
|
||||
import type { Post } from "@/types/post";
|
||||
import IndexSidebar from "@/components/IndexSidebar.astro";
|
||||
import PostList from '@/components/PostList.astro'
|
||||
import PostList from "@/components/PostList.astro";
|
||||
|
||||
interface Props {
|
||||
posts: Post[]
|
||||
page: number
|
||||
totalPage: number
|
||||
categories: CategoriesStats[]
|
||||
posts: Post[];
|
||||
page: number;
|
||||
totalPage: number;
|
||||
}
|
||||
|
||||
const {posts, page, totalPage, categories} = Astro.props
|
||||
const { posts, page, totalPage } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="page-content">
|
||||
<div class="container">
|
||||
<PostList posts={posts} page={page} totalPage={totalPage}/>
|
||||
<IndexSidebar categories={categories}/>
|
||||
<PostList posts={posts} page={page} totalPage={totalPage} />
|
||||
<IndexSidebar />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.container {
|
||||
width: 100%;
|
||||
@@ -27,4 +26,9 @@ const {posts, page, totalPage, categories} = Astro.props
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.container {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,7 +8,12 @@ import BackTop from "@/components/BackTop.astro";
|
||||
import { metadata } from "@/consts.ts";
|
||||
const { siteTitle } = metadata;
|
||||
|
||||
const {title,description} = Astro.props;
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
const { title, description } = Astro.props;
|
||||
const pageTitle = title ? `${title} - ${siteTitle}` : siteTitle;
|
||||
---
|
||||
|
||||
@@ -23,8 +28,8 @@ const pageTitle = title ? `${title} - ${siteTitle}` : siteTitle;
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{pageTitle}</title>
|
||||
<meta name="description" content={description}>
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<meta name="description" content={description} />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
</head>
|
||||
<body>
|
||||
<BaseHeader />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import IndexView from "@/components/IndexView.astro";
|
||||
import type { Post, CategoriesStats } from "@/types/post";
|
||||
import type { Post } from "@/types/post";
|
||||
import { createHttp } from "@/lib/request";
|
||||
import { metadata } from "@/consts.ts";
|
||||
|
||||
@@ -14,14 +14,10 @@ const { list, total } = await http.get<ApiPageResponse<Post>>("post", {
|
||||
},
|
||||
});
|
||||
const totalPage = Math.ceil(total / metadata.postPageSize);
|
||||
|
||||
const { data: categories } =
|
||||
await http.get<ApiResponse<CategoriesStats[]>>("category/stats");
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<IndexView
|
||||
categories={categories}
|
||||
posts={list}
|
||||
page={1}
|
||||
totalPage={totalPage}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import type { CategoriesStats, Post } from "@/types/post";
|
||||
import type { Post } from "@/types/post";
|
||||
import { createHttp } from "@/lib/request";
|
||||
import { metadata } from "@/consts.ts";
|
||||
import IndexView from "@/components/IndexView.astro";
|
||||
@@ -25,14 +25,10 @@ const totalPage = Math.ceil(total / metadata.postPageSize);
|
||||
if (totalPage < Number(page)) {
|
||||
return Astro.redirect("/404");
|
||||
}
|
||||
|
||||
const { data: categories } =
|
||||
await http.get<ApiResponse<CategoriesStats[]>>("category/stats");
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<IndexView
|
||||
categories={categories}
|
||||
posts={list}
|
||||
page={Number(page)}
|
||||
totalPage={totalPage}
|
||||
|
||||
0
src/types/client.ts
Normal file
0
src/types/client.ts
Normal file
Reference in New Issue
Block a user