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 +
+
+
+ 支持一键保存所有结果到内容库 +
+