UI 打磨与功能调整:中国生长标准、日历合并、弹窗去框、轮播记忆位置、小环居中、后台补卡与重置保留

This commit is contained in:
2026-08-12 15:29:52 +08:00
parent 0e6065897b
commit ddd892dd8b
6 changed files with 325 additions and 163 deletions
+56 -26
View File
@@ -19,8 +19,8 @@
<option value="F" {% if child.gender == 'F' %}selected{% endif %}></option>
</select>
</label>
<label>学期起<input type="date" name="term_start" value="{{ child.term_start or '' }}"></label>
<label>学期止<input type="date" name="term_end" value="{{ child.term_end or '' }}"></label>
<label>开始日期<input type="date" name="term_start" value="{{ child.term_start or '' }}"></label>
<label>结束日期<input type="date" name="term_end" value="{{ child.term_end or '' }}"></label>
<label>进度环轮播(秒)<input name="ring_sec" type="number" value="{{ child.ring_sec or 6 }}" style="width:80px" min="2"></label>
<label>学科轮播(秒)<input name="carousel_sec" type="number" value="{{ child.carousel_sec or 8 }}" style="width:80px" min="2"></label>
<label>默认主题
@@ -33,23 +33,10 @@
<button>保存</button>
</form>
{% if age is not none %}
<p class="sub">当前年龄约 <b>{{ '%.1f'|format(age) }}</b> 岁 · 标准身高 <b>{{ std_h }} cm</b> · 标准体重 <b>{{ std_w }} kg</b>WHO 中位参考</p>
<p class="sub">当前年龄约 <b>{{ '%.1f'|format(age) }}</b> 岁 · 标准身高 <b>{{ std_h }} cm</b> · 标准体重 <b>{{ std_w }} kg</b>中国儿童生长标准 WS/T 612-2018</p>
{% endif %}
</section>
<section class="card">
<h2>🎯 年度目标</h2>
<form method="post" action="{{ url_for('admin_goal_update') }}" class="row">
<label>读书目标(本/年)
<input name="book_target" type="number" value="{{ goal.book_target }}" style="width:90px">
</label>
<label>运动目标(分钟/周)
<input name="week_exercise_min" type="number" value="{{ goal.week_exercise_min }}" style="width:90px">
</label>
<button>保存</button>
</form>
</section>
<section class="card">
<h2>📈 健康记录(可补历史数据)</h2>
<p class="sub">填入任意日期即可补录历史身高体重;仪表盘「健康综合」会展示最近两年。</p>
@@ -165,17 +152,60 @@
<section class="card">
<h2>🧹 数据管理</h2>
<p class="sub">徽章由进度/读书/运动实时派生,重置或新学期后会自动重新累积,无需手动发徽章。</p>
<div class="row" style="gap:12px;flex-wrap:wrap">
<form method="post" action="{{ url_for('admin_reset') }}"
onsubmit="return confirm('确定清空全部进度 / 打卡 / 健康记录?学科与书目结构保留。此操作不可撤销!')">
<button class="mini danger">🗑️ 重置全部数据</button>
</form>
<form method="post" action="{{ url_for('admin_new_term') }}"
onsubmit="return confirm('开启新学期:进度重置为未开始、清空打卡,并把学期起设为今天。确定?')">
<button class="mini">🎒 开启新学期</button>
</form>
<p class="sub">徽章由进度/读书/运动实时派生,重置后会自动重新累积,无需手动发徽章。</p>
<form method="post" action="{{ url_for('admin_reset') }}"
onsubmit="return confirm('确定重置数据?未勾选保留的项将被清空,此操作不可撤销!')">
<div class="row" style="gap:18px;flex-wrap:wrap;align-items:flex-start">
<label class="chk"><input type="checkbox" name="keep_health" value="1"> 保留健康记录(身高/体重/睡眠/运动)</label>
<label class="chk"><input type="checkbox" name="keep_bookshelf" value="1"> 保留书架(书目与阅读记录)</label>
</div>
<div class="row" style="margin-top:12px">
<button class="mini danger">🗑️ 重置数据</button>
</div>
</form>
</section>
<section class="card">
<h2>⚡ 浮动打卡项(可增删改)</h2>
<p class="sub">仪表盘右下角的竖排打卡按钮;这里新增 / 改名 / 删除,仪表盘即时更新。</p>
<form method="post" action="{{ url_for('admin_checkin_add') }}" class="row wrap">
<input name="key" placeholder="标识,如 walk" required style="width:120px">
<input name="icon" placeholder="图标" style="width:60px" value="🚶">
<input name="name" placeholder="按钮名,如 走路打卡" required>
<input name="done_name" placeholder="完成后文案,如 已走路" style="width:120px">
<button>加一项</button>
</form>
{% for k in checkin_kinds %}
<div class="admin-subject">
<div class="admin-subject-head">
<span>{{ k.icon }} <b>{{ k.name }}</b> <span class="muted">{{ k.key }} · 完成显示「{{ k.done_name }}」)</span></span>
<span class="admin-subject-controls">
<form method="post" action="{{ url_for('admin_checkin_update', kid=k.id) }}" class="inline row" style="margin:0">
<input name="icon" value="{{ k.icon }}" style="width:46px">
<input name="name" value="{{ k.name }}" style="width:120px">
<input name="done_name" value="{{ k.done_name }}" style="width:110px">
<button class="mini">保存</button>
</form>
<form method="post" action="{{ url_for('admin_checkin_delete', kid=k.id) }}" class="inline"
onsubmit="return confirm('删除该打卡项及其打卡记录?')">
<button class="mini danger">删除</button>
</form>
</span>
</div>
</div>
{% endfor %}
</section>
<section class="card">
<h2>🗓️ 补卡(补录历史打卡)</h2>
<p class="sub">为过去的某一天补记一次打卡;同一天同一项目不会重复记。仪表盘日历会显示该日已打卡。</p>
<form method="post" action="{{ url_for('admin_checkin_backfill') }}" class="row wrap">
<label>日期<input type="date" name="date" value="{{ now }}" required></label>
<select name="kind">
{% for k in checkin_kinds %}<option value="{{ k.key }}">{{ k.icon }} {{ k.name }}</option>{% endfor %}
</select>
<button>补卡</button>
</form>
</section>
{% endblock %}