优化主页内容库和搜索区域显示
- 内容库区域显示文章数、分类数、今日新增统计 - 搜索区域显示失败抓取数和支持的搜索引擎 - 点击'进入'按钮跳转到单独页面 - 移除大块入口链接,界面更简洁
This commit is contained in:
+34
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user