前后端数据流对齐:

后端改动:

GET /api/v1/accounts 现在返回分页格式 {items, total, page, size, total_pages, status_counts},默认每页 12 个
批量操作用 size=500 一次拉全部
前端改动:

base.html — 加了移动端汉堡菜单、全局响应式样式、pagination disabled 状态
dashboard.html — 账号卡片分页,统计数据从 API 的 status_counts 取,移动端单列布局
account_detail.html — 签到记录改成上下两行布局(topic+状态 / 消息+时间),分页用统一的上一页/下一页样式,移动端适配
分页逻辑统一:前后端都用 page/total_pages 字段,pagination 组件显示当前页 ±2 页码。
This commit is contained in:
2026-03-18 09:45:55 +08:00
parent 642cf76b61
commit 8f4e0a2411
7 changed files with 309 additions and 416 deletions

View File

@@ -2,216 +2,138 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>{% block title %}微博超话签到{% endblock %}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
background: linear-gradient(135deg, #f0f2ff 0%, #faf5ff 50%, #fff0f6 100%);
color: #1a1a2e;
min-height: 100vh;
color: #1a1a2e; min-height: 100vh;
}
/* ---- Navbar ---- */
.navbar {
background: rgba(255,255,255,0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(99,102,241,0.08);
padding: 0 24px;
position: sticky;
top: 0;
z-index: 100;
padding: 0 16px; position: sticky; top: 0; z-index: 100;
}
.navbar-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
height: 64px;
max-width: 1200px; margin: 0 auto;
display: flex; justify-content: space-between; align-items: center; height: 52px;
}
.navbar-brand {
font-size: 22px;
font-weight: 700;
font-size: 18px; font-weight: 700;
background: linear-gradient(135deg, #6366f1, #a855f7);
-webkit-background-clip: text;
-webkit-background-clip: text; background-clip: text;
-webkit-text-fill-color: transparent;
text-decoration: none;
}
.navbar-menu {
display: flex;
gap: 28px;
align-items: center;
text-decoration: none; white-space: nowrap;
}
.navbar-menu { display: flex; gap: 20px; align-items: center; }
.navbar-menu > a {
color: #64748b;
text-decoration: none;
font-size: 15px;
font-weight: 500;
transition: color 0.2s;
padding: 6px 0;
color: #64748b; text-decoration: none; font-size: 14px;
font-weight: 500; transition: color 0.2s;
}
.navbar-menu > a:hover { color: #6366f1; }
.navbar-user {
display: flex;
gap: 14px;
align-items: center;
}
.navbar-user span {
color: #475569;
font-size: 14px;
font-weight: 500;
}
.navbar-user { display: flex; gap: 10px; align-items: center; }
.navbar-user span { color: #475569; font-size: 13px; font-weight: 500; }
.btn-logout {
background: linear-gradient(135deg, #f43f5e, #e11d48);
color: white;
padding: 7px 18px;
border: none;
border-radius: 20px;
cursor: pointer;
text-decoration: none;
font-size: 13px;
font-weight: 500;
transition: opacity 0.2s;
background: linear-gradient(135deg, #f43f5e, #e11d48); color: white;
padding: 5px 14px; border: none; border-radius: 20px; cursor: pointer;
text-decoration: none; font-size: 12px; font-weight: 500;
}
.btn-logout:hover { opacity: 0.85; }
.container {
max-width: 1200px;
margin: 28px auto;
padding: 0 20px;
.navbar-toggle {
display: none; background: none; border: none;
font-size: 22px; cursor: pointer; color: #475569; padding: 4px;
}
.alert {
padding: 14px 20px;
margin-bottom: 20px;
border-radius: 16px;
font-size: 14px;
font-weight: 500;
}
/* ---- Layout ---- */
.container { max-width: 1200px; margin: 16px auto; padding: 0 16px; }
/* ---- Alerts ---- */
.alert { padding: 10px 14px; margin-bottom: 14px; border-radius: 12px; font-size: 13px; font-weight: 500; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: #334155; font-size: 14px; }
/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-weight: 600; color: #334155; font-size: 13px; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
width: 100%;
padding: 12px 16px;
border: 1.5px solid #e2e8f0;
border-radius: 14px;
font-size: 14px;
font-family: inherit;
background: #fff;
transition: border-color 0.2s, box-shadow 0.2s;
width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0;
border-radius: 12px; font-size: 14px; font-family: inherit; background: #fff;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
textarea:focus, select:focus {
outline: none;
border-color: #818cf8;
box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
input:focus, textarea:focus, select:focus {
outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
textarea { resize: vertical; min-height: 100px; }
textarea { resize: vertical; min-height: 80px; }
/* ---- Buttons ---- */
.btn {
padding: 10px 22px;
border: none;
border-radius: 14px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.2s;
text-decoration: none;
display: inline-block;
}
.btn-primary {
background: linear-gradient(135deg, #6366f1, #818cf8);
color: white;
box-shadow: 0 2px 8px rgba(99,102,241,0.25);
padding: 8px 16px; border: none; border-radius: 12px; cursor: pointer;
font-size: 13px; font-weight: 600; transition: all 0.2s;
text-decoration: none; display: inline-block; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #6366f1, #818cf8); color: white; box-shadow: 0 2px 8px rgba(99,102,241,0.25); }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,0.35); transform: translateY(-1px); }
.btn-secondary { background: #f1f5f9; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger {
background: linear-gradient(135deg, #f43f5e, #e11d48);
color: white;
box-shadow: 0 2px 8px rgba(244,63,94,0.25);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(244,63,94,0.35); }
.btn-success {
background: linear-gradient(135deg, #10b981, #059669);
color: white;
box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.35); }
.btn-group { display: flex; gap: 10px; margin-top: 20px; }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); color: white; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.btn-group { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
/* ---- Cards ---- */
.card {
background: rgba(255,255,255,0.9);
backdrop-filter: blur(8px);
border-radius: 20px;
box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
padding: 24px;
margin-bottom: 20px;
border: 1px solid rgba(255,255,255,0.6);
background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
padding: 16px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,0.6);
}
.card-header {
font-size: 17px;
font-weight: 700;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 2px solid #f1f5f9;
color: #1e293b;
font-size: 15px; font-weight: 700; margin-bottom: 12px;
padding-bottom: 10px; border-bottom: 2px solid #f1f5f9; color: #1e293b;
}
.badge {
display: inline-block;
padding: 4px 14px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
}
/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-info { background: #eff6ff; color: #2563eb; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th {
background: #f8fafc;
padding: 12px 16px;
text-align: left;
font-weight: 600;
font-size: 13px;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.5px;
border-bottom: 2px solid #e2e8f0;
}
td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
tr:hover { background: #f8fafc; }
/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 8px 10px; text-align: left; font-weight: 600; font-size: 12px; color: #64748b; border-bottom: 2px solid #e2e8f0; }
td { padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
padding: 8px 14px;
border: 1.5px solid #e2e8f0;
border-radius: 12px;
text-decoration: none;
color: #6366f1;
font-size: 14px;
font-weight: 500;
padding: 6px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px;
text-decoration: none; color: #6366f1; font-size: 13px; font-weight: 500;
}
.pagination a:hover { background: #f1f5f9; }
.pagination .active { background: #6366f1; color: white; border-color: #6366f1; }
.pagination .disabled { color: #cbd5e1; pointer-events: none; }
/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
.navbar-menu { display: none; }
.navbar-toggle { display: block; }
.navbar-menu {
display: none; flex-direction: column; gap: 0;
position: absolute; top: 52px; left: 0; right: 0;
background: rgba(255,255,255,0.98); backdrop-filter: blur(12px);
border-bottom: 1px solid #e2e8f0; padding: 8px 0;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.navbar-menu.open { display: flex; }
.navbar-menu > a { padding: 12px 20px; font-size: 15px; border-bottom: 1px solid #f1f5f9; }
.navbar-user { padding: 12px 20px; gap: 12px; }
.container { padding: 0 12px; margin: 12px auto; }
.card { padding: 14px; border-radius: 14px; }
.btn { padding: 8px 14px; font-size: 12px; }
.btn-group { flex-direction: column; }
.btn { width: 100%; text-align: center; }
.btn-group .btn { width: 100%; text-align: center; }
}
</style>
{% block extra_css %}{% endblock %}
@@ -221,6 +143,7 @@
<nav class="navbar">
<div class="navbar-content">
<a href="{{ url_for('dashboard') }}" class="navbar-brand">🔥 微博超话签到</a>
<button class="navbar-toggle" onclick="document.querySelector('.navbar-menu').classList.toggle('open')"></button>
<div class="navbar-menu">
<a href="{{ url_for('dashboard') }}">控制台</a>
{% if session.get('user', {}).get('is_admin') %}