我的资料: 预产期空值占位「- 年 - 月 - 日」(原生date不支持placeholder, 叠加文字层) (v26090729)

This commit is contained in:
2026-09-08 03:11:52 +08:00
parent 4301a8865c
commit 8f78f5b433
3 changed files with 20 additions and 6 deletions

View File

@@ -1789,6 +1789,7 @@
pgDay.value = '';
lockWeekFields(true);
}
syncDuePh();
/* 头像预览跟随卡片(有正式头像才显示;新用户空圆 + +号) */
const _me = $('#meAvatar');
if (_me && _me.classList.contains('has-img') && meAvatarImg && meAvatarImg.src) {
@@ -1800,8 +1801,15 @@
}
}
/* 预产期占位层:空值显示「- 年 - 月 - 日」,选了值隐藏 */
function syncDuePh() {
const ph = $('#pgDuePh');
if (ph) ph.style.display = pgDue.value ? 'none' : 'block';
}
/* 预产期一变,孕周 / 额外天数自动算出来 */
pgDue.addEventListener('change', () => {
syncDuePh();
const due = parseDay(pgDue.value);
if (!due) { lockWeekFields(true); return; }
const ga = gaFromDue(due);