接口跑通,基础功能全部实现

This commit is contained in:
2026-03-16 16:14:08 +08:00
parent f81aec48ca
commit 2f2d5c3795
38 changed files with 3352 additions and 1754 deletions

View File

@@ -1,133 +1,76 @@
{% extends "base.html" %}
{% block title %}Register - Weibo-HotSign{% endblock %}
{% block title %}注册 - 微博超话签到{% endblock %}
{% block extra_css %}
<style>
.auth-container {
max-width: 400px;
margin: 60px auto;
}
.auth-container { max-width: 420px; margin: 60px auto; }
.auth-card {
background: white;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
padding: 40px;
background: rgba(255,255,255,0.92);
backdrop-filter: blur(12px);
border-radius: 24px;
box-shadow: 0 4px 24px rgba(0,0,0,0.06);
padding: 44px 36px;
border: 1px solid rgba(255,255,255,0.6);
}
.auth-title {
text-align: center;
font-size: 28px;
font-weight: bold;
margin-bottom: 30px;
color: #6366f1;
}
.password-strength {
display: flex;
gap: 4px;
margin-top: 8px;
}
.strength-bar {
flex: 1;
height: 4px;
background-color: #ddd;
border-radius: 2px;
}
.strength-bar.active {
background-color: #28a745;
}
.strength-text {
font-size: 12px;
color: #666;
margin-top: 8px;
}
.auth-link {
text-align: center;
margin-top: 20px;
color: #666;
}
.auth-link a {
color: #6366f1;
text-decoration: none;
font-weight: 500;
}
.auth-link a:hover {
text-decoration: underline;
text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 8px;
background: linear-gradient(135deg, #6366f1, #a855f7);
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-subtitle { text-align: center; color: #94a3b8; font-size: 15px; margin-bottom: 32px; }
.strength-bar-row { display: flex; gap: 4px; margin-top: 8px; }
.strength-bar { flex: 1; height: 4px; background: #e2e8f0; border-radius: 4px; transition: background 0.3s; }
.strength-bar.active { background: #10b981; }
.auth-link { text-align: center; margin-top: 24px; color: #94a3b8; font-size: 14px; }
.auth-link a { color: #6366f1; text-decoration: none; font-weight: 600; }
.auth-link a:hover { text-decoration: underline; }
</style>
{% endblock %}
{% block content %}
<div class="auth-container">
<div class="auth-card">
<h1 class="auth-title">Create Account</h1>
<form method="POST" id="registerForm">
<h1 class="auth-title">🔥 微博超话签到</h1>
<p class="auth-subtitle">创建你的账号</p>
<form method="POST">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
<label for="username">用户名</label>
<input type="text" id="username" name="username" required placeholder="请输入用户名">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
<label for="email">邮箱</label>
<input type="email" id="email" name="email" required placeholder="请输入邮箱">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required onchange="checkPasswordStrength()">
<div class="password-strength" id="strengthBars">
<div class="strength-bar"></div>
<div class="strength-bar"></div>
<div class="strength-bar"></div>
<div class="strength-bar"></div>
<div class="strength-bar"></div>
</div>
<div class="strength-text">
Must contain: uppercase, lowercase, number, special character, 8+ chars
<label for="password">密码</label>
<input type="password" id="password" name="password" required oninput="checkStrength()">
<div class="strength-bar-row">
<div class="strength-bar"></div><div class="strength-bar"></div>
<div class="strength-bar"></div><div class="strength-bar"></div><div class="strength-bar"></div>
</div>
<small style="color:#94a3b8; font-size:12px; margin-top:6px; display:block;">需包含大小写字母、数字、特殊字符,至少 8 位</small>
</div>
<div class="form-group">
<label for="confirm_password">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" required>
<label for="confirm_password">确认密码</label>
<input type="password" id="confirm_password" name="confirm_password" required placeholder="再次输入密码">
</div>
<button type="submit" class="btn btn-primary" style="width: 100%;">Register</button>
<button type="submit" class="btn btn-primary" style="width:100%; padding:14px; font-size:16px; border-radius:16px;">注册</button>
</form>
<div class="auth-link">
Already have an account? <a href="{{ url_for('login') }}">Login</a>
</div>
<div class="auth-link">已有账号?<a href="{{ url_for('login') }}">登录</a></div>
</div>
</div>
<script>
function checkPasswordStrength() {
const password = document.getElementById('password').value;
let strength = 0;
if (password.length >= 8) strength++;
if (/[a-z]/.test(password)) strength++;
if (/[A-Z]/.test(password)) strength++;
if (/\d/.test(password)) strength++;
if (/[!@#$%^&*]/.test(password)) strength++;
const bars = document.querySelectorAll('.strength-bar');
bars.forEach((bar, index) => {
if (index < strength) {
bar.classList.add('active');
} else {
bar.classList.remove('active');
}
function checkStrength() {
const pw = document.getElementById('password').value;
let s = 0;
if (pw.length >= 8) s++;
if (/[a-z]/.test(pw)) s++;
if (/[A-Z]/.test(pw)) s++;
if (/\d/.test(pw)) s++;
if (/[!@#$%^&*]/.test(pw)) s++;
document.querySelectorAll('.strength-bar').forEach((b, i) => {
b.classList.toggle('active', i < s);
});
}
</script>