feat(config):
style(ui): 全面重构用户界面样式

- 引入新的配色方案和设计系统变量
- 更新字体家族,使用 Fira Sans 和 Noto Sans SC
- 重新设计页面布局和组件样式
- 添加响应式设计优化
- 改进按钮、表格、表单等UI元素的视觉效果

feat(tasks): 添加任务级别浏览器配置选项

- 在任务配置中增加独立的浏览器开启/关闭选项
- 支持任务继承全局浏览器设置
- 在任务列表中显示浏览器配置状态
- 实现任务级别的 useBrowser 字段管理
```
This commit is contained in:
2026-03-10 17:58:09 +08:00
parent 4f504447a1
commit b9270428db
6 changed files with 699 additions and 134 deletions

View File

@@ -6,136 +6,365 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公告抓取与分析工具</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700&family=Fira+Code:wght@500;600&family=Noto+Sans+SC:wght@400;500;700&display=swap');
:root {
--primary: #0f6ecd;
--primary-hover: #0c5caf;
--secondary: #0ea5a4;
--accent: #f59e0b;
--success: #0f9d58;
--danger: #d94848;
--text: #10233a;
--muted: #4f647d;
--line: rgba(15, 35, 58, 0.14);
--surface: rgba(255, 255, 255, 0.64);
--surface-strong: rgba(255, 255, 255, 0.82);
--shadow: 0 24px 50px rgba(15, 42, 74, 0.18);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: 'Fira Sans', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
color: var(--text);
min-height: 100vh;
padding: 20px;
background:
radial-gradient(1200px 600px at -10% -10%, rgba(15, 110, 205, 0.20), transparent 60%),
radial-gradient(900px 500px at 110% -20%, rgba(14, 165, 164, 0.20), transparent 55%),
linear-gradient(145deg, #edf6ff 0%, #e8fbf6 48%, #f7fbff 100%);
}
.container {
max-width: 1100px;
max-width: 1140px;
margin: 0 auto;
background: white;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
border-radius: 20px;
overflow: hidden;
border: 1px solid var(--line);
background: var(--surface);
backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
box-shadow: var(--shadow);
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 24px 30px;
padding: 26px 30px;
text-align: center;
color: #f6fbff;
background: linear-gradient(120deg, #0f6ecd 0%, #0e9ab2 68%, #10b981 100%);
border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}
.header h1 { font-size: 24px; margin-bottom: 6px; }
.header p { opacity: 0.85; font-size: 13px; }
/* Tabs */
.tabs { display: flex; background: #f5f5f5; border-bottom: 2px solid #e0e0e0; }
.tab {
flex: 1; padding: 14px; text-align: center; cursor: pointer;
background: #f5f5f5; border: none; font-size: 15px; transition: all 0.2s;
.header h1 {
font-family: 'Fira Code', 'Noto Sans SC', sans-serif;
letter-spacing: 0.2px;
font-size: 24px;
margin-bottom: 6px;
}
.header p { opacity: 0.92; font-size: 13px; }
.tabs {
display: flex;
gap: 6px;
padding: 8px;
background: rgba(255, 255, 255, 0.36);
border-bottom: 1px solid var(--line);
}
.tab {
flex: 1;
padding: 12px;
text-align: center;
cursor: pointer;
border: 1px solid transparent;
background: transparent;
color: var(--muted);
border-radius: 10px;
font-size: 15px;
font-weight: 600;
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tab:hover {
color: var(--text);
background: rgba(255, 255, 255, 0.56);
border-color: var(--line);
}
.tab.active {
color: var(--primary);
background: var(--surface-strong);
border-color: rgba(15, 110, 205, 0.30);
box-shadow: inset 0 0 0 1px rgba(15, 110, 205, 0.12);
}
.tab:hover { background: #e8e8e8; }
.tab.active { background: white; color: #667eea; font-weight: bold; border-bottom: 3px solid #667eea; }
.content { padding: 24px; }
.tab-content { display: none; }
.tab-content.active { display: block; }
/* Form elements */
label { display: block; font-weight: 600; margin-bottom: 6px; color: #333; font-size: 14px; }
input[type="text"], input[type="number"], input[type="password"], textarea, select {
width: 100%; padding: 10px 12px; border: 1px solid #d0d0d0; border-radius: 8px;
font-size: 14px; transition: border 0.2s;
label {
display: block;
font-weight: 600;
margin-bottom: 6px;
color: var(--text);
font-size: 14px;
}
input[type="text"], input[type="number"], input[type="password"], textarea, select {
width: 100%;
padding: 10px 12px;
border: 1px solid var(--line);
border-radius: 10px;
font-size: 14px;
background: rgba(255, 255, 255, 0.76);
color: var(--text);
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
input:focus, textarea:focus, select:focus {
outline: none;
border-color: rgba(15, 110, 205, 0.55);
box-shadow: 0 0 0 3px rgba(15, 110, 205, 0.12);
background: #ffffff;
}
textarea {
resize: vertical;
min-height: 80px;
font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #667eea; }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; }
.form-row > * { flex: 1; }
/* Buttons */
.btn {
padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
font-size: 14px; font-weight: 600; transition: all 0.2s; display: inline-flex;
align-items: center; gap: 6px;
padding: 10px 18px;
border: 1px solid transparent;
border-radius: 10px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5a6fd6; }
.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #218838; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-primary {
color: #fff;
background: linear-gradient(120deg, var(--primary), #178ac2);
box-shadow: 0 8px 18px rgba(15, 110, 205, 0.25);
}
.btn-primary:hover { background: linear-gradient(120deg, var(--primary-hover), #1279aa); }
.btn-success {
color: #fff;
background: linear-gradient(120deg, #0f9d58, #14b46c);
box-shadow: 0 8px 16px rgba(15, 157, 88, 0.24);
}
.btn-success:hover { filter: brightness(0.96); }
.btn-danger {
color: #fff;
background: linear-gradient(120deg, #d94848, #e26a5f);
box-shadow: 0 8px 16px rgba(217, 72, 72, 0.22);
}
.btn-danger:hover { filter: brightness(0.96); }
.btn-secondary {
color: #1e3856;
background: rgba(255, 255, 255, 0.72);
border-color: var(--line);
}
.btn-secondary:hover { background: #ffffff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; border-radius: 12px; overflow: hidden; }
/* Table */
table { width: 100%; border-collapse: collapse; }
th { background: #f8f9fa; padding: 12px; text-align: left; font-size: 13px; color: #555; border-bottom: 2px solid #e0e0e0; }
td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 13px; vertical-align: top; }
tr:hover { background: #f8f9ff; }
th {
background: rgba(15, 110, 205, 0.12);
padding: 12px;
text-align: left;
font-size: 13px;
color: #19446f;
border-bottom: 1px solid rgba(15, 110, 205, 0.22);
}
.prompt-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td {
padding: 10px 12px;
border-bottom: 1px solid rgba(15, 35, 58, 0.08);
font-size: 13px;
color: #203a58;
vertical-align: top;
background: rgba(255, 255, 255, 0.42);
}
/* Tags */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.tag-on { background: #d4edda; color: #155724; }
.tag-off { background: #f8d7da; color: #721c24; }
tr:hover td { background: rgba(255, 255, 255, 0.74); }
.prompt-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
display: inline-block;
padding: 2px 10px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
border: 1px solid transparent;
}
.tag-on { background: rgba(15, 157, 88, 0.12); color: #0b7f47; border-color: rgba(15, 157, 88, 0.24); }
.tag-off { background: rgba(217, 72, 72, 0.12); color: #b83b3b; border-color: rgba(217, 72, 72, 0.24); }
/* Modal */
.modal {
display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
display: none;
position: fixed;
inset: 0;
background: rgba(9, 20, 36, 0.34);
z-index: 1000;
justify-content: center;
align-items: center;
padding: 20px;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
}
.modal.show { display: flex; }
.modal-body {
background: white; border-radius: 12px; padding: 28px; width: 600px; max-width: 90vw;
max-height: 85vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
border-radius: 16px;
padding: 26px;
width: 620px;
max-width: 92vw;
max-height: 86vh;
overflow-y: auto;
background: rgba(255, 255, 255, 0.9);
border: 1px solid var(--line);
box-shadow: var(--shadow);
}
.modal-body h3 { margin-bottom: 20px; color: #333; }
/* Status / alerts */
.modal-body h3 { margin-bottom: 20px; color: var(--text); }
.status-box {
padding: 14px; border-radius: 8px; margin-top: 16px; font-size: 14px;
padding: 14px;
border-radius: 10px;
margin-top: 16px;
font-size: 14px;
border: 1px solid transparent;
}
.status-info { background: #e8f0fe; color: #1a56db; }
.status-success { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }
.empty-state { text-align: center; padding: 40px; color: #999; }
.status-info {
background: rgba(15, 110, 205, 0.10);
color: #0f5eab;
border-color: rgba(15, 110, 205, 0.24);
}
.status-success {
background: rgba(15, 157, 88, 0.10);
color: #0f7f4b;
border-color: rgba(15, 157, 88, 0.24);
}
.status-error {
background: rgba(217, 72, 72, 0.10);
color: #b43d3d;
border-color: rgba(217, 72, 72, 0.24);
}
.empty-state { text-align: center; padding: 42px; color: var(--muted); }
/* Result items */
.result-card {
border: 1px solid #e8e8e8; border-radius: 10px; padding: 16px; margin-bottom: 12px;
transition: box-shadow 0.2s;
border: 1px solid var(--line);
border-radius: 14px;
padding: 16px;
margin-bottom: 12px;
background: rgba(255, 255, 255, 0.6);
transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.result-card:hover {
border-color: rgba(15, 110, 205, 0.30);
box-shadow: 0 10px 26px rgba(15, 42, 74, 0.14);
}
.result-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
gap: 12px;
}
.result-card-header h4 { font-size: 15px; color: #17395b; }
.result-card-header span { font-size: 12px; color: var(--muted); }
.result-item {
display: flex;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid rgba(15, 35, 58, 0.08);
gap: 12px;
}
.result-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.result-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.result-card-header h4 { font-size: 15px; color: #333; }
.result-card-header span { font-size: 12px; color: #888; }
.result-item { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; gap: 12px; }
.result-item:last-child { border-bottom: none; }
.result-item .type { min-width: 80px; font-weight: 600; color: #667eea; font-size: 13px; }
.result-item .name { flex: 1; font-size: 13px; }
.result-item .amount { min-width: 100px; text-align: right; font-weight: 600; color: #e74c3c; font-size: 13px; }
.result-item .date { min-width: 90px; text-align: center; color: #888; font-size: 12px; }
.result-item a { color: #667eea; text-decoration: none; font-size: 12px; }
.result-item .type { min-width: 80px; font-weight: 700; color: var(--primary); font-size: 13px; }
.result-item .name { flex: 1; font-size: 13px; color: #1f3957; }
.result-item .amount { min-width: 100px; text-align: right; font-weight: 700; color: #ad5b1a; font-size: 13px; }
.result-item .date { min-width: 90px; text-align: center; color: var(--muted); font-size: 12px; }
.result-item a { color: var(--primary); text-decoration: none; font-size: 12px; }
.result-item a:hover { text-decoration: underline; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
flex-wrap: wrap;
gap: 10px;
}
/* Agent config */
.config-section { background: #f9f9f9; border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.config-section h3 { margin-bottom: 14px; font-size: 16px; color: #444; }
.config-section {
background: rgba(255, 255, 255, 0.58);
border: 1px solid var(--line);
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
}
.config-section h3 {
margin-bottom: 14px;
font-size: 16px;
color: #19446f;
}
@media (max-width: 900px) {
body { padding: 12px; }
.content { padding: 14px; }
.form-row { flex-direction: column; gap: 10px; }
.header { padding: 20px 16px; }
.header h1 { font-size: 20px; }
.tabs { padding: 6px; }
.tab { font-size: 14px; padding: 10px 6px; }
.btn { padding: 9px 14px; }
}
@media (prefers-reduced-motion: reduce) {
* {
transition: none !important;
animation: none !important;
}
}
</style>
</head>
@@ -169,11 +398,12 @@
<th>城市</th>
<th>提示词</th>
<th>状态</th>
<th>浏览器</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tasksTbody">
<tr><td colspan="4" class="empty-state">加载中...</td></tr>
<tr><td colspan="5" class="empty-state">加载中...</td></tr>
</tbody>
</table>
@@ -304,6 +534,11 @@
<input type="checkbox" id="taskEnabled" checked> 启用
</label>
</div>
<div class="form-group">
<label>
<input type="checkbox" id="taskUseBrowser"> 打开浏览器
</label>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
<button type="button" class="btn btn-secondary" onclick="closeTaskModal()">取消</button>
<button type="submit" class="btn btn-primary">保存</button>
@@ -346,7 +581,7 @@
document.getElementById('taskSummary').textContent = `${tasksList.length} 个任务,${enabled} 个启用`;
if (tasksList.length === 0) {
tbody.innerHTML = '<tr><td colspan="4" class="empty-state">暂无任务,点击「新增任务」添加</td></tr>';
tbody.innerHTML = '<tr><td colspan="5" class="empty-state">暂无任务,点击「新增任务」添加</td></tr>';
return;
}
@@ -355,6 +590,7 @@
<td><strong>${t.city || '-'}</strong></td>
<td class="prompt-cell" title="${(t.prompt || '').replace(/"/g, '&quot;')}">${t.prompt || '-'}</td>
<td><span class="tag ${t.enabled ? 'tag-on' : 'tag-off'}">${t.enabled ? '启用' : '禁用'}</span></td>
<td><span class="tag ${t.useBrowser === true ? 'tag-on' : (t.useBrowser === false ? 'tag-off' : '')}">${t.useBrowser === true ? '打开' : (t.useBrowser === false ? '关闭' : '继承全局')}</span></td>
<td>
<button class="btn btn-primary btn-sm" onclick="openTaskModal('${t.id}')">编辑</button>
<button class="btn btn-success btn-sm" onclick="runSingleTask('${t.id}', this)">运行</button>
@@ -367,11 +603,15 @@
function openTaskModal(id) {
const item = id ? tasksList.find(t => t.id === id) : null;
const globalUseBrowser = document.getElementById('cfgUseBrowser').value === 'true';
document.getElementById('taskModalTitle').textContent = item ? '编辑任务' : '新增任务';
document.getElementById('taskEditId').value = item ? item.id : '';
document.getElementById('taskCity').value = item ? item.city : '';
document.getElementById('taskPrompt').value = item ? item.prompt : '';
document.getElementById('taskEnabled').checked = item ? item.enabled : true;
document.getElementById('taskUseBrowser').checked = item
? (typeof item.useBrowser === 'boolean' ? item.useBrowser : globalUseBrowser)
: globalUseBrowser;
document.getElementById('taskModal').classList.add('show');
}
@@ -386,6 +626,7 @@
city: document.getElementById('taskCity').value.trim(),
prompt: document.getElementById('taskPrompt').value.trim(),
enabled: document.getElementById('taskEnabled').checked,
useBrowser: document.getElementById('taskUseBrowser').checked,
};
try {
const url = id ? `/api/tasks/${id}` : '/api/tasks';
@@ -736,6 +977,7 @@
// ===== 初始化 =====
loadTasks();
loadSettings();
</script>
</body>