孕期数据没记过的格显示示例数 v26103106

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-10-31 12:06:42 +00:00
parent 96b5a87d23
commit 173dfffc95
2 changed files with 16 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>兜爸心选 · 孕育陪伴</title>
<!-- V:26103105 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<!-- V:26103106 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<link rel="stylesheet" href="mama-box.css">
<link rel="stylesheet" href="night.css">
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
@@ -347,6 +347,11 @@
.vt-s.lo{background:rgba(199,122,30,.14);color:#C77A1E}
.vt-d{font-size:10.5px;color:#9C8885;white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}
.vt-d:empty{display:none}
.vt-it.demo .vt-v b{color:rgba(90,60,60,.45)}
.vt-it.empty .vt-s.dm{padding:1px 8px;background:#FFF1D6;color:#B8862B}
.vt-it.demo .vt-d{color:var(--vt-c);font-weight:700}
html.night .vt-it.demo .vt-v b{color:rgba(255,255,255,.4)}
html.night .vt-it.empty .vt-s.dm{background:rgba(255,200,100,.16);color:#F0C67A}
.vt-k{--vt-c:#E9673F}
.vt-w{--vt-c:#E5606A}
.vt-p{--vt-c:#C94F8C}
@@ -2143,7 +2148,7 @@
<!-- 2026-10-05 首页头图:宝宝时不时动一动小手小脚(独立文件,删掉这一行即下线) -->
<script src="js/baby-limbs.js?v=26101201"></script>
<script src="js/coach.js?v=26101211"></script>
<script src="js/birth-flow.js?v=26103105"></script>
<script src="js/birth-flow.js?v=26103106"></script>
<!-- 禁止下拉回弹(2026-10-11 统一规则,与孕期体重同一段):竖向拖动时从手指下往上找还能朝该方向滚的容器,找不到才拦;横滑、双指、可滚列表不受影响 -->
<script>

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26103105';
var VER = '26103106';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -5191,15 +5191,19 @@
return n === 0 ? '今天' : n === 1 ? '昨天' : (b.getMonth() + 1) + '月' + b.getDate() + '日';
}
const VT_ID = { kick: 'vtK', weight: 'vtW', bp: 'vtP', glu: 'vtG', curve: 'vtC', fweight: 'vtE' };
const VT_EXTRA = { curve: 1, fweight: 1 }; /* 这两格有记录才出现 */
const VT_EXTRA = { curve: 1, fweight: 1 };
const VT_DEMO = { kick: ['12', '去数一数 ›'], weight: ['58.2', '去记一笔 ›'], bp: ['115/75', '去记一笔 ›'], glu: ['5.1', '去记一笔 ›'] }; /* 这两格有记录才出现 */
function vtSet(key, val, pill, cls, when) {
const it = $('.vt-it[data-vt="' + key + '"]'); if (!it) return;
const id = VT_ID[key];
it.classList.toggle('empty', !val);
it.dataset.has = val ? '1' : '';
$('#' + id).textContent = val || '--';
const s = $('#' + id + 's'); s.textContent = val ? (pill || '') : (key === 'kick' ? '去数一数 ›' : '去记一笔 ›'); s.className = 'vt-s' + (val && cls ? ' ' + cls : '');
$('#' + id + 'd').textContent = val ? (when || '') : '';
/* 2026-10-31 用户定:没记过的格放示例数(像育儿首页「宝宝的记录」那样标「示例」),一记就换成自己的 */
const dm = !val && VT_DEMO[key];
it.classList.toggle('demo', !!dm);
$('#' + id).textContent = val || (dm ? dm[0] : '--');
const s = $('#' + id + 's'); s.textContent = val ? (pill || '') : (dm ? '示例' : (key === 'kick' ? '去数一数 ›' : '去记一笔 ›')); s.className = 'vt-s' + (val && cls ? ' ' + cls : dm ? ' dm' : '');
$('#' + id + 'd').textContent = val ? (when || '') : (dm ? dm[1] : '');
vtLayout();
}
/* 记过的格排前面;数宫缩 / 胎儿估重没记录就不出现;孕周没到的数胎动没记录也先不出现;单数时最后一格占满一行 */