244 lines
7.2 KiB
HTML
244 lines
7.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>用户登录 - JieXi Pro</title>
|
|
<link rel="stylesheet" href="/static/css/ui-components.css">
|
|
<style>
|
|
body {
|
|
background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
.auth-container {
|
|
background: rgba(255, 255, 255, 0.9);
|
|
backdrop-filter: blur(20px);
|
|
border-radius: 24px;
|
|
padding: 3rem;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
|
|
width: 100%;
|
|
max-width: 450px;
|
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
.auth-header {
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.auth-title {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.auth-subtitle {
|
|
color: var(--secondary-500);
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
color: var(--secondary-700);
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 0.875rem 1rem;
|
|
font-size: 0.9375rem;
|
|
border: 2px solid transparent;
|
|
border-radius: 12px;
|
|
background: #f1f5f9;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.form-input:focus {
|
|
outline: none;
|
|
background: white;
|
|
border-color: var(--primary-500);
|
|
box-shadow: 0 0 0 4px var(--primary-100);
|
|
}
|
|
|
|
.form-footer {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.remember-me {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.875rem;
|
|
color: var(--secondary-600);
|
|
}
|
|
|
|
.forgot-link {
|
|
font-size: 0.875rem;
|
|
color: var(--primary-600);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.forgot-link:hover {
|
|
color: var(--primary-700);
|
|
}
|
|
|
|
.submit-btn {
|
|
width: 100%;
|
|
padding: 1rem;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
border-radius: 12px;
|
|
background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
|
|
color: white;
|
|
border: none;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
|
|
}
|
|
|
|
.submit-btn:hover:not(:disabled) {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
|
|
}
|
|
|
|
.submit-btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.auth-footer {
|
|
text-align: center;
|
|
margin-top: 1.5rem;
|
|
padding-top: 1.5rem;
|
|
border-top: 1px solid var(--secondary-200);
|
|
}
|
|
|
|
.auth-link {
|
|
color: var(--primary-600);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: color 0.2s;
|
|
}
|
|
|
|
.auth-link:hover {
|
|
color: var(--primary-700);
|
|
}
|
|
|
|
.back-home {
|
|
display: inline-block;
|
|
margin-top: 1rem;
|
|
color: var(--secondary-500);
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.back-home:hover {
|
|
color: var(--secondary-700);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="auth-container">
|
|
<div class="auth-header">
|
|
<h1 class="auth-title">欢迎回来</h1>
|
|
<p class="auth-subtitle">登录您的账号继续使用</p>
|
|
</div>
|
|
|
|
<form id="loginForm">
|
|
<div class="form-group">
|
|
<label class="form-label">邮箱地址</label>
|
|
<input type="email" id="email" class="form-input" placeholder="your@email.com" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">密码</label>
|
|
<input type="password" id="password" class="form-input" placeholder="请输入密码" required>
|
|
</div>
|
|
|
|
<div class="form-footer">
|
|
<label class="remember-me">
|
|
<input type="checkbox" id="rememberMe">
|
|
<span>记住我</span>
|
|
</label>
|
|
<a href="#" class="forgot-link" onclick="showForgotPassword(); return false;">忘记密码?</a>
|
|
</div>
|
|
|
|
<button type="submit" class="submit-btn">立即登录</button>
|
|
</form>
|
|
|
|
<div class="auth-footer">
|
|
<span class="text-muted text-sm">还没有账号?</span>
|
|
<a href="/auth/register" class="auth-link">立即注册</a>
|
|
<br>
|
|
<a href="/" class="back-home">← 返回首页</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/static/js/ui-components.js"></script>
|
|
<script>
|
|
function showForgotPassword() {
|
|
UI.notify('密码重置功能开发中...', 'info');
|
|
}
|
|
|
|
document.getElementById('loginForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
|
|
const email = document.getElementById('email').value.trim();
|
|
const password = document.getElementById('password').value;
|
|
|
|
if (!email || !password) {
|
|
UI.notify('请填写完整信息', 'warning');
|
|
return;
|
|
}
|
|
|
|
const submitBtn = e.target.querySelector('.submit-btn');
|
|
submitBtn.disabled = true;
|
|
submitBtn.textContent = '登录中...';
|
|
|
|
try {
|
|
const response = await fetch('/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email, password })
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
UI.notify('登录成功!即将跳转...', 'success');
|
|
setTimeout(() => {
|
|
window.location.href = '/';
|
|
}, 1000);
|
|
} else {
|
|
UI.notify(result.message || '登录失败', 'error');
|
|
submitBtn.disabled = false;
|
|
submitBtn.textContent = '立即登录';
|
|
}
|
|
} catch (error) {
|
|
UI.notify('网络错误,请稍后重试', 'error');
|
|
submitBtn.disabled = false;
|
|
submitBtn.textContent = '立即登录';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|