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