孕期数据没记过的格显示示例数 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

@@ -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();
}
/* 记过的格排前面;数宫缩 / 胎儿估重没记录就不出现;孕周没到的数胎动没记录也先不出现;单数时最后一格占满一行 */