Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a2d6ada88 | ||
|
|
00609980a8 |
@@ -102,6 +102,15 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.page-size-select {
|
||||
padding: 10px 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
@@ -241,6 +250,19 @@
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.article-page-title {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
padding: 4px 8px;
|
||||
background: #e8f5e9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.article-page-title i {
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.article-summary {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
|
||||
+25
-9
@@ -4,7 +4,7 @@ const API_BASE = '';
|
||||
// 状态
|
||||
let articles = [];
|
||||
let currentPage = 1;
|
||||
let pageSize = 20;
|
||||
let pageSize = 100;
|
||||
let totalCount = 0;
|
||||
let selectedIds = new Set();
|
||||
let currentArticleId = null;
|
||||
@@ -31,6 +31,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// 改变每页数量
|
||||
function changePageSize() {
|
||||
pageSize = parseInt(document.getElementById('page-size').value);
|
||||
currentPage = 1;
|
||||
loadArticles();
|
||||
}
|
||||
|
||||
// 加载文章列表
|
||||
async function loadArticles() {
|
||||
const keyword = document.getElementById('search-input').value.trim();
|
||||
@@ -98,6 +105,9 @@ function displayArticles() {
|
||||
const productNames = safeParseJSON(article.product_names, []);
|
||||
const keywords = safeParseJSON(article.keywords, []);
|
||||
|
||||
// 确定显示标题:优先 search_title,其次 product_names,最后来源
|
||||
const displayTitle = article.search_title || productNames.join(', ') || article.source || '未命名';
|
||||
|
||||
return `
|
||||
<div class="article-card ${selectedIds.has(article.id) ? 'selected' : ''}" id="article-${article.id}">
|
||||
<div class="article-card-header">
|
||||
@@ -107,7 +117,7 @@ function displayArticles() {
|
||||
onchange="toggleSelect(${article.id})">
|
||||
</label>
|
||||
<div class="article-title" onclick="showDetail(${article.id})">
|
||||
${escapeHtml(productNames.join(', ') || '未命名')}
|
||||
${escapeHtml(displayTitle)}
|
||||
</div>
|
||||
<div class="article-actions">
|
||||
<button onclick="editArticle(${article.id})" class="btn btn-sm btn-secondary">
|
||||
@@ -118,9 +128,9 @@ function displayArticles() {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
${article.search_title && article.search_title !== productNames.join(', ') ? `
|
||||
<div class="article-search-title">
|
||||
<i class="ri-search-line"></i> 搜索标题: ${escapeHtml(article.search_title)}
|
||||
${article.search_title && productNames.length > 0 && article.search_title !== productNames.join(', ') ? `
|
||||
<div class="article-page-title">
|
||||
<i class="ri-article-line"></i> 网页标题: ${escapeHtml(productNames.join(', '))}
|
||||
</div>
|
||||
` : ''}
|
||||
<div class="article-meta">
|
||||
@@ -230,16 +240,22 @@ async function showDetail(id) {
|
||||
|
||||
const body = document.getElementById('detail-body');
|
||||
body.innerHTML = `
|
||||
${article.search_title ? `
|
||||
<div class="detail-section">
|
||||
<h4><i class="ri-search-line"></i> 搜索标题</h4>
|
||||
<p style="color: #667eea; font-weight: 500;">${escapeHtml(article.search_title)}</p>
|
||||
</div>
|
||||
` : ''}
|
||||
<div class="detail-section">
|
||||
<h4><i class="ri-price-tag-3-line"></i> 产品名称</h4>
|
||||
<p>${escapeHtml(productNames.join(', '))}</p>
|
||||
<h4><i class="ri-article-line"></i> 网页标题(产品名称)</h4>
|
||||
<p>${escapeHtml(productNames.join(', ') || '无')}</p>
|
||||
</div>
|
||||
<div class="detail-meta" style="display: flex; gap: 20px; background: #f8f9fa; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
|
||||
<div class="detail-meta" style="display: flex; gap: 20px; background: #f8f9fa; padding: 15px; border-radius: 8px; margin-bottom: 20px; flex-wrap: wrap;">
|
||||
<div><strong>分类:</strong> ${escapeHtml(article.category || '未分类')}</div>
|
||||
<div><strong>来源:</strong> ${escapeHtml(article.source)}</div>
|
||||
<div><strong>时间:</strong> ${formatDate(article.fetch_date)}</div>
|
||||
</div>
|
||||
${article.url ? `<div class="detail-section"><h4><i class="ri-link"></i> 原文链接</h4><a href="${escapeHtml(article.url)}" target="_blank">${escapeHtml(article.url)}</a></div>` : ''}
|
||||
${article.url ? `<div class="detail-section"><h4><i class="ri-link"></i> 原文链接</h4><a href="${escapeHtml(article.url)}" target="_blank" style="color: #667eea;">${escapeHtml(article.url)}</a></div>` : ''}
|
||||
${keywords.length > 0 ? `<div class="detail-section"><h4><i class="ri-keyword-line"></i> 关键词</h4><p>${escapeHtml(keywords.join(', '))}</p></div>` : ''}
|
||||
<div class="detail-section">
|
||||
<h4><i class="ri-file-text-line"></i> 摘要</h4>
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
<select id="category-filter" class="category-select">
|
||||
<option value="">全部分类</option>
|
||||
</select>
|
||||
<select id="page-size" class="page-size-select" onchange="changePageSize()">
|
||||
<option value="20">每页 20 条</option>
|
||||
<option value="50">每页 50 条</option>
|
||||
<option value="100" selected>每页 100 条</option>
|
||||
<option value="200">每页 200 条</option>
|
||||
<option value="500">每页 500 条</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<button onclick="showAddModal()" class="btn btn-primary">
|
||||
|
||||
Reference in New Issue
Block a user