From 680897575016f6cf1ec2a3a89ee77a79297131a3 Mon Sep 17 00:00:00 2001 From: karlcarlo Date: Mon, 12 Oct 2026 09:36:45 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BB=8A=E6=97=A5=E5=AD=95=E6=9C=9F=E5=B0=8F?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=20emoji=20=E6=8D=A2=E6=88=90=E6=89=8B?= =?UTF-8?q?=E7=BB=98=E5=9B=BE=E6=A0=87=E5=BA=93=EF=BC=88=E5=BA=93=E6=B2=A1?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=80=80=E5=9B=9E=20emoji=EF=BC=89v26101205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: AI 助手 --- index.html | 3 ++- js/app.js | 29 +++++++++++++++++++++++++---- mama-box.css | 6 ++++++ 3 files changed, 33 insertions(+), 5 deletions(-) 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}