From 50379f5ecffb39a9f5f9537f29d3f7254b36382f Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Mon, 13 Jul 2026 22:45:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A1=B5=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=BA=93=E5=92=8C=E6=90=9C=E7=B4=A2=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 内容库区域显示文章数、分类数、今日新增统计 - 搜索区域显示失败抓取数和支持的搜索引擎 - 点击'进入'按钮跳转到单独页面 - 移除大块入口链接,界面更简洁 --- static/css/style.css | 33 +++++++++++++++++++++++ static/js/app.js | 36 +++++++++++++++++++++++-- templates/index.html | 62 ++++++++++++++++++++++++++++++-------------- 3 files changed, 109 insertions(+), 22 deletions(-) diff --git a/static/css/style.css b/static/css/style.css index a504740..3397ac3 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -801,4 +801,37 @@ body { .library-entrance-link small { font-size: 13px; opacity: 0.8; +} + +/* 快速统计卡片 */ +.quick-stats { + display: flex; + gap: 20px; + justify-content: center; +} + +.quick-stat-item { + text-align: center; +} + +.quick-stat-value { + font-size: 24px; + font-weight: bold; + color: #667eea; + display: block; +} + +.quick-stat-label { + font-size: 13px; + color: #666; +} + +.search-quick-info { + text-align: center; + margin-top: 10px; + color: #999; +} + +.search-quick-info small { + font-size: 12px; } \ No newline at end of file diff --git a/static/js/app.js b/static/js/app.js index 931e358..570088a 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -24,8 +24,8 @@ async function refreshData() { await Promise.all([ loadStats(), loadPendingProducts(), - loadArticles(), - loadHistory() + loadHistory(), + loadQuickStats() ]); updateSystemStatus(true); } catch (error) { @@ -66,6 +66,38 @@ async function loadStats() { } } +// 加载快速统计信息 +async function loadQuickStats() { + try { + // 加载文章统计 + const articlesResponse = await fetch(`${API_BASE}/api/articles?limit=1000`); + const articlesData = await articlesResponse.json(); + + if (articlesData.success) { + document.getElementById('quick-articles-count').textContent = articlesData.count; + + // 计算分类数 + const categories = new Set(articlesData.articles.map(a => a.category).filter(c => c)); + document.getElementById('quick-categories-count').textContent = categories.size; + + // 计算今日新增 + const today = new Date().toISOString().split('T')[0]; + const todayCount = articlesData.articles.filter(a => a.fetch_date && a.fetch_date.startsWith(today)).length; + document.getElementById('quick-today-count').textContent = todayCount; + } + + // 加载失败URL数 + const failedResponse = await fetch(`${API_BASE}/api/articles/failed-urls`); + const failedData = await failedResponse.json(); + + if (failedData.success) { + document.getElementById('quick-failed-count').textContent = failedData.count; + } + } catch (error) { + console.error('加载快速统计失败:', error); + } +} + // 加载待处理产品 async function loadPendingProducts() { try { diff --git a/templates/index.html b/templates/index.html index 6b6b3e9..5633caf 100644 --- a/templates/index.html +++ b/templates/index.html @@ -97,32 +97,54 @@ - +
-

内容库文章

-
- +
+
+
+ 0 + 篇文章 +
+
+ 0 + 个分类 +
+
+ 0 + 今日新增 +
+
+
- - -
-
-

互联网搜索

-
-
- - - 点击进入互联网搜索页面 - 支持一键保存所有搜索结果到内容库 - +
+
+

互联网搜索

+ + 进入 + +
+
+
+
+ 0 + 抓取失败 +
+
+ 支持引擎 + Bing/百度/Google +
+
+
+ 支持一键保存所有结果到内容库 +
+