Files
nj/docs/opendesign/screens/templates.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

462 lines
16 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=390, height=844, initial-scale=1, viewport-fit=cover">
<title>暖记 — 模板画廊</title>
<link href="https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../css/tokens.css">
<link rel="stylesheet" href="../css/components.css">
<style>
body {
width: 390px;
height: 844px;
overflow: hidden;
background: var(--bg);
position: relative;
}
/* Global focus styles */
button:focus-visible, a:focus-visible, [role="tab"]:focus-visible {
box-shadow: 0 0 0 3px var(--focus-ring);
outline: none;
}
.content-area {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow-y: auto;
padding: 0 var(--space-5);
padding-top: calc(var(--safe-top) + var(--space-2));
padding-bottom: var(--safe-bottom);
scrollbar-width: none;
}
.content-area::-webkit-scrollbar { display: none; }
.top-bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--space-4);
}
.top-bar h2 {
font-family: var(--font-display);
font-size: var(--text-2xl);
font-weight: 700;
}
.back-btn {
min-width: 44px;
min-height: 44px;
border-radius: 50%;
border: none;
background: var(--surface);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
color: var(--fg);
box-shadow: var(--elev-soft);
}
.back-btn svg { width: 20px; height: 20px; }
/* View type */
.view-types {
display: flex;
gap: var(--space-2);
margin-bottom: var(--space-5);
}
.view-type-btn {
flex: 1;
padding: 12px;
min-height: 44px;
border-radius: var(--radius-md);
border: 2px solid var(--border);
background: var(--surface);
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
cursor: pointer;
transition: all var(--motion-fast);
}
.view-type-btn.active {
border-color: var(--accent);
background: var(--surface-warm);
}
.view-type-btn .icon {
font-size: 28px;
}
.view-type-btn .label {
font-size: var(--text-sm);
font-weight: 600;
color: var(--fg-2);
}
.view-type-btn.active .label { color: var(--accent); }
/* Template preview cards */
.template-list {
display: flex;
flex-direction: column;
gap: var(--space-4);
}
.template-card {
background: var(--surface);
border-radius: var(--radius-lg);
overflow: hidden;
box-shadow: var(--elev-soft);
border: 1px solid var(--border-soft);
cursor: pointer;
transition: all var(--motion-fast);
}
.template-card:hover { transform: translateY(-2px); box-shadow: var(--elev-medium); }
.template-preview {
height: 200px;
position: relative;
overflow: hidden;
}
/* Daily template previews */
.tpl-daily-simple {
background: linear-gradient(180deg, var(--bg), #FFE8D6);
padding: var(--space-5);
display: flex;
flex-direction: column;
}
.tpl-daily-simple .tpl-date {
font-family: var(--font-display);
font-size: var(--text-sm);
color: var(--accent);
font-weight: 600;
margin-bottom: var(--space-2);
}
.tpl-daily-simple .tpl-title-line {
width: 60%;
height: 8px;
background: var(--fg);
border-radius: 4px;
opacity: 0.2;
margin-bottom: var(--space-4);
}
.tpl-daily-simple .tpl-lines {
display: flex;
flex-direction: column;
gap: 8px;
}
.tpl-daily-simple .tpl-line {
height: 4px;
background: var(--fg);
border-radius: 2px;
opacity: 0.08;
}
.tpl-daily-photo {
background: linear-gradient(180deg, var(--secondary-soft), #E8F4ED);
padding: var(--space-5);
display: flex;
gap: var(--space-4);
}
.tpl-daily-photo .tpl-text-col {
flex: 1;
display: flex;
flex-direction: column;
gap: 6px;
padding-top: var(--space-4);
}
.tpl-daily-photo .tpl-text-col .line {
height: 4px;
background: var(--fg);
border-radius: 2px;
opacity: 0.1;
}
.tpl-daily-photo .tpl-photo-col {
width: 80px;
border-radius: var(--radius-sm);
background: rgba(255,255,255,0.5);
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
}
.tpl-daily-grid {
background: linear-gradient(180deg, var(--tertiary-soft), #FFF3E0);
padding: var(--space-5);
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--space-3);
}
.tpl-daily-grid .cell {
background: rgba(255,255,255,0.5);
border-radius: var(--radius-sm);
padding: var(--space-3);
font-size: 11px;
color: var(--muted);
}
.tpl-daily-grid .cell .emoji { font-size: 18px; margin-bottom: 4px; }
/* Weekly preview */
.tpl-weekly {
background: linear-gradient(180deg, var(--rose-soft), #FFF0F0);
padding: var(--space-4);
}
.tpl-weekly-row {
display: flex;
gap: 4px;
}
.tpl-weekly-cell {
flex: 1;
background: rgba(255,255,255,0.5);
border-radius: 6px;
padding: 6px 4px;
text-align: center;
font-size: 10px;
color: var(--muted);
}
.tpl-weekly-cell .day { font-weight: 600; color: var(--fg-2); margin-bottom: 4px; }
.tpl-weekly-cell .dot { width: 6px; height: 6px; border-radius: 50%; margin: 4px auto; }
/* Monthly preview */
.tpl-monthly {
background: linear-gradient(180deg, #E8F4ED, #F0FFF4);
padding: var(--space-4);
}
.tpl-monthly-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 2px;
}
.tpl-monthly-cell {
aspect-ratio: 1;
border-radius: 4px;
background: rgba(255,255,255,0.4);
display: flex;
align-items: center;
justify-content: center;
font-size: 8px;
color: var(--meta);
}
.template-meta {
padding: var(--space-4) var(--space-5);
display: flex;
justify-content: space-between;
align-items: center;
}
.template-meta .info h4 {
font-family: var(--font-display);
font-size: var(--text-base);
font-weight: 600;
margin-bottom: 2px;
}
.template-meta .info .desc {
font-size: var(--text-xs);
color: var(--muted);
}
.template-meta .use-btn {
padding: 8px 20px;
background: var(--accent);
color: var(--accent-on);
border: none;
border-radius: var(--radius-pill);
font-family: var(--font-display);
font-size: var(--text-sm);
font-weight: 600;
cursor: pointer;
min-height: 44px;
transition: all var(--motion-fast);
}
.template-meta .use-btn:hover { background: var(--accent-hover); }
.template-meta .use-btn:active { transform: scale(0.95); }
/* Tags */
.template-tags {
display: flex;
gap: var(--space-2);
padding: 0 var(--space-5) var(--space-4);
}
.tpl-tag {
padding: 3px 10px;
border-radius: var(--radius-pill);
font-size: 11px;
font-weight: 500;
}
</style>
</head>
<body>
<div class="content-area">
<!-- Top bar -->
<div class="top-bar anim-fade">
<button class="back-btn" aria-label="返回">
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M13 17l-6-6 6-6"/></svg>
</button>
<h2>模板画廊</h2>
<div style="width:44px"></div>
</div>
<!-- View type selector -->
<div class="view-types anim-fade" style="animation-delay: 0.1s">
<button class="view-type-btn active" aria-label="日视图模板">
<div class="icon">📝</div>
<div class="label">日视图</div>
</button>
<button class="view-type-btn" aria-label="周视图模板">
<div class="icon">📅</div>
<div class="label">周视图</div>
</button>
<button class="view-type-btn" aria-label="月视图模板">
<div class="icon">🗓</div>
<div class="label">月视图</div>
</button>
</div>
<!-- Template list -->
<div class="template-list">
<!-- Template 1: Student - Exam Prep -->
<div class="template-card anim-fade" style="animation-delay: 0.15s">
<div class="template-preview">
<div class="tpl-daily-simple" style="background: linear-gradient(180deg, var(--secondary-soft), #C8E6D0)">
<div class="tpl-date" style="color: #2D7D46">期末考试复习计划</div>
<div class="tpl-title-line" style="background: var(--secondary); opacity: 0.4"></div>
<div class="tpl-lines">
<div class="tpl-line" style="width: 100%; background: var(--secondary); opacity: 0.15"></div>
<div class="tpl-line" style="width: 85%; background: var(--secondary); opacity: 0.15"></div>
<div class="tpl-line" style="width: 90%; background: var(--secondary); opacity: 0.15"></div>
<div class="tpl-line" style="width: 70%; background: var(--secondary); opacity: 0.15"></div>
<div class="tpl-line" style="width: 95%; background: var(--secondary); opacity: 0.15"></div>
</div>
</div>
</div>
<div class="template-meta">
<div class="info">
<h4>期末考试复习计划</h4>
<div class="desc">按科目安排复习进度,记录重点难点</div>
</div>
<button class="use-btn" aria-label="使用期末考试复习计划模板">使用</button>
</div>
<div class="template-tags">
<span class="tpl-tag" style="background: var(--secondary-soft); color: #2D7D46">学生专属</span>
<span class="tpl-tag" style="background: var(--tertiary-soft); color: #B8860B">2.3k 人使用</span>
</div>
</div>
<!-- Template 2: Student - Course Schedule -->
<div class="template-card anim-fade" style="animation-delay: 0.2s">
<div class="template-preview">
<div class="tpl-daily-grid" style="background: linear-gradient(180deg, var(--tertiary-soft), #FFE8C0)">
<div class="cell" style="background: rgba(255,255,255,0.6)"><div class="emoji">📚</div>周一</div>
<div class="cell" style="background: rgba(255,255,255,0.6)"><div class="emoji">✏️</div>周二</div>
<div class="cell" style="background: rgba(255,255,255,0.6)"><div class="emoji">📖</div>周三</div>
<div class="cell" style="background: rgba(255,255,255,0.6)"><div class="emoji">🔬</div>周四</div>
</div>
</div>
<div class="template-meta">
<div class="info">
<h4>课程表周计划</h4>
<div class="desc">每周课程安排+作业追踪</div>
</div>
<button class="use-btn" aria-label="使用课程表周计划模板">使用</button>
</div>
<div class="template-tags">
<span class="tpl-tag" style="background: var(--secondary-soft); color: #2D7D46">学生专属</span>
<span class="tpl-tag" style="background: var(--tertiary-soft); color: #B8860B">5.1k 人使用</span>
</div>
</div>
<!-- Template 3: Student - Reading Notes -->
<div class="template-card anim-fade" style="animation-delay: 0.25s">
<div class="template-preview">
<div class="tpl-daily-photo" style="background: linear-gradient(180deg, var(--rose-soft), #FFE4E4)">
<div class="tpl-text-col">
<div class="line" style="width: 50%; height: 6px; background: var(--rose); opacity: 0.4"></div>
<div class="line" style="width: 100%; background: var(--rose); opacity: 0.2"></div>
<div class="line" style="width: 80%; background: var(--rose); opacity: 0.2"></div>
<div class="line" style="width: 90%; background: var(--rose); opacity: 0.2"></div>
<div class="line" style="width: 60%; background: var(--rose); opacity: 0.2"></div>
</div>
<div class="tpl-photo-col" style="background: rgba(255,255,255,0.5)">📖</div>
</div>
</div>
<div class="template-meta">
<div class="info">
<h4>读书笔记手账</h4>
<div class="desc">摘录+感悟+思维导图</div>
</div>
<button class="use-btn" aria-label="使用读书笔记手账模板">使用</button>
</div>
<div class="template-tags">
<span class="tpl-tag" style="background: var(--secondary-soft); color: #2D7D46">学生专属</span>
<span class="tpl-tag" style="background: var(--tertiary-soft); color: #B8860B">3.8k 人使用</span>
</div>
</div>
<!-- Template 4: Student - Campus Life -->
<div class="template-card anim-fade" style="animation-delay: 0.3s">
<div class="template-preview">
<div class="tpl-daily-simple" style="background: linear-gradient(180deg, #FFE8D6, #FFD4B8)">
<div class="tpl-date" style="color: var(--accent-active)">校园生活记录</div>
<div class="tpl-title-line" style="background: var(--accent); opacity: 0.4"></div>
<div class="tpl-lines">
<div class="tpl-line" style="width: 100%; background: var(--accent); opacity: 0.15"></div>
<div class="tpl-line" style="width: 85%; background: var(--accent); opacity: 0.15"></div>
<div class="tpl-line" style="width: 90%; background: var(--accent); opacity: 0.15"></div>
<div class="tpl-line" style="width: 70%; background: var(--accent); opacity: 0.15"></div>
<div class="tpl-line" style="width: 95%; background: var(--accent); opacity: 0.15"></div>
</div>
</div>
</div>
<div class="template-meta">
<div class="info">
<h4>校园生活记录</h4>
<div class="desc">社团活动+友谊+成长</div>
</div>
<button class="use-btn" aria-label="使用校园生活记录模板">使用</button>
</div>
<div class="template-tags">
<span class="tpl-tag" style="background: var(--secondary-soft); color: #2D7D46">学生专属</span>
<span class="tpl-tag" style="background: var(--tertiary-soft); color: #B8860B">1.9k 人使用</span>
</div>
</div>
<!-- Template 5: Monthly -->
<div class="template-card anim-fade" style="animation-delay: 0.35s">
<div class="template-preview">
<div class="tpl-monthly">
<div style="font-size:11px;color:var(--muted);margin-bottom:8px;font-weight:600">2026年5月</div>
<div class="tpl-monthly-grid">
<div class="tpl-monthly-cell"></div><div class="tpl-monthly-cell"></div><div class="tpl-monthly-cell"></div><div class="tpl-monthly-cell"></div><div class="tpl-monthly-cell"></div><div class="tpl-monthly-cell" style="background:var(--secondary-soft)">1</div><div class="tpl-monthly-cell" style="background:var(--secondary-soft)">2</div>
<div class="tpl-monthly-cell" style="background:var(--tertiary-soft)">3</div><div class="tpl-monthly-cell" style="background:var(--rose-soft)">4</div><div class="tpl-monthly-cell" style="background:var(--secondary-soft)">5</div><div class="tpl-monthly-cell" style="background:var(--secondary-soft)">6</div><div class="tpl-monthly-cell" style="background:#E0E0E0">7</div><div class="tpl-monthly-cell" style="background:var(--secondary-soft)">8</div><div class="tpl-monthly-cell" style="background:var(--rose-soft)">9</div>
</div>
</div>
</div>
<div class="template-meta">
<div class="info">
<h4>月历手账</h4>
<div class="desc">月度日历 + 心情色彩,一整月一目了然</div>
</div>
<button class="use-btn" aria-label="使用月历模板">使用</button>
</div>
<div class="template-tags">
<span class="tpl-tag" style="background: var(--border-soft); color: var(--muted)">月视图</span>
</div>
</div>
</div>
<div style="height: var(--space-8)"></div>
</div>
<div class="dynamic-island" aria-hidden="true"></div>
<div class="home-indicator" style="position:absolute;bottom:8px;left:50%;transform:translateX(-50%);z-index:101" aria-hidden="true"></div>
<script src="../js/theme-switcher.js"></script>
</body>
</html>