- 创建 SVG 格式 favicon(蓝色文档+翻译箭头+中文标记) - 在所有前台页面添加 favicon:index, login, register, history, pricing, translation - 在所有后台管理页面添加 favicon
81 lines
2.8 KiB
HTML
81 lines
2.8 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>登录 - PDF翻译助手</title>
|
|
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="/static/css/style.css" rel="stylesheet">
|
|
</head>
|
|
<body class="bg-light">
|
|
<nav class="navbar navbar-dark bg-primary">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/">📄 PDF翻译助手</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="auth-form">
|
|
<h3 class="text-center mb-4">登录</h3>
|
|
|
|
<form id="loginForm">
|
|
<div class="mb-3">
|
|
<label class="form-label">用户名</label>
|
|
<input type="text" class="form-control" id="username" name="username" required>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">密码</label>
|
|
<input type="password" class="form-control" id="password" name="password" required>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary w-100">登录</button>
|
|
</form>
|
|
|
|
<hr>
|
|
|
|
<p class="text-center text-muted">
|
|
还没有账号? <a href="/register">立即注册</a>
|
|
</p>
|
|
|
|
<div class="alert alert-info mt-3">
|
|
<strong>注册福利:</strong>
|
|
<ul class="mb-0">
|
|
<li>每日翻译次数提升至10次</li>
|
|
<li>单文件最大50页</li>
|
|
<li>翻译历史记录</li>
|
|
<li>支持重新翻译</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('loginForm').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
|
|
const username = document.getElementById('username').value;
|
|
const password = document.getElementById('password').value;
|
|
|
|
try {
|
|
const response = await fetch('/login', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({username, password})
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (!response.ok) {
|
|
throw new Error(result.error || '登录失败');
|
|
}
|
|
|
|
// 登录成功,跳转首页
|
|
window.location.href = '/';
|
|
|
|
} catch (error) {
|
|
alert('登录失败: ' + error.message);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |