前后端数据流对齐:
后端改动:
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:
@@ -92,15 +92,49 @@ async def create_account(
|
|||||||
|
|
||||||
@router.get("")
|
@router.get("")
|
||||||
async def list_accounts(
|
async def list_accounts(
|
||||||
|
page: int = 1,
|
||||||
|
size: int = 12,
|
||||||
user: User = Depends(get_current_user),
|
user: User = Depends(get_current_user),
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
):
|
):
|
||||||
|
from sqlalchemy import func as sa_func
|
||||||
|
|
||||||
|
# Total count
|
||||||
|
count_q = select(sa_func.count()).select_from(
|
||||||
|
select(Account).where(Account.user_id == user.id).subquery()
|
||||||
|
)
|
||||||
|
total = (await db.execute(count_q)).scalar() or 0
|
||||||
|
|
||||||
|
# Status counts (for dashboard stats)
|
||||||
|
status_q = (
|
||||||
|
select(Account.status, sa_func.count())
|
||||||
|
.where(Account.user_id == user.id)
|
||||||
|
.group_by(Account.status)
|
||||||
|
)
|
||||||
|
status_rows = (await db.execute(status_q)).all()
|
||||||
|
status_counts = {row[0]: row[1] for row in status_rows}
|
||||||
|
|
||||||
|
# Paginated list
|
||||||
|
offset = (max(1, page) - 1) * size
|
||||||
result = await db.execute(
|
result = await db.execute(
|
||||||
select(Account).where(Account.user_id == user.id)
|
select(Account)
|
||||||
|
.where(Account.user_id == user.id)
|
||||||
|
.order_by(Account.created_at.desc())
|
||||||
|
.offset(offset)
|
||||||
|
.limit(size)
|
||||||
)
|
)
|
||||||
accounts = result.scalars().all()
|
accounts = result.scalars().all()
|
||||||
|
total_pages = (total + size - 1) // size if total > 0 else 0
|
||||||
|
|
||||||
return success_response(
|
return success_response(
|
||||||
[_account_to_dict(a) for a in accounts],
|
{
|
||||||
|
"items": [_account_to_dict(a) for a in accounts],
|
||||||
|
"total": total,
|
||||||
|
"page": page,
|
||||||
|
"size": size,
|
||||||
|
"total_pages": total_pages,
|
||||||
|
"status_counts": status_counts,
|
||||||
|
},
|
||||||
"Accounts retrieved",
|
"Accounts retrieved",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
1
backend/task_scheduler/app/__init__.py
Normal file
1
backend/task_scheduler/app/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Task scheduler app
|
||||||
1
backend/task_scheduler/app/tasks/__init__.py
Normal file
1
backend/task_scheduler/app/tasks/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Task modules
|
||||||
@@ -213,18 +213,32 @@ def logout():
|
|||||||
@app.route('/dashboard')
|
@app.route('/dashboard')
|
||||||
@login_required
|
@login_required
|
||||||
def dashboard():
|
def dashboard():
|
||||||
|
page = request.args.get('page', 1, type=int)
|
||||||
try:
|
try:
|
||||||
response = api_request(
|
response = api_request(
|
||||||
'GET',
|
'GET',
|
||||||
f'{API_BASE_URL}/api/v1/accounts',
|
f'{API_BASE_URL}/api/v1/accounts',
|
||||||
|
params={'page': page, 'size': 12},
|
||||||
)
|
)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
accounts = data.get('data', []) if data.get('success') else []
|
if data.get('success'):
|
||||||
|
payload = data.get('data', {})
|
||||||
|
# 兼容旧版 API(返回列表)和新版(返回分页对象)
|
||||||
|
if isinstance(payload, list):
|
||||||
|
accounts = payload
|
||||||
|
pagination = {'items': payload, 'total': len(payload), 'page': 1, 'size': len(payload), 'total_pages': 1, 'status_counts': {}}
|
||||||
|
else:
|
||||||
|
accounts = payload.get('items', [])
|
||||||
|
pagination = payload
|
||||||
|
else:
|
||||||
|
accounts = []
|
||||||
|
pagination = {'items': [], 'total': 0, 'page': 1, 'size': 12, 'total_pages': 0, 'status_counts': {}}
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
accounts = []
|
accounts = []
|
||||||
|
pagination = {'items': [], 'total': 0, 'page': 1, 'size': 12, 'total_pages': 0, 'status_counts': {}}
|
||||||
flash('加载账号列表失败', 'warning')
|
flash('加载账号列表失败', 'warning')
|
||||||
|
|
||||||
return render_template('dashboard.html', accounts=accounts, user=session.get('user'))
|
return render_template('dashboard.html', accounts=accounts, pagination=pagination, user=session.get('user'))
|
||||||
|
|
||||||
@app.route('/accounts/new')
|
@app.route('/accounts/new')
|
||||||
@login_required
|
@login_required
|
||||||
@@ -841,9 +855,10 @@ def delete_task(task_id):
|
|||||||
def batch_verify():
|
def batch_verify():
|
||||||
"""批量验证所有账号的 Cookie 有效性"""
|
"""批量验证所有账号的 Cookie 有效性"""
|
||||||
try:
|
try:
|
||||||
response = api_request('GET', f'{API_BASE_URL}/api/v1/accounts')
|
response = api_request('GET', f'{API_BASE_URL}/api/v1/accounts', params={'page': 1, 'size': 500})
|
||||||
data = response.json()
|
data = response.json()
|
||||||
accounts = data.get('data', []) if data.get('success') else []
|
payload = data.get('data', {}) if data.get('success') else {}
|
||||||
|
accounts = payload.get('items', []) if isinstance(payload, dict) else payload
|
||||||
|
|
||||||
valid = invalid = errors = 0
|
valid = invalid = errors = 0
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
@@ -871,9 +886,10 @@ def batch_verify():
|
|||||||
def batch_signin():
|
def batch_signin():
|
||||||
"""批量签到所有正常状态的账号"""
|
"""批量签到所有正常状态的账号"""
|
||||||
try:
|
try:
|
||||||
response = api_request('GET', f'{API_BASE_URL}/api/v1/accounts')
|
response = api_request('GET', f'{API_BASE_URL}/api/v1/accounts', params={'page': 1, 'size': 500})
|
||||||
data = response.json()
|
data = response.json()
|
||||||
accounts = data.get('data', []) if data.get('success') else []
|
payload = data.get('data', {}) if data.get('success') else {}
|
||||||
|
accounts = payload.get('items', []) if isinstance(payload, dict) else payload
|
||||||
|
|
||||||
total_signed = total_already = total_failed = 0
|
total_signed = total_already = total_failed = 0
|
||||||
processed = 0
|
processed = 0
|
||||||
|
|||||||
@@ -4,44 +4,41 @@
|
|||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
<style>
|
<style>
|
||||||
.detail-header {
|
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
|
||||||
display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
|
.detail-header h1 { font-size: 20px; font-weight: 700; color: #1e293b; }
|
||||||
}
|
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
|
||||||
.detail-header h1 { font-size: 24px; font-weight: 700; color: #1e293b; }
|
.info-table td { padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
|
||||||
.info-grid {
|
|
||||||
display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
@media (max-width: 768px) { .info-grid { grid-template-columns: 1fr; } }
|
|
||||||
.info-table td { padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
|
|
||||||
.info-table td:first-child { font-weight: 600; color: #64748b; width: 30%; }
|
.info-table td:first-child { font-weight: 600; color: #64748b; width: 30%; }
|
||||||
.action-btn {
|
.action-btn {
|
||||||
width: 100%; padding: 12px; border-radius: 14px; border: none;
|
width: 100%; padding: 10px; border-radius: 12px; border: none;
|
||||||
font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
|
font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
|
||||||
text-align: center; text-decoration: none; display: block;
|
text-align: center; text-decoration: none; display: block;
|
||||||
}
|
}
|
||||||
.action-btn-primary {
|
.action-btn-primary { background: linear-gradient(135deg, #6366f1, #818cf8); color: white; }
|
||||||
background: linear-gradient(135deg, #6366f1, #818cf8); color: white;
|
.action-btn-primary:hover { transform: translateY(-1px); }
|
||||||
box-shadow: 0 2px 8px rgba(99,102,241,0.25);
|
|
||||||
}
|
|
||||||
.action-btn-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,0.35); transform: translateY(-1px); }
|
|
||||||
.action-btn-secondary { background: #f1f5f9; color: #475569; }
|
.action-btn-secondary { background: #f1f5f9; color: #475569; }
|
||||||
.action-btn-secondary:hover { background: #e2e8f0; }
|
.action-btn-secondary:hover { background: #e2e8f0; }
|
||||||
.task-row {
|
.task-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; gap: 8px; }
|
||||||
display: flex; align-items: center; justify-content: space-between;
|
|
||||||
padding: 14px 0; border-bottom: 1px solid #f1f5f9;
|
|
||||||
}
|
|
||||||
.task-row:last-child { border-bottom: none; }
|
.task-row:last-child { border-bottom: none; }
|
||||||
.task-cron {
|
.task-cron { font-family: 'SF Mono', Monaco, monospace; background: #eef2ff; color: #6366f1; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; }
|
||||||
font-family: 'SF Mono', Monaco, monospace; background: #eef2ff; color: #6366f1;
|
.task-actions { display: flex; gap: 6px; }
|
||||||
padding: 4px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
|
.task-actions .btn { padding: 5px 12px; font-size: 11px; border-radius: 8px; }
|
||||||
|
|
||||||
|
/* 签到记录 - 移动端友好 */
|
||||||
|
.log-item { padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
|
||||||
|
.log-item:last-child { border-bottom: none; }
|
||||||
|
.log-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
|
||||||
|
.log-topic { font-weight: 500; color: #1e293b; font-size: 14px; }
|
||||||
|
.log-bottom { display: flex; justify-content: space-between; align-items: center; }
|
||||||
|
.log-msg { font-size: 12px; color: #64748b; flex: 1; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.log-date { font-size: 11px; color: #94a3b8; white-space: nowrap; }
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.info-grid { grid-template-columns: 1fr; }
|
||||||
|
.detail-header { flex-direction: column; align-items: flex-start; }
|
||||||
|
.task-row { flex-direction: column; align-items: flex-start; }
|
||||||
|
.task-actions { width: 100%; justify-content: flex-end; }
|
||||||
}
|
}
|
||||||
.task-actions { display: flex; gap: 8px; }
|
|
||||||
.task-actions .btn { padding: 6px 14px; font-size: 12px; border-radius: 10px; }
|
|
||||||
.log-row {
|
|
||||||
display: grid; grid-template-columns: 1fr auto auto auto; gap: 16px;
|
|
||||||
align-items: center; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px;
|
|
||||||
}
|
|
||||||
.log-row:last-child { border-bottom: none; }
|
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -50,9 +47,9 @@
|
|||||||
<div class="detail-header">
|
<div class="detail-header">
|
||||||
<div>
|
<div>
|
||||||
<h1>{{ account.remark or account.weibo_user_id }}</h1>
|
<h1>{{ account.remark or account.weibo_user_id }}</h1>
|
||||||
<div style="color:#94a3b8; font-size:14px; margin-top:4px;">UID: {{ account.weibo_user_id }}</div>
|
<div style="color:#94a3b8; font-size:13px; margin-top:2px;">UID: {{ account.weibo_user_id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex; gap:10px;">
|
<div style="display:flex; gap:8px;">
|
||||||
<a href="{{ url_for('edit_account', account_id=account.id) }}" class="btn btn-secondary">✏️ 编辑</a>
|
<a href="{{ url_for('edit_account', account_id=account.id) }}" class="btn btn-secondary">✏️ 编辑</a>
|
||||||
<form method="POST" action="{{ url_for('delete_account', account_id=account.id) }}" style="display:inline;" onsubmit="return confirm('确定要删除此账号吗?');">
|
<form method="POST" action="{{ url_for('delete_account', account_id=account.id) }}" style="display:inline;" onsubmit="return confirm('确定要删除此账号吗?');">
|
||||||
<button type="submit" class="btn btn-danger">删除</button>
|
<button type="submit" class="btn btn-danger">删除</button>
|
||||||
@@ -81,7 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">⚡ 快捷操作</div>
|
<div class="card-header">⚡ 快捷操作</div>
|
||||||
<div style="display:flex; flex-direction:column; gap:10px;">
|
<div style="display:flex; flex-direction:column; gap:8px;">
|
||||||
<form method="POST" action="{{ url_for('verify_account', account_id=account.id) }}">
|
<form method="POST" action="{{ url_for('verify_account', account_id=account.id) }}">
|
||||||
<button type="submit" class="action-btn action-btn-secondary">🔍 验证 Cookie</button>
|
<button type="submit" class="action-btn action-btn-secondary">🔍 验证 Cookie</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -99,7 +96,7 @@
|
|||||||
{% if tasks %}
|
{% if tasks %}
|
||||||
{% for task in tasks %}
|
{% for task in tasks %}
|
||||||
<div class="task-row">
|
<div class="task-row">
|
||||||
<div style="display:flex; align-items:center; gap:12px;">
|
<div style="display:flex; align-items:center; gap:10px;">
|
||||||
<span class="task-cron">{{ task.cron_expression }}</span>
|
<span class="task-cron">{{ task.cron_expression }}</span>
|
||||||
{% if task.is_enabled %}<span class="badge badge-success">已启用</span>
|
{% if task.is_enabled %}<span class="badge badge-success">已启用</span>
|
||||||
{% else %}<span class="badge badge-warning">已禁用</span>{% endif %}
|
{% else %}<span class="badge badge-warning">已禁用</span>{% endif %}
|
||||||
@@ -110,7 +107,7 @@
|
|||||||
<input type="hidden" name="is_enabled" value="{{ task.is_enabled|lower }}">
|
<input type="hidden" name="is_enabled" value="{{ task.is_enabled|lower }}">
|
||||||
<button type="submit" class="btn btn-secondary">{% if task.is_enabled %}禁用{% else %}启用{% endif %}</button>
|
<button type="submit" class="btn btn-secondary">{% if task.is_enabled %}禁用{% else %}启用{% endif %}</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action="{{ url_for('delete_task', task_id=task.id) }}" style="display:inline;" onsubmit="return confirm('确定要删除此任务吗?');">
|
<form method="POST" action="{{ url_for('delete_task', task_id=task.id) }}" style="display:inline;" onsubmit="return confirm('确定删除?');">
|
||||||
<input type="hidden" name="account_id" value="{{ account.id }}">
|
<input type="hidden" name="account_id" value="{{ account.id }}">
|
||||||
<button type="submit" class="btn btn-danger">删除</button>
|
<button type="submit" class="btn btn-danger">删除</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -118,53 +115,60 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p style="color:#94a3b8; text-align:center; padding:24px; font-size:14px;">暂无定时任务</p>
|
<p style="color:#94a3b8; text-align:center; padding:20px; font-size:13px;">暂无定时任务</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">📝 签到记录</div>
|
<div class="card-header">📝 签到记录 {% if logs.get('total', 0) > 0 %}(共 {{ logs.total }} 条){% endif %}</div>
|
||||||
{% if logs['items'] %}
|
{% if logs.get('items') %}
|
||||||
{% for log in logs['items'] %}
|
{% for log in logs['items'] %}
|
||||||
<div class="log-row">
|
<div class="log-item">
|
||||||
<div style="font-weight:500; color:#1e293b;">{{ log.topic_title or '-' }}</div>
|
<div class="log-top">
|
||||||
<div>
|
<span class="log-topic">{{ log.topic_title or '-' }}</span>
|
||||||
{% if log.status == 'success' %}<span class="badge badge-success">签到成功</span>
|
{% if log.status == 'success' %}<span class="badge badge-success">签到成功</span>
|
||||||
{% elif log.status == 'failed_already_signed' %}<span class="badge badge-info">今日已签</span>
|
{% elif log.status == 'failed_already_signed' %}<span class="badge badge-info">今日已签</span>
|
||||||
{% elif log.status == 'failed_network' %}<span class="badge badge-warning">网络错误</span>
|
{% elif log.status == 'failed_network' %}<span class="badge badge-warning">网络错误</span>
|
||||||
{% elif log.status == 'failed_banned' %}<span class="badge badge-danger">已封禁</span>
|
{% elif log.status == 'failed_banned' %}<span class="badge badge-danger">已封禁</span>
|
||||||
|
{% else %}<span class="badge badge-info">{{ log.status }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size:13px; color:#64748b;">
|
<div class="log-bottom">
|
||||||
{% if log.reward_info %}
|
<span class="log-msg">
|
||||||
{% if log.reward_info is mapping %}
|
{% if log.reward_info %}
|
||||||
{{ log.reward_info.get('message', '-') }}
|
{% if log.reward_info is mapping %}{{ log.reward_info.get('message', '-') }}
|
||||||
{% else %}
|
{% else %}{{ log.reward_info }}{% endif %}
|
||||||
{{ log.reward_info }}
|
{% else %}-{% endif %}
|
||||||
{% endif %}
|
</span>
|
||||||
{% else %}-{% endif %}
|
<span class="log-date">{{ log.signed_at[:16] | replace('T', ' ') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="color:#94a3b8; font-size:13px;">{{ log.signed_at[:10] }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if logs['total'] > logs['size'] %}
|
|
||||||
|
{% set p = logs.get('page', 1) %}
|
||||||
|
{% set tp = logs.get('total_pages', 1) %}
|
||||||
|
{% if tp > 1 %}
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
{% if logs['page'] > 1 %}
|
{% if p > 1 %}
|
||||||
<a href="?page=1">首页</a>
|
<a href="?page={{ p - 1 }}">‹ 上一页</a>
|
||||||
<a href="?page={{ logs['page'] - 1 }}">上一页</a>
|
{% else %}
|
||||||
|
<span class="disabled">‹ 上一页</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for p in range(max(1, logs['page'] - 2), min(logs['total'] // logs['size'] + 2, logs['page'] + 3)) %}
|
|
||||||
{% if p == logs['page'] %}<span class="active">{{ p }}</span>
|
{% for i in range(max(1, p - 2), min(tp, p + 2) + 1) %}
|
||||||
{% else %}<a href="?page={{ p }}">{{ p }}</a>{% endif %}
|
{% if i == p %}<span class="active">{{ i }}</span>
|
||||||
|
{% else %}<a href="?page={{ i }}">{{ i }}</a>{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if logs['page'] < logs['total'] // logs['size'] + 1 %}
|
|
||||||
<a href="?page={{ logs['page'] + 1 }}">下一页</a>
|
{% if p < tp %}
|
||||||
<a href="?page={{ logs['total'] // logs['size'] + 1 }}">末页</a>
|
<a href="?page={{ p + 1 }}">下一页 ›</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="disabled">下一页 ›</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p style="color:#94a3b8; text-align:center; padding:24px; font-size:14px;">暂无签到记录</p>
|
<p style="color:#94a3b8; text-align:center; padding:20px; font-size:13px;">暂无签到记录</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,216 +2,138 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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>
|
<title>{% block title %}微博超话签到{% endblock %}</title>
|
||||||
<style>
|
<style>
|
||||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
|
||||||
background: linear-gradient(135deg, #f0f2ff 0%, #faf5ff 50%, #fff0f6 100%);
|
background: linear-gradient(135deg, #f0f2ff 0%, #faf5ff 50%, #fff0f6 100%);
|
||||||
color: #1a1a2e;
|
color: #1a1a2e; min-height: 100vh;
|
||||||
min-height: 100vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---- Navbar ---- */
|
||||||
.navbar {
|
.navbar {
|
||||||
background: rgba(255,255,255,0.85);
|
background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
|
||||||
backdrop-filter: blur(12px);
|
|
||||||
-webkit-backdrop-filter: blur(12px);
|
|
||||||
border-bottom: 1px solid rgba(99,102,241,0.08);
|
border-bottom: 1px solid rgba(99,102,241,0.08);
|
||||||
padding: 0 24px;
|
padding: 0 16px; position: sticky; top: 0; z-index: 100;
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
}
|
||||||
.navbar-content {
|
.navbar-content {
|
||||||
max-width: 1200px;
|
max-width: 1200px; margin: 0 auto;
|
||||||
margin: 0 auto;
|
display: flex; justify-content: space-between; align-items: center; height: 52px;
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
height: 64px;
|
|
||||||
}
|
}
|
||||||
.navbar-brand {
|
.navbar-brand {
|
||||||
font-size: 22px;
|
font-size: 18px; font-weight: 700;
|
||||||
font-weight: 700;
|
|
||||||
background: linear-gradient(135deg, #6366f1, #a855f7);
|
background: linear-gradient(135deg, #6366f1, #a855f7);
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text; background-clip: text;
|
||||||
-webkit-text-fill-color: transparent;
|
-webkit-text-fill-color: transparent;
|
||||||
text-decoration: none;
|
text-decoration: none; white-space: nowrap;
|
||||||
}
|
|
||||||
.navbar-menu {
|
|
||||||
display: flex;
|
|
||||||
gap: 28px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
.navbar-menu { display: flex; gap: 20px; align-items: center; }
|
||||||
.navbar-menu > a {
|
.navbar-menu > a {
|
||||||
color: #64748b;
|
color: #64748b; text-decoration: none; font-size: 14px;
|
||||||
text-decoration: none;
|
font-weight: 500; transition: color 0.2s;
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: color 0.2s;
|
|
||||||
padding: 6px 0;
|
|
||||||
}
|
}
|
||||||
.navbar-menu > a:hover { color: #6366f1; }
|
.navbar-menu > a:hover { color: #6366f1; }
|
||||||
.navbar-user {
|
.navbar-user { display: flex; gap: 10px; align-items: center; }
|
||||||
display: flex;
|
.navbar-user span { color: #475569; font-size: 13px; font-weight: 500; }
|
||||||
gap: 14px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.navbar-user span {
|
|
||||||
color: #475569;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.btn-logout {
|
.btn-logout {
|
||||||
background: linear-gradient(135deg, #f43f5e, #e11d48);
|
background: linear-gradient(135deg, #f43f5e, #e11d48); color: white;
|
||||||
color: white;
|
padding: 5px 14px; border: none; border-radius: 20px; cursor: pointer;
|
||||||
padding: 7px 18px;
|
text-decoration: none; font-size: 12px; font-weight: 500;
|
||||||
border: none;
|
|
||||||
border-radius: 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
}
|
}
|
||||||
.btn-logout:hover { opacity: 0.85; }
|
.navbar-toggle {
|
||||||
|
display: none; background: none; border: none;
|
||||||
.container {
|
font-size: 22px; cursor: pointer; color: #475569; padding: 4px;
|
||||||
max-width: 1200px;
|
|
||||||
margin: 28px auto;
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert {
|
/* ---- Layout ---- */
|
||||||
padding: 14px 20px;
|
.container { max-width: 1200px; margin: 16px auto; padding: 0 16px; }
|
||||||
margin-bottom: 20px;
|
|
||||||
border-radius: 16px;
|
/* ---- Alerts ---- */
|
||||||
font-size: 14px;
|
.alert { padding: 10px 14px; margin-bottom: 14px; border-radius: 12px; font-size: 13px; font-weight: 500; }
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
|
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
|
||||||
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
|
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
|
||||||
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
|
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
|
||||||
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
|
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
|
||||||
|
|
||||||
.form-group { margin-bottom: 20px; }
|
/* ---- Forms ---- */
|
||||||
label { display: block; margin-bottom: 8px; font-weight: 600; color: #334155; font-size: 14px; }
|
.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 {
|
input[type="text"], input[type="email"], input[type="password"], textarea, select {
|
||||||
width: 100%;
|
width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0;
|
||||||
padding: 12px 16px;
|
border-radius: 12px; font-size: 14px; font-family: inherit; background: #fff;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
|
input:focus, textarea:focus, select:focus {
|
||||||
textarea:focus, select:focus {
|
outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
|
||||||
outline: none;
|
|
||||||
border-color: #818cf8;
|
|
||||||
box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
|
|
||||||
}
|
}
|
||||||
textarea { resize: vertical; min-height: 100px; }
|
textarea { resize: vertical; min-height: 80px; }
|
||||||
|
|
||||||
|
/* ---- Buttons ---- */
|
||||||
.btn {
|
.btn {
|
||||||
padding: 10px 22px;
|
padding: 8px 16px; border: none; border-radius: 12px; cursor: pointer;
|
||||||
border: none;
|
font-size: 13px; font-weight: 600; transition: all 0.2s;
|
||||||
border-radius: 14px;
|
text-decoration: none; display: inline-block; white-space: nowrap;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
.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-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,0.35); transform: translateY(-1px); }
|
||||||
.btn-secondary { background: #f1f5f9; color: #475569; }
|
.btn-secondary { background: #f1f5f9; color: #475569; }
|
||||||
.btn-secondary:hover { background: #e2e8f0; }
|
.btn-secondary:hover { background: #e2e8f0; }
|
||||||
.btn-danger {
|
.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); color: white; }
|
||||||
background: linear-gradient(135deg, #f43f5e, #e11d48);
|
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; }
|
||||||
color: white;
|
.btn-group { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
|
||||||
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; }
|
|
||||||
|
|
||||||
|
/* ---- Cards ---- */
|
||||||
.card {
|
.card {
|
||||||
background: rgba(255,255,255,0.9);
|
background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
|
||||||
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);
|
||||||
border-radius: 20px;
|
padding: 16px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,0.6);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
.card-header {
|
.card-header {
|
||||||
font-size: 17px;
|
font-size: 15px; font-weight: 700; margin-bottom: 12px;
|
||||||
font-weight: 700;
|
padding-bottom: 10px; border-bottom: 2px solid #f1f5f9; color: #1e293b;
|
||||||
margin-bottom: 16px;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
border-bottom: 2px solid #f1f5f9;
|
|
||||||
color: #1e293b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge {
|
/* ---- Badges ---- */
|
||||||
display: inline-block;
|
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
|
||||||
padding: 4px 14px;
|
|
||||||
border-radius: 20px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
.badge-success { background: #ecfdf5; color: #059669; }
|
.badge-success { background: #ecfdf5; color: #059669; }
|
||||||
.badge-warning { background: #fffbeb; color: #d97706; }
|
.badge-warning { background: #fffbeb; color: #d97706; }
|
||||||
.badge-danger { background: #fef2f2; color: #dc2626; }
|
.badge-danger { background: #fef2f2; color: #dc2626; }
|
||||||
.badge-info { background: #eff6ff; color: #2563eb; }
|
.badge-info { background: #eff6ff; color: #2563eb; }
|
||||||
|
|
||||||
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
|
/* ---- Tables ---- */
|
||||||
th {
|
table { width: 100%; border-collapse: collapse; }
|
||||||
background: #f8fafc;
|
th { background: #f8fafc; padding: 8px 10px; text-align: left; font-weight: 600; font-size: 12px; color: #64748b; border-bottom: 2px solid #e2e8f0; }
|
||||||
padding: 12px 16px;
|
td { padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
|
||||||
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; }
|
|
||||||
|
|
||||||
.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 {
|
.pagination a, .pagination span {
|
||||||
padding: 8px 14px;
|
padding: 6px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px;
|
||||||
border: 1.5px solid #e2e8f0;
|
text-decoration: none; color: #6366f1; font-size: 13px; font-weight: 500;
|
||||||
border-radius: 12px;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #6366f1;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
}
|
||||||
.pagination a:hover { background: #f1f5f9; }
|
.pagination a:hover { background: #f1f5f9; }
|
||||||
.pagination .active { background: #6366f1; color: white; border-color: #6366f1; }
|
.pagination .active { background: #6366f1; color: white; border-color: #6366f1; }
|
||||||
|
.pagination .disabled { color: #cbd5e1; pointer-events: none; }
|
||||||
|
|
||||||
|
/* ---- Mobile Responsive ---- */
|
||||||
@media (max-width: 768px) {
|
@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-group { flex-direction: column; }
|
||||||
.btn { width: 100%; text-align: center; }
|
.btn-group .btn { width: 100%; text-align: center; }
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% block extra_css %}{% endblock %}
|
{% block extra_css %}{% endblock %}
|
||||||
@@ -221,6 +143,7 @@
|
|||||||
<nav class="navbar">
|
<nav class="navbar">
|
||||||
<div class="navbar-content">
|
<div class="navbar-content">
|
||||||
<a href="{{ url_for('dashboard') }}" class="navbar-brand">🔥 微博超话签到</a>
|
<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">
|
<div class="navbar-menu">
|
||||||
<a href="{{ url_for('dashboard') }}">控制台</a>
|
<a href="{{ url_for('dashboard') }}">控制台</a>
|
||||||
{% if session.get('user', {}).get('is_admin') %}
|
{% if session.get('user', {}).get('is_admin') %}
|
||||||
|
|||||||
@@ -4,200 +4,113 @@
|
|||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
<style>
|
<style>
|
||||||
.dash-header {
|
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
||||||
display: flex;
|
.dash-header h1 { font-size: 22px; font-weight: 700; color: #1e293b; }
|
||||||
justify-content: space-between;
|
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 28px;
|
|
||||||
}
|
|
||||||
.dash-header h1 {
|
|
||||||
font-size: 26px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1e293b;
|
|
||||||
}
|
|
||||||
.dash-actions { display: flex; gap: 10px; }
|
|
||||||
|
|
||||||
/* 统计卡片 */
|
|
||||||
.stats-row {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
||||||
gap: 16px;
|
|
||||||
margin-bottom: 28px;
|
|
||||||
}
|
|
||||||
.stat-card {
|
.stat-card {
|
||||||
background: rgba(255,255,255,0.9);
|
background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
|
||||||
backdrop-filter: blur(8px);
|
border-radius: 16px; padding: 16px; border: 1px solid rgba(255,255,255,0.6);
|
||||||
border-radius: 20px;
|
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
|
||||||
padding: 22px 24px;
|
|
||||||
border: 1px solid rgba(255,255,255,0.6);
|
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
|
|
||||||
}
|
|
||||||
.stat-card .stat-icon { font-size: 28px; margin-bottom: 8px; }
|
|
||||||
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1e293b; }
|
|
||||||
.stat-card .stat-label { font-size: 13px; color: #94a3b8; font-weight: 500; margin-top: 2px; }
|
|
||||||
|
|
||||||
/* 账号卡片网格 */
|
|
||||||
.account-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
||||||
gap: 18px;
|
|
||||||
}
|
}
|
||||||
|
.stat-card .stat-icon { font-size: 22px; margin-bottom: 4px; }
|
||||||
|
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
|
||||||
|
.stat-card .stat-label { font-size: 12px; color: #94a3b8; font-weight: 500; }
|
||||||
|
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
|
||||||
.account-card {
|
.account-card {
|
||||||
background: rgba(255,255,255,0.92);
|
background: rgba(255,255,255,0.92); backdrop-filter: blur(8px);
|
||||||
backdrop-filter: blur(8px);
|
border-radius: 16px; padding: 18px; border: 1px solid rgba(255,255,255,0.6);
|
||||||
border-radius: 20px;
|
box-shadow: 0 1px 3px rgba(0,0,0,0.04); cursor: pointer;
|
||||||
padding: 24px;
|
transition: all 0.2s; position: relative; overflow: hidden;
|
||||||
border: 1px solid rgba(255,255,255,0.6);
|
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.25s ease;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.account-card::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0; left: 0; right: 0;
|
|
||||||
height: 4px;
|
|
||||||
border-radius: 20px 20px 0 0;
|
|
||||||
}
|
}
|
||||||
|
.account-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 16px 16px 0 0; }
|
||||||
.account-card.status-active::before { background: linear-gradient(90deg, #10b981, #34d399); }
|
.account-card.status-active::before { background: linear-gradient(90deg, #10b981, #34d399); }
|
||||||
.account-card.status-pending::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
|
.account-card.status-pending::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
|
||||||
.account-card.status-invalid_cookie::before { background: linear-gradient(90deg, #ef4444, #f87171); }
|
.account-card.status-invalid_cookie::before { background: linear-gradient(90deg, #ef4444, #f87171); }
|
||||||
.account-card.status-banned::before { background: linear-gradient(90deg, #6b7280, #9ca3af); }
|
.account-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,0.1); }
|
||||||
|
.account-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
|
||||||
.account-card:hover {
|
|
||||||
transform: translateY(-4px);
|
|
||||||
box-shadow: 0 8px 30px rgba(99,102,241,0.12);
|
|
||||||
}
|
|
||||||
.account-card-top {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: flex-start;
|
|
||||||
margin-bottom: 14px;
|
|
||||||
}
|
|
||||||
.account-avatar {
|
.account-avatar {
|
||||||
width: 48px; height: 48px;
|
width: 40px; height: 40px; border-radius: 12px;
|
||||||
border-radius: 16px;
|
|
||||||
background: linear-gradient(135deg, #6366f1, #a855f7);
|
background: linear-gradient(135deg, #6366f1, #a855f7);
|
||||||
display: flex;
|
display: flex; align-items: center; justify-content: center;
|
||||||
align-items: center;
|
color: white; font-size: 16px; font-weight: 700; flex-shrink: 0;
|
||||||
justify-content: center;
|
|
||||||
color: white;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 700;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.account-name {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1e293b;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
.account-remark {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #94a3b8;
|
|
||||||
margin-bottom: 14px;
|
|
||||||
}
|
}
|
||||||
|
.account-name { font-size: 15px; font-weight: 700; color: #1e293b; word-break: break-all; }
|
||||||
|
.account-remark { font-size: 12px; color: #94a3b8; margin-top: 2px; }
|
||||||
.account-meta {
|
.account-meta {
|
||||||
display: flex;
|
display: flex; justify-content: space-between; align-items: center;
|
||||||
justify-content: space-between;
|
padding-top: 10px; border-top: 1px solid #f1f5f9;
|
||||||
align-items: center;
|
|
||||||
padding-top: 14px;
|
|
||||||
border-top: 1px solid #f1f5f9;
|
|
||||||
}
|
}
|
||||||
.account-date { font-size: 12px; color: #cbd5e1; }
|
.account-date { font-size: 11px; color: #cbd5e1; }
|
||||||
|
|
||||||
/* 删除按钮 */
|
|
||||||
.account-del-btn {
|
.account-del-btn {
|
||||||
width: 32px; height: 32px;
|
width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid #fecaca;
|
||||||
border-radius: 10px;
|
background: #fff; color: #ef4444; font-size: 12px; cursor: pointer;
|
||||||
border: 1.5px solid #fecaca;
|
display: flex; align-items: center; justify-content: center;
|
||||||
background: #fff;
|
|
||||||
color: #ef4444;
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: all 0.2s;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
.account-del-btn:hover {
|
.account-del-btn:hover { background: #fef2f2; }
|
||||||
background: #fef2f2;
|
.batch-bar {
|
||||||
border-color: #f87171;
|
background: rgba(255,255,255,0.9); border-radius: 14px; padding: 12px 16px;
|
||||||
|
margin-bottom: 14px; border: 1px solid rgba(255,255,255,0.6);
|
||||||
|
display: flex; justify-content: space-between; align-items: center; gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.batch-bar .info { font-size: 13px; color: #64748b; }
|
||||||
/* 空状态 */
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center; padding: 60px 20px; background: rgba(255,255,255,0.7);
|
||||||
padding: 80px 20px;
|
border-radius: 20px; border: 2px dashed #e2e8f0;
|
||||||
background: rgba(255,255,255,0.7);
|
|
||||||
border-radius: 24px;
|
|
||||||
border: 2px dashed #e2e8f0;
|
|
||||||
}
|
}
|
||||||
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
|
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
|
||||||
.empty-state p { color: #94a3b8; margin-bottom: 24px; font-size: 16px; }
|
.empty-state p { color: #94a3b8; margin-bottom: 20px; font-size: 15px; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
/* Cookie 批量验证 */
|
.stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
|
||||||
.batch-verify-bar {
|
.stat-card { padding: 12px; }
|
||||||
background: rgba(255,255,255,0.9);
|
.stat-card .stat-value { font-size: 20px; }
|
||||||
backdrop-filter: blur(8px);
|
.stat-card .stat-label { font-size: 11px; }
|
||||||
border-radius: 20px;
|
.account-grid { grid-template-columns: 1fr; }
|
||||||
padding: 16px 24px;
|
.batch-bar { flex-direction: column; align-items: stretch; text-align: center; }
|
||||||
margin-bottom: 20px;
|
.batch-bar .info { margin-bottom: 8px; }
|
||||||
border: 1px solid rgba(255,255,255,0.6);
|
.dash-header { flex-direction: column; gap: 10px; align-items: flex-start; }
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
.batch-verify-bar .info { font-size: 14px; color: #64748b; }
|
|
||||||
.batch-verify-bar .info strong { color: #1e293b; }
|
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="dash-header">
|
<div class="dash-header">
|
||||||
<h1>👋 控制台</h1>
|
<h1>👋 控制台</h1>
|
||||||
<div class="dash-actions">
|
<a href="{{ url_for('add_account') }}" class="btn btn-primary">+ 添加账号</a>
|
||||||
<a href="{{ url_for('add_account') }}" class="btn btn-primary">+ 添加账号</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if accounts %}
|
{% set sc = pagination.get('status_counts', {}) %}
|
||||||
<!-- 统计概览 -->
|
{% set total_accounts = pagination.get('total', 0) %}
|
||||||
|
{% set active_count = sc.get('active', 0) %}
|
||||||
|
{% set need_attention = sc.get('pending', 0) + sc.get('invalid_cookie', 0) %}
|
||||||
|
|
||||||
|
{% if total_accounts > 0 %}
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-icon">📊</div>
|
<div class="stat-icon">📊</div>
|
||||||
<div class="stat-value">{{ accounts|length }}</div>
|
<div class="stat-value">{{ total_accounts }}</div>
|
||||||
<div class="stat-label">账号总数</div>
|
<div class="stat-label">账号总数</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-icon">✅</div>
|
<div class="stat-icon">✅</div>
|
||||||
<div class="stat-value">{{ accounts|selectattr('status','equalto','active')|list|length }}</div>
|
<div class="stat-value">{{ active_count }}</div>
|
||||||
<div class="stat-label">正常运行</div>
|
<div class="stat-label">正常运行</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-icon">⚠️</div>
|
<div class="stat-icon">⚠️</div>
|
||||||
<div class="stat-value">{{ accounts|selectattr('status','equalto','pending')|list|length + accounts|selectattr('status','equalto','invalid_cookie')|list|length }}</div>
|
<div class="stat-value">{{ need_attention }}</div>
|
||||||
<div class="stat-label">需要关注</div>
|
<div class="stat-label">需要关注</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 批量操作栏 -->
|
<div class="batch-bar">
|
||||||
<div class="batch-verify-bar">
|
<div class="info">💡 可手动触发批量操作</div>
|
||||||
<div class="info">
|
<div style="display:flex; gap:8px; flex-wrap:wrap;">
|
||||||
💡 系统每天 <strong>23:50</strong> 自动批量验证 Cookie,也可手动触发
|
<button class="btn btn-secondary" id="batch-verify-btn" onclick="batchVerify()">🔍 批量验证</button>
|
||||||
</div>
|
|
||||||
<div style="display:flex; gap:10px;">
|
|
||||||
<button class="btn btn-secondary" id="batch-verify-btn" onclick="batchVerify()">🔍 批量验证 Cookie</button>
|
|
||||||
<button class="btn btn-primary" id="batch-signin-btn" onclick="batchSignin()">🚀 全部签到</button>
|
<button class="btn btn-primary" id="batch-signin-btn" onclick="batchSignin()">🚀 全部签到</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 账号卡片 -->
|
|
||||||
<div class="account-grid">
|
<div class="account-grid">
|
||||||
{% for account in accounts %}
|
{% for account in accounts %}
|
||||||
<div class="account-card status-{{ account.status }}" onclick="window.location.href='{{ url_for('account_detail', account_id=account.id) }}'">
|
<div class="account-card status-{{ account.status }}" onclick="window.location.href='{{ url_for('account_detail', account_id=account.id) }}'">
|
||||||
@@ -210,87 +123,88 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="account-meta">
|
<div class="account-meta">
|
||||||
<div>
|
<div>
|
||||||
{% if account.status == 'active' %}
|
{% if account.status == 'active' %}<span class="badge badge-success">正常</span>
|
||||||
<span class="badge badge-success">正常</span>
|
{% elif account.status == 'pending' %}<span class="badge badge-warning">待验证</span>
|
||||||
{% elif account.status == 'pending' %}
|
{% elif account.status == 'invalid_cookie' %}<span class="badge badge-danger">Cookie 失效</span>
|
||||||
<span class="badge badge-warning">待验证</span>
|
{% elif account.status == 'banned' %}<span class="badge badge-danger">已封禁</span>
|
||||||
{% elif account.status == 'invalid_cookie' %}
|
|
||||||
<span class="badge badge-danger">Cookie 失效</span>
|
|
||||||
{% elif account.status == 'banned' %}
|
|
||||||
<span class="badge badge-danger">已封禁</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex; align-items:center; gap:10px;">
|
<div style="display:flex; align-items:center; gap:8px;">
|
||||||
<span class="account-date">{{ account.created_at[:10] }}</span>
|
<span class="account-date">{{ account.created_at[:10] }}</span>
|
||||||
<button class="account-del-btn" title="删除账号" onclick="event.stopPropagation(); deleteAccount('{{ account.id }}', '{{ account.remark or account.weibo_user_id }}');">🗑</button>
|
<button class="account-del-btn" title="删除" onclick="event.stopPropagation(); deleteAccount('{{ account.id }}', '{{ account.remark or account.weibo_user_id }}');">🗑</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if pagination.get('total_pages', 0) > 1 %}
|
||||||
|
<div class="pagination">
|
||||||
|
{% set p = pagination.page %}
|
||||||
|
{% set tp = pagination.total_pages %}
|
||||||
|
{% if p > 1 %}
|
||||||
|
<a href="?page={{ p - 1 }}">‹ 上一页</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="disabled">‹ 上一页</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for i in range(max(1, p - 2), min(tp, p + 2) + 1) %}
|
||||||
|
{% if i == p %}<span class="active">{{ i }}</span>
|
||||||
|
{% else %}<a href="?page={{ i }}">{{ i }}</a>{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if p < tp %}
|
||||||
|
<a href="?page={{ p + 1 }}">下一页 ›</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="disabled">下一页 ›</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="empty-state">
|
<div class="empty-state">
|
||||||
<div class="empty-icon">📱</div>
|
<div class="empty-icon">📱</div>
|
||||||
<p>暂无账号,扫码添加你的微博账号开始自动签到</p>
|
<p>暂无账号,扫码添加你的微博账号开始自动签到</p>
|
||||||
<a href="{{ url_for('add_account') }}" class="btn btn-primary" style="font-size:16px; padding:14px 32px;">添加第一个账号</a>
|
<a href="{{ url_for('add_account') }}" class="btn btn-primary" style="padding:12px 28px;">添加第一个账号</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function deleteAccount(accountId, name) {
|
async function deleteAccount(id, name) {
|
||||||
if (!confirm(`确定要删除账号「${name}」吗?此操作不可恢复。`)) return;
|
if (!confirm(`确定要删除账号「${name}」吗?`)) return;
|
||||||
try {
|
const form = document.createElement('form');
|
||||||
const form = document.createElement('form');
|
form.method = 'POST';
|
||||||
form.method = 'POST';
|
form.action = `/accounts/${id}/delete`;
|
||||||
form.action = `/accounts/${accountId}/delete`;
|
document.body.appendChild(form);
|
||||||
document.body.appendChild(form);
|
form.submit();
|
||||||
form.submit();
|
|
||||||
} catch(e) {
|
|
||||||
alert('删除失败: ' + e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function batchVerify() {
|
async function batchVerify() {
|
||||||
const btn = document.getElementById('batch-verify-btn');
|
const btn = document.getElementById('batch-verify-btn');
|
||||||
btn.disabled = true;
|
btn.disabled = true; btn.textContent = '⏳ 验证中...';
|
||||||
btn.textContent = '⏳ 验证中...';
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch('/api/batch/verify', {method: 'POST'});
|
const resp = await fetch('/api/batch/verify', {method: 'POST'});
|
||||||
const data = await resp.json();
|
const data = await resp.json();
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
const r = data.data;
|
const r = data.data;
|
||||||
alert(`验证完成:${r.valid} 个有效,${r.invalid} 个失效,${r.errors} 个出错`);
|
alert(`验证完成:${r.valid} 有效,${r.invalid} 失效,${r.errors} 出错`);
|
||||||
} else {
|
} else { alert('验证失败: ' + (data.message || '未知错误')); }
|
||||||
alert('验证失败: ' + (data.message || '未知错误'));
|
} catch(e) { alert('请求失败: ' + e.message); }
|
||||||
}
|
btn.disabled = false; btn.textContent = '🔍 批量验证';
|
||||||
} catch(e) {
|
|
||||||
alert('请求失败: ' + e.message);
|
|
||||||
}
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '🔍 批量验证 Cookie';
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function batchSignin() {
|
async function batchSignin() {
|
||||||
const btn = document.getElementById('batch-signin-btn');
|
const btn = document.getElementById('batch-signin-btn');
|
||||||
if (!confirm('确定要对所有正常账号执行签到吗?')) return;
|
if (!confirm('确定要对所有正常账号执行签到吗?')) return;
|
||||||
btn.disabled = true;
|
btn.disabled = true; btn.textContent = '⏳ 签到中...';
|
||||||
btn.textContent = '⏳ 签到中...';
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch('/api/batch/signin', {method: 'POST'});
|
const resp = await fetch('/api/batch/signin', {method: 'POST'});
|
||||||
const data = await resp.json();
|
const data = await resp.json();
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
const r = data.data;
|
const r = data.data;
|
||||||
alert(`签到完成:${r.total_accounts} 个账号,${r.total_signed} 成功,${r.total_already} 已签,${r.total_failed} 失败`);
|
alert(`签到完成:${r.total_accounts} 个账号,${r.total_signed} 成功,${r.total_already} 已签,${r.total_failed} 失败`);
|
||||||
} else {
|
} else { alert('签到失败: ' + (data.message || '未知错误')); }
|
||||||
alert('签到失败: ' + (data.message || '未知错误'));
|
} catch(e) { alert('请求失败: ' + e.message); }
|
||||||
}
|
btn.disabled = false; btn.textContent = '🚀 全部签到';
|
||||||
} catch(e) {
|
|
||||||
alert('请求失败: ' + e.message);
|
|
||||||
}
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.textContent = '🚀 全部签到';
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user