diff --git a/index.html b/index.html index f2245cb..e6cb49a 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + @@ -2040,6 +2040,7 @@ + diff --git a/js/app.js b/js/app.js index 961379f..ad0000c 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26101204'; + var VER = '26101205'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -4972,6 +4972,24 @@ } return tipsLoading; } + /* 手绘图标:el 里放一张 (装饰,aria-hidden);没有库 / 没有这个 id / 图片加载失败 → 写回 emoji */ + function setHandIco(el, id, emoji) { + if (!el) return; + if (!id || !window.handIcons || !handIcons.has(id)) { el.textContent = emoji; return; } + const cur = el.querySelector('img'); + if (cur && cur.dataset.hi === id) return; + const im = handIcons.img(id); + im.removeAttribute('width'); im.removeAttribute('height'); // 尺寸跟着各处的 font-size(css 里 1em 起算) + im.dataset.hi = id; + im.onerror = function () { el.textContent = emoji; }; + el.textContent = ''; + el.appendChild(im); + } + /* 小知识四个固定入口(首页那排 + 详情页四张卡):妈妈 / 吃 / 留心固定图标;「宝宝这周」跟孕周走,在 renderTips 里写 */ + $$('[data-pt="mom"] > i, [data-pt="mom"] > .pt-ico').forEach(el => setHandIco(el, 'mom', '🤰')); + $$('[data-pt="eat"] > i, [data-pt="eat"] > .pt-ico').forEach(el => setHandIco(el, 'eat', '🥗')); + $$('[data-pt="care"] > i, [data-pt="care"] > .pt-ico').forEach(el => setHandIco(el, 'care', '📋')); + function renderTips() { const sec = $('#pregTips'); if (!sec) return; @@ -4984,14 +5002,17 @@ const size = babySize(w); $('#ptWk').textContent = '孕 ' + state.week + ' 周'; $('#ptWhen').textContent = '本周第 ' + (today + 1) + ' 天'; - $('#ptFloat').textContent = size.emoji; - $('#ptBabyIco').textContent = size.emoji; + /* 2026-10-12 用户:小知识里的 emoji 换成兜爸手绘图标库(/_bridge/hand-icons.js,小程序后台 375797cf 维护); + 图标按孕周从 handIcons.week() 取,SIZE 表只管文字;库没加载 / 图片挂了 → 退回原来的 emoji,位置不空 */ + const hw = window.handIcons && handIcons.week(w); + setHandIco($('#ptFloat'), hw && hw.id, size.emoji); + setHandIco($('#ptBabyIco'), hw && hw.id, size.emoji); /* 四张卡全文只在详情页 #detailTips;首页那排入口只有图标 + 标题 */ $('#ptBaby').textContent = '像' + size.name + '那么大。' + (wk.baby || ''); $('#ptMom').textContent = wk.mom || ''; $('#ptEat').textContent = wk.eat || ''; $('#ptCare').textContent = wk.care || ''; - $('#ptChipBaby').textContent = size.emoji; + setHandIco($('#ptChipBaby'), hw && hw.id, size.emoji); $('#ptDtTitle').textContent = '孕 ' + state.week + ' 周 · 这一周'; /* 一周 7 个圆点:以前可回看,今天实心,以后锁着 */ const box = $('#ptDays'); diff --git a/mama-box.css b/mama-box.css index a9d982f..07640ca 100644 --- a/mama-box.css +++ b/mama-box.css @@ -4856,3 +4856,9 @@ a.skip:focus{left:16px;top:16px} box-shadow:0 0 0 1.5px #E7DCD5,0 3px 10px rgba(90,50,35,.12)} .avp-x:active{transform:scale(.92)} + +/* 小知识手绘图标(2026-10-12,js/app.js setHandIco):img 尺寸按各处原来的 emoji 字号放大一点,手绘线条在 20px 以下看不清 */ +.pt-float img,.pt-chip i img,.pt-ico img{display:block;width:1em;height:1em;object-fit:contain;pointer-events:none} +.pt-float img{width:1.4em;height:1.4em} +.pt-chip i img{width:1.5em;height:1.5em} +.pt-ico img{width:1.3em;height:1.3em}