feat: 登录验证 + 邀请码注册 + 用量监控后台

- 新增用户认证系统(登录/登出/邀请码注册)
- 新增管理后台(邀请码管理/用户管理/使用记录/用量统计)
- 合成接口加登录验证,每次调用记录用户和稿件内容
- SQLite存储用户数据和使用日志
- 默认admin账号: simonkoson

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
lanhao
2026-07-02 18:51:23 +08:00
parent 3b6019d0f2
commit 223761e717
10 changed files with 1304 additions and 27 deletions
+342
View File
@@ -370,4 +370,346 @@ body {
@media (max-width: 768px) {
.toolbar { flex-direction: column; gap: 12px; }
.param-controls { grid-template-columns: 1fr; }
}
/* ========== 登录页 ========== */
.auth-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
}
.auth-card {
background: #1e2438;
border-radius: 16px;
padding: 40px;
width: 100%;
max-width: 400px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.auth-header {
text-align: center;
margin-bottom: 30px;
}
.auth-header h1 {
color: #fff;
font-size: 24px;
margin-top: 12px;
}
.auth-header h1 span {
color: #00d4aa;
}
.auth-logo {
width: 48px;
height: 48px;
color: #00d4aa;
}
.auth-form h2 {
color: #ccc;
font-size: 18px;
margin-bottom: 20px;
text-align: center;
}
.form-group {
margin-bottom: 16px;
}
.form-group label {
display: block;
color: #999;
font-size: 13px;
margin-bottom: 6px;
}
.form-group input {
width: 100%;
padding: 10px 14px;
background: #151929;
border: 1px solid #333;
border-radius: 8px;
color: #fff;
font-size: 14px;
outline: none;
box-sizing: border-box;
}
.form-group input:focus {
border-color: #00d4aa;
}
.btn-full {
width: 100%;
margin-top: 10px;
}
.auth-switch {
text-align: center;
margin-top: 16px;
color: #999;
font-size: 13px;
}
.auth-switch a {
color: #00d4aa;
text-decoration: none;
}
.auth-error {
color: #ff6b6b;
text-align: center;
margin-top: 12px;
font-size: 13px;
min-height: 20px;
}
/* ========== 用户信息 ========== */
.user-info {
display: inline-flex;
align-items: center;
gap: 12px;
color: #ccc;
font-size: 13px;
margin-left: 12px;
}
.admin-link, .logout-link {
color: #00d4aa;
text-decoration: none;
font-size: 12px;
}
.logout-link {
color: #999;
}
.admin-link:hover, .logout-link:hover {
text-decoration: underline;
}
/* ========== 管理后台 ========== */
.admin-container {
min-height: 100vh;
background: #0d1117;
color: #e6e6e6;
padding: 20px 30px;
}
.admin-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid #2a2f3f;
}
.admin-header h1 {
font-size: 22px;
color: #fff;
}
.admin-nav {
display: flex;
gap: 10px;
}
.admin-tabs {
display: flex;
gap: 4px;
margin-bottom: 20px;
border-bottom: 2px solid #2a2f3f;
}
.tab-btn {
padding: 10px 20px;
background: transparent;
border: none;
color: #999;
cursor: pointer;
font-size: 14px;
border-bottom: 2px solid transparent;
margin-bottom: -2px;
}
.tab-btn.active {
color: #00d4aa;
border-bottom-color: #00d4aa;
}
.tab-panel {
display: none;
}
.tab-panel.active {
display: block;
}
.panel-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
flex-wrap: wrap;
gap: 10px;
}
.panel-toolbar h2 {
font-size: 18px;
color: #fff;
}
.invite-create {
display: flex;
gap: 10px;
}
.invite-create input {
padding: 8px 12px;
background: #151929;
border: 1px solid #333;
border-radius: 6px;
color: #fff;
font-size: 14px;
outline: none;
}
.invite-code {
background: #00d4aa22;
color: #00d4aa;
padding: 3px 8px;
border-radius: 4px;
font-size: 14px;
letter-spacing: 1px;
user-select: all;
}
.admin-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.admin-table th {
background: #1a1f35;
color: #999;
padding: 10px 12px;
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.admin-table td {
padding: 10px 12px;
border-bottom: 1px solid #1e2438;
vertical-align: top;
}
.admin-table tr:hover td {
background: #151929;
}
.text-cell {
max-width: 400px;
white-space: pre-wrap;
word-break: break-all;
font-size: 12px;
color: #ccc;
line-height: 1.5;
}
.nowrap {
white-space: nowrap;
}
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
}
.badge-active {
background: #00d4aa22;
color: #00d4aa;
}
.badge-used {
background: #ff6b6b22;
color: #ff6b6b;
}
.btn-sm {
padding: 4px 10px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
color: #fff;
background: #333;
}
.btn-sm.btn-primary {
background: #00d4aa;
color: #000;
}
.btn-sm.btn-danger {
background: #ff6b6b;
}
.log-filters {
display: flex;
gap: 10px;
align-items: center;
}
.log-filters select,
.log-filters input[type="date"] {
padding: 6px 10px;
background: #151929;
border: 1px solid #333;
border-radius: 6px;
color: #fff;
font-size: 13px;
outline: none;
}
.pagination {
margin-top: 16px;
display: flex;
gap: 4px;
}
.stats-summary {
display: flex;
gap: 20px;
margin-bottom: 24px;
}
.stat-card {
background: #1a1f35;
border-radius: 12px;
padding: 20px 30px;
text-align: center;
flex: 1;
}
.stat-card h3 {
font-size: 32px;
color: #00d4aa;
margin: 0;
}
.stat-card p {
color: #999;
margin: 8px 0 0;
font-size: 13px;
}