From 6c1651b4e9135a1d489342aad7609d36dd1d0374 Mon Sep 17 00:00:00 2001 From: anghunk Date: Thu, 22 Jan 2026 09:29:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BC=98=E5=8C=96=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=B1=95=E7=A4=BA=E5=B9=B6=E9=99=90=E5=88=B6=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs: 更新项目描述为更详细的介绍 refactor(api): 限制访问页面接口返回数量为20条 style(admin): 为表格添加响应式布局和滚动支持 --- cwd-admin/src/views/AnalyticsVisitView.vue | 103 +++++++++++++++------ cwd-admin/src/views/StatsView.vue | 41 +++++--- cwd-api/src/api/admin/visitAnalytics.ts | 4 +- docs/.vitepress/config.mjs | 4 +- 4 files changed, 106 insertions(+), 46 deletions(-) diff --git a/cwd-admin/src/views/AnalyticsVisitView.vue b/cwd-admin/src/views/AnalyticsVisitView.vue index 0cd162e..483d288 100644 --- a/cwd-admin/src/views/AnalyticsVisitView.vue +++ b/cwd-admin/src/views/AnalyticsVisitView.vue @@ -53,28 +53,35 @@
加载中...
{{ error }}
暂无访问数据
-
-
-
页面标题
-
访问量
-
最后访问时间
-
页面地址
-
-
-
- {{ item.postTitle || item.postSlug }} +
+
+
+
页面标题
+
访问量
+
最后访问时间
+
页面地址
-
- {{ item.pv }} -
-
- {{ formatTime(item.lastVisitAt) }} -
-
- - {{ item.postUrl }} - - - +
+
+ {{ item.postTitle || item.postSlug }} +
+
+ {{ item.pv }} +
+
+ {{ formatTime(item.lastVisitAt) }} +
+
@@ -392,9 +399,16 @@ watch( color: #24292f; } +.domain-table-wrapper { + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} + .domain-table { border: 1px solid #d0d7de; border-radius: 6px; + min-width: 520px; overflow: hidden; } @@ -420,11 +434,48 @@ watch( color: #57606a; } -.domain-cell-domain { - flex: 2; +.domain-cell-title { font-weight: 500; } +.domain-cell-pv { + text-align: center; +} + +.domain-cell-time { + flex: 0 0 170px; +} + +.domain-cell-url { + word-break: break-all; +} + +@media (max-width: 768px) { + .domain-table { + width: 610px; + } + + .domain-cell { + flex: none; + } + + .domain-cell-title { + width: 160px; + } + + .domain-cell-pv { + width: 100px; + } + + .domain-cell-time { + width: 150px; + } + + .domain-cell-url { + width: 200px; + } +} + .chart-wrapper { margin-top: 4px; } @@ -457,10 +508,4 @@ watch( background-color: #d1242f; color: #ffffff; } - -@media (max-width: 768px) { - .stats-grid { - grid-template-columns: repeat(1, minmax(0, 1fr)); - } -} diff --git a/cwd-admin/src/views/StatsView.vue b/cwd-admin/src/views/StatsView.vue index eb9e8de..41cbe5a 100644 --- a/cwd-admin/src/views/StatsView.vue +++ b/cwd-admin/src/views/StatsView.vue @@ -65,20 +65,26 @@
加载中...
{{ statsError }}
暂无评论数据
-
-
-
域名
-
总数
-
已通过
-
待审核
-
已拒绝
-
-
-
{{ item.domain }}
-
{{ item.total }}
-
{{ item.approved }}
-
{{ item.pending }}
-
{{ item.rejected }}
+
+
+
+
域名
+
总数
+
已通过
+
待审核
+
已拒绝
+
+
+
{{ item.domain }}
+
{{ item.total }}
+
{{ item.approved }}
+
{{ item.pending }}
+
{{ item.rejected }}
+
@@ -346,9 +352,16 @@ onBeforeUnmount(() => { color: #d1242f; } +.domain-table-wrapper { + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} + .domain-table { border: 1px solid #d0d7de; border-radius: 6px; + min-width: 520px; overflow: hidden; } diff --git a/cwd-api/src/api/admin/visitAnalytics.ts b/cwd-api/src/api/admin/visitAnalytics.ts index 0ad4857..d6a4a0f 100644 --- a/cwd-api/src/api/admin/visitAnalytics.ts +++ b/cwd-api/src/api/admin/visitAnalytics.ts @@ -163,7 +163,7 @@ export const getVisitPages = async (c: Context<{ Bindings: Bindings }>) => { last_visit_at: number | null; }>(); - const items: VisitPageItem[] = []; + let items: VisitPageItem[] = []; for (const row of results) { const domain = @@ -184,6 +184,8 @@ export const getVisitPages = async (c: Context<{ Bindings: Bindings }>) => { }); } + items = items.slice(0, 20); + return c.json({ items }); } catch (e: any) { return c.json( diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index e10a341..b4a0a25 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -4,7 +4,7 @@ import { defineConfig } from 'vitepress'; export default defineConfig({ title: 'CWD 评论系统文档', - description: '基于 Cloudflare Workers 的轻量级评论系统', + description: '基于 Cloudflare Workers 与全球边缘网络的免服务器、极速安全、即插即用评论系统。', lang: 'zh-CN', head: [ [ @@ -19,7 +19,7 @@ export default defineConfig({ nav, sidebar, outline: { - level: [2,3], + level: [2, 3], label: 'On this page', }, editLink: {