Files
nj/docs/opendesign/screens/tablet/login.html
iven b320641d9c
Some checks failed
Main Merge / backend (push) Has been cancelled
Main Merge / frontend (push) Has been cancelled
fix(app): 全链路验证修复 — 编译错误/CORS/迁移/启动脚本
前端修复:
- calendar_page: 移除不存在的 JournalEntry.content getter
- responsive_scaffold: 移除不存在的 notchThickness 参数
- splash_page: SingleTickerProvider → TickerProvider (多 AnimationController)
- profile_page: UserRoleType.name → .code (修复运行时崩溃)
- 导入缺失的 user.dart

后端修复:
- class_service: generate_class_code 取 UUID 后6位(随机部分)避免碰撞
- diary_role_seed: 移除不存在的 id 列,使用复合主键 ON CONFLICT

基础设施:
- config/default.toml: CORS 改为通配符(开发模式)
- scripts/dev.sh: 统一启动脚本(自动清理端口)
- docs/opendesign/: Open Design 设计规格 HTML 原型稿

验证结果: flutter analyze 0 error, cargo test 77/77 通过, 17个页面全部渲染正常
2026-06-02 01:03:58 +08:00

623 lines
19 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=1024, height=768, initial-scale=1">
<title>暖记 — 平板端登录/注册</title>
<link rel="stylesheet" href="../css/tokens.css">
<link rel="stylesheet" href="../css/components.css">
<style>
body {
width: 1024px;
height: 768px;
overflow: hidden;
background: var(--bg);
font-family: var(--font-body);
display: flex;
align-items: center;
justify-content: center;
}
/* Focus styles */
button:focus-visible, a:focus-visible, input:focus-visible {
box-shadow: 0 0 0 3px var(--focus-ring);
outline: none;
}
/* Centered card */
.login-card {
display: flex;
width: 540px;
min-height: 480px;
background: var(--surface);
border-radius: var(--radius-md);
box-shadow: var(--elev-medium);
overflow: hidden;
position: relative;
}
/* Left brand panel */
.brand-panel {
width: 240px;
flex-shrink: 0;
background: linear-gradient(180deg, var(--bg) 0%, var(--tertiary-soft) 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--space-8);
position: relative;
overflow: hidden;
}
/* CSS-drawn notebook logo */
.logo-wrap {
width: 72px;
height: 72px;
position: relative;
margin-bottom: var(--space-5);
}
.logo-notebook {
width: 56px;
height: 64px;
border: 3px solid var(--accent);
border-radius: 6px 10px 10px 6px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: rgba(224, 122, 95, 0.06);
}
.logo-spine {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 3px;
height: 64px;
background: var(--accent);
border-radius: 2px;
}
.logo-heart {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -45%);
width: 16px;
height: 16px;
}
.logo-heart::before {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 16px;
height: 16px;
background: var(--accent);
clip-path: path('M8 14C8 14 1 9.5 1 5.5C1 3 3 1 5.5 1C6.8 1 7.8 1.6 8 2.5C8.2 1.6 9.2 1 10.5 1C13 1 15 3 15 5.5C15 9.5 8 14 8 14Z');
transform: translate(-50%, -50%);
}
.brand-title {
font-family: var(--font-display);
font-size: var(--text-2xl);
font-weight: 700;
color: var(--fg);
margin-bottom: var(--space-2);
}
.brand-tagline {
font-family: var(--font-handwritten);
font-size: var(--text-md);
color: var(--accent);
font-weight: 500;
text-align: center;
}
/* Decorative elements */
.deco {
position: absolute;
pointer-events: none;
opacity: 0.15;
}
.deco-dot1 {
width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
top: 40px; left: 30px;
}
.deco-dot2 {
width: 6px; height: 6px; border-radius: 50%; background: var(--secondary);
top: 70px; right: 30px;
}
.deco-dot3 {
width: 10px; height: 10px; border-radius: 50%; background: var(--tertiary);
bottom: 60px; left: 40px;
}
.deco-wave {
bottom: 40px; right: 30px;
}
.deco-wave svg { width: 30px; height: 12px; }
.deco-flower {
top: 120px; left: 20px;
width: 14px; height: 14px;
}
.deco-flower::before {
content: '';
display: block;
width: 14px; height: 14px;
background: var(--rose);
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
/* Right form panel */
.form-panel {
flex: 1;
display: flex;
flex-direction: column;
padding: var(--space-10) var(--space-8);
}
.form-title {
font-family: var(--font-display);
font-size: var(--text-xl);
font-weight: 700;
color: var(--fg);
text-align: center;
margin-bottom: var(--space-6);
}
/* Input group */
.input-group {
position: relative;
margin-bottom: var(--space-4);
}
.input-group .input-icon {
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
width: 20px;
height: 20px;
color: var(--muted);
pointer-events: none;
display: flex;
align-items: center;
justify-content: center;
}
.input-group input {
width: 100%;
height: 48px;
padding: 0 16px 0 46px;
border: 1.5px solid var(--border);
border-radius: var(--radius-pill);
font-family: var(--font-body);
font-size: var(--text-sm);
color: var(--fg);
background: var(--surface);
transition: border-color var(--motion-fast) var(--ease-standard);
}
.input-group input::placeholder {
color: var(--meta);
}
.input-group input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--shadow-input-focus);
}
/* Verification code */
.input-group.has-action input {
padding-right: 110px;
}
.input-group .input-action {
position: absolute;
right: 6px;
top: 50%;
transform: translateY(-50%);
padding: 6px 12px;
background: none;
border: none;
font-family: var(--font-body);
font-size: var(--text-xs);
font-weight: 600;
color: var(--accent);
cursor: pointer;
min-height: 36px;
border-radius: var(--radius-pill);
transition: background var(--motion-fast);
}
.input-group .input-action:hover {
background: var(--surface-warm);
}
/* Password toggle */
.input-group.has-toggle input {
padding-right: 50px;
}
.input-group .toggle-password {
position: absolute;
right: 14px;
top: 50%;
transform: translateY(-50%);
width: 24px;
height: 24px;
background: none;
border: none;
color: var(--muted);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
min-height: 44px;
min-width: 44px;
border-radius: 50%;
}
.input-group .toggle-password:hover { color: var(--fg); }
.input-group .toggle-password svg { width: 20px; height: 20px; }
/* Agreement */
.agreement {
display: flex;
align-items: flex-start;
gap: var(--space-2);
margin-bottom: var(--space-4);
font-size: var(--text-xs);
color: var(--muted);
line-height: 1.4;
}
.agreement input[type="checkbox"] {
width: 16px; height: 16px;
accent-color: var(--accent);
margin-top: 1px;
flex-shrink: 0;
cursor: pointer;
}
.agreement a {
color: var(--accent);
text-decoration: none;
font-weight: 500;
}
.agreement a:focus-visible {
box-shadow: 0 0 0 3px var(--focus-ring);
outline: none;
border-radius: 2px;
}
/* Submit button */
.btn-login {
width: 100%;
min-height: 48px;
border: none;
border-radius: var(--radius-pill);
background: var(--accent);
color: var(--bg);
font-family: var(--font-display);
font-size: var(--text-md);
font-weight: 700;
cursor: pointer;
transition: all var(--motion-fast) var(--ease-standard);
margin-bottom: var(--space-4);
}
.btn-login:hover {
background: var(--accent-hover);
transform: translateY(-1px);
box-shadow: 0 4px 16px var(--shadow-accent-hover);
}
.btn-login:active {
background: var(--accent-active);
transform: scale(0.98);
}
/* Divider */
.divider {
display: flex;
align-items: center;
gap: var(--space-3);
margin-bottom: var(--space-4);
color: var(--meta);
font-size: var(--text-xs);
}
.divider::before,
.divider::after {
content: '';
flex: 1;
height: 1px;
background: var(--border);
}
/* Social buttons */
.social-row {
display: flex;
justify-content: center;
gap: var(--space-4);
margin-bottom: var(--space-4);
}
.social-btn {
width: 48px;
height: 48px;
border-radius: 50%;
border: 1.5px solid var(--border);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all var(--motion-fast) var(--ease-standard);
background: var(--surface);
}
.social-btn:hover {
transform: translateY(-2px);
box-shadow: var(--elev-soft);
}
.social-btn:active { transform: scale(0.95); }
.social-btn svg { width: 24px; height: 24px; }
.social-btn.wechat { background: #07C160; border-color: #07C160; }
.social-btn.wechat:hover { background: #06AD56; border-color: #06AD56; }
.social-btn.apple { background: #1D1D1F; border-color: #1D1D1F; }
.social-btn.apple:hover { background: #333; border-color: #333; }
.social-btn.google { background: var(--surface); }
/* Bottom link */
.bottom-link {
text-align: center;
font-size: var(--text-xs);
color: var(--muted);
margin-top: auto;
}
.bottom-link a {
color: var(--accent);
text-decoration: none;
font-weight: 600;
cursor: pointer;
background: none;
border: none;
font-size: inherit;
font-family: inherit;
}
.bottom-link a:hover { text-decoration: underline; }
/* Version */
.version {
position: absolute;
bottom: var(--space-4);
left: 50%;
transform: translateX(-50%);
font-size: var(--text-xs);
color: var(--meta);
}
/* State toggling */
.register-fields { display: none; }
.is-register .register-fields { display: block; }
.is-register .login-only { display: none; }
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.anim-fade { animation: fadeIn 0.4s var(--ease-standard) both; }
</style>
</head>
<body>
<!-- Centered login card -->
<div class="login-card anim-fade">
<!-- Left: Brand panel -->
<div class="brand-panel">
<div class="deco deco-dot1" aria-hidden="true"></div>
<div class="deco deco-dot2" aria-hidden="true"></div>
<div class="deco deco-dot3" aria-hidden="true"></div>
<div class="deco deco-flower" aria-hidden="true"></div>
<div class="deco deco-wave" aria-hidden="true">
<svg viewBox="0 0 30 12" fill="none" stroke="var(--accent)" stroke-width="2" stroke-linecap="round">
<path d="M2 8 Q8 2, 15 8 Q22 14, 28 8"/>
</svg>
</div>
<div class="logo-wrap" aria-hidden="true">
<div class="logo-notebook"></div>
<div class="logo-spine"></div>
<div class="logo-heart"></div>
</div>
<div class="brand-title">暖记</div>
<div class="brand-tagline">用温暖记录每一天</div>
</div>
<!-- Right: Form panel -->
<div class="form-panel" id="formArea">
<h1 class="form-title" id="formTitle">欢迎回来</h1>
<form id="loginForm" autocomplete="on" novalidate>
<!-- Register: nickname -->
<div class="register-fields">
<div class="input-group">
<span class="input-icon" aria-hidden="true">
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
<circle cx="10" cy="7" r="4"/><path d="M3 18c0-3.3 3.1-6 7-6s7 2.7 7 6"/>
</svg>
</span>
<input type="text" id="nickname" name="nickname" placeholder="请输入昵称" autocomplete="nickname" aria-label="昵称">
</div>
</div>
<!-- Phone -->
<div class="input-group">
<span class="input-icon" aria-hidden="true">
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
<rect x="5" y="2" width="10" height="16" rx="2"/><line x1="8" y1="15" x2="12" y2="15"/>
</svg>
</span>
<input type="tel" id="phone" name="phone" placeholder="请输入手机号" autocomplete="tel" pattern="[0-9]*" aria-label="手机号">
</div>
<!-- Register: password -->
<div class="register-fields">
<div class="input-group has-toggle">
<span class="input-icon" aria-hidden="true">
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
<rect x="3" y="9" width="14" height="9" rx="2"/><path d="M6 9V6a4 4 0 018 0v3"/>
</svg>
</span>
<input type="password" id="regPassword" name="password" placeholder="请输入密码" autocomplete="new-password" aria-label="密码">
<button type="button" class="toggle-password" aria-label="显示密码" onclick="togglePwd('regPassword', this)">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
</div>
<!-- Verification code -->
<div class="input-group has-action">
<span class="input-icon" aria-hidden="true">
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
<rect x="2" y="4" width="16" height="12" rx="2"/><path d="M6 8v4M10 7v6M14 8v4"/>
</svg>
</span>
<input type="tel" id="code" name="code" placeholder="请输入验证码" autocomplete="one-time-code" pattern="[0-9]*" aria-label="验证码">
<button type="button" class="input-action" aria-label="获取验证码" id="getCodeBtn" onclick="sendCode()">获取验证码</button>
</div>
<!-- Register: agreement -->
<div class="register-fields">
<label class="agreement">
<input type="checkbox" id="agreement" aria-label="同意用户协议">
<span>我已阅读并同意<a href="#" onclick="return false">《用户协议》</a><a href="#" onclick="return false">《隐私政策》</a></span>
</label>
</div>
<!-- Submit -->
<button type="submit" class="btn-login" id="submitBtn" aria-label="登录">登录</button>
</form>
<!-- Divider -->
<div class="divider">其他登录方式</div>
<!-- Social buttons -->
<div class="social-row">
<button type="button" class="social-btn wechat" aria-label="微信登录">
<svg viewBox="0 0 28 28" fill="none">
<path d="M19.1 12.5c-.2-3.3-3.2-5.9-6.8-5.9-3.8 0-6.9 2.8-6.9 6.3 0 1.8.9 3.4 2.3 4.5l-.6 1.8 2.1-1.1c.7.2 1.5.3 2.3.3h.4c-.1-.4-.2-.8-.2-1.2.1-2.6 2.7-4.7 5.9-4.7h.2c.1-.1.2-.1.3 0z" fill="#FFF"/>
<path d="M11.6 11.5c-.5 0-1-.4-1-1s.4-1 1-1 1 .4 1 1-.5 1-1 1zM14.8 10.5c-.5 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.5-1-1-1z" fill="#07C160"/>
<path d="M25.5 16.8c0-2.9-2.9-5.3-6.3-5.3s-6.3 2.4-6.3 5.3 2.9 5.3 6.3 5.3c.7 0 1.4-.1 2-.3l1.7.9-.5-1.5c1.3-1 2.1-2.5 2.1-4.1 0 .1 0-.1 0-.3zm-8.6-1c-.4 0-.8-.3-.8-.8s.3-.8.8-.8.8.3.8.8-.4.8-.8.8zm4.6 0c-.4 0-.8-.3-.8-.8s.3-.8.8-.8.8.3.8.8-.4.8-.8.8z" fill="#FFF"/>
</svg>
</button>
<button type="button" class="social-btn apple" aria-label="Apple登录">
<svg viewBox="0 0 28 28" fill="#FFF">
<path d="M20.2 14.3c0-2 1.2-3.1 1.3-3.2-0.7-1-1.8-1.6-3-1.6-1.3 0-2 .8-2.7.8-.7 0-1.4-.8-2.5-.8-1.7 0-3.5 1.4-3.5 4.1 0 1.6.6 3.3 1.4 4.5.7 1 1.4 1.8 2.3 1.8.9 0 1.3-.7 2.5-.7 1.2 0 1.5.7 2.5.7.9 0 1.6-.8 2.2-1.7.4-.6.7-1.2.9-1.9-2-.8-2.4-3.8-.4-5zm-1.8-3.3c.5-.6.9-1.4.8-2.2-.8 0-1.8.5-2.3 1.2-.5.6-.9 1.4-.8 2.2.8 0 1.7-.5 2.3-1.2z"/>
</svg>
</button>
<button type="button" class="social-btn google" aria-label="Google登录">
<svg viewBox="0 0 28 28">
<path d="M14 11.5v5.2h7.3c-.3 1.7-1.3 3.1-2.7 4.1l4.4 3.4c2.6-2.4 4-5.9 4-10.1 0-1-.1-1.9-.3-2.8H14z" fill="#4285F4"/>
<path d="M6.3 16.4c-.4-1-.6-2.2-.6-3.4s.2-2.3.6-3.4L1.9 6.2C.7 8.5 0 11.2 0 14s.7 5.5 1.9 7.8l4.4-3.4z" fill="#FBBC05"/>
<path d="M14 28c3.7 0 6.8-1.2 9.1-3.3l-4.4-3.4c-1.2.8-2.8 1.3-4.7 1.3-3.6 0-6.7-2.4-7.8-5.7l-4.4 3.4C4.2 24.7 8.7 28 14 28z" fill="#34A853"/>
<path d="M14 5.6c2 0 3.9.7 5.3 2l4-4C20.8 1.2 17.7 0 14 0 8.7 0 4.2 3.3 2.1 8.1l4.4 3.4c1.1-3.3 4.2-5.9 7.5-5.9z" fill="#EA4335"/>
</svg>
</button>
</div>
<!-- Bottom link -->
<div class="bottom-link">
<span class="login-only">还没有账号?</span>
<a href="#" id="toggleLink" role="button" aria-label="切换到注册">立即注册</a>
</div>
</div>
<!-- Version -->
<div class="version" aria-hidden="true">v1.0.0</div>
</div>
<script>
(function() {
var isRegister = false;
var formArea = document.getElementById('formArea');
var formTitle = document.getElementById('formTitle');
var submitBtn = document.getElementById('submitBtn');
var toggleLink = document.getElementById('toggleLink');
var phoneInput = document.getElementById('phone');
phoneInput.addEventListener('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
});
var codeInput = document.getElementById('code');
codeInput.addEventListener('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
});
toggleLink.addEventListener('click', function(e) {
e.preventDefault();
isRegister = !isRegister;
if (isRegister) {
formArea.classList.add('is-register');
formTitle.textContent = '创建账号';
submitBtn.textContent = '注册';
submitBtn.setAttribute('aria-label', '注册');
toggleLink.textContent = '立即登录';
toggleLink.setAttribute('aria-label', '切换到登录');
toggleLink.previousElementSibling.textContent = '已有账号?';
} else {
formArea.classList.remove('is-register');
formTitle.textContent = '欢迎回来';
submitBtn.textContent = '登录';
submitBtn.setAttribute('aria-label', '登录');
toggleLink.textContent = '立即注册';
toggleLink.setAttribute('aria-label', '切换到注册');
toggleLink.previousElementSibling.textContent = '还没有账号?';
}
});
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();
});
})();
function togglePwd(inputId, btn) {
var input = document.getElementById(inputId);
if (input.type === 'password') {
input.type = 'text';
btn.setAttribute('aria-label', '隐藏密码');
btn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>';
} else {
input.type = 'password';
btn.setAttribute('aria-label', '显示密码');
btn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>';
}
}
function sendCode() {
var btn = document.getElementById('getCodeBtn');
var seconds = 60;
btn.disabled = true;
btn.style.opacity = '0.6';
btn.textContent = seconds + 's';
var timer = setInterval(function() {
seconds--;
if (seconds <= 0) {
clearInterval(timer);
btn.disabled = false;
btn.style.opacity = '1';
btn.textContent = '获取验证码';
} else {
btn.textContent = seconds + 's';
}
}, 1000);
}
</script>
<script src="../../js/theme-switcher.js"></script>
</body>
</html>