From 19e0167df0fcdd39daa9d72a89053f0d79b1c82f Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Thu, 1 Oct 2026 13:05:33 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AD=95=E6=9C=9F=E5=B0=8F=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=9B=9B=E5=BC=A0=E5=B0=8F=E5=8D=A1=E7=B2=BE=E7=AE=80=EF=BC=9A?= =?UTF-8?q?=E6=94=B6=E8=B5=B7=E5=8F=AA=E9=9C=B2=E4=B8=80=E5=8F=A5=E9=87=8D?= =?UTF-8?q?=E7=82=B9=EF=BC=88=E5=AE=9D=E5=AE=9D=3D=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=AF=94=E5=96=BB=EF=BC=8C=E5=85=B6=E4=BD=99=E5=8F=96=E9=A6=96?= =?UTF-8?q?=E4=B8=AA=E5=88=86=E5=8F=A5=EF=BC=89=EF=BC=8C=E7=82=B9=E5=BC=80?= =?UTF-8?q?=E7=9C=8B=E5=85=A8=E6=96=87=EF=BC=8C=E6=A0=87=E9=A2=98=E5=8A=A0?= =?UTF-8?q?=E5=B0=8F=E7=AE=AD=E5=A4=B4=20(v26100130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- index.html | 2 +- js/app.js | 36 +++++++++++++++++++++++++++++------- mama-box.css | 5 +++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index fdc9c77..38b0ba3 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index 0009836..0acb639 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26100129'; + var VER = '26100130'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -3784,10 +3784,11 @@ $('#ptWhen').textContent = '本周第 ' + (today + 1) + ' 天'; $('#ptFloat').textContent = size.emoji; $('#ptBabyIco').textContent = size.emoji; - $('#ptBaby').textContent = '像' + size.name + '那么大。' + (wk.baby || ''); - $('#ptMom').textContent = wk.mom || ''; - $('#ptEat').textContent = wk.eat || ''; - $('#ptCare').textContent = wk.care || ''; + /* 2026-10-01 用户反馈「四张小卡文字太多」:卡上只露一句重点,点开再看全文(全文存 data-full) */ + setTipCard('#ptBaby', '像' + size.name + '那么大', '像' + size.name + '那么大。' + (wk.baby || '')); + setTipCard('#ptMom', tipGist(wk.mom), wk.mom); + setTipCard('#ptEat', tipGist(wk.eat), wk.eat); + setTipCard('#ptCare', tipGist(wk.care), wk.care); /* 一周 7 个圆点:以前可回看,今天实心,以后锁着 */ const box = $('#ptDays'); box.textContent = ''; @@ -3825,10 +3826,31 @@ const body = $('#ptBody'); body.classList.remove('is-in'); void body.offsetWidth; body.classList.add('is-in'); // 重播进场动画 } - /* 四张小卡压成横滑后正文只露 3 行,点一下展开全文、再点收起 */ + /* 一句重点 = 全文的第一个分句;太短(如「从这周末起」)就再带上下一句 */ + function tipGist(txt) { + const parts = String(txt || '').split(/[,。;!]/).filter(Boolean); + let g = parts[0] || ''; + if (g.length < 7 && parts[1]) g += ',' + parts[1]; + return g; + } + function setTipCard(sel, gist, full) { + const p = $(sel); + if (!p) return; + p.dataset.gist = gist || ''; + p.dataset.full = full || ''; + const open = p.closest('.pt-card').classList.contains('is-open'); + p.textContent = open ? p.dataset.full : p.dataset.gist; + } + /* 四张小卡只露一句重点,点一下展开全文、再点收回一句 */ (function () { const g = $('#ptGrid'); - if (g) g.addEventListener('click', e => { const c = e.target.closest('.pt-card'); if (c) c.classList.toggle('is-open'); }); + if (g) g.addEventListener('click', e => { + const c = e.target.closest('.pt-card'); + if (!c) return; + const open = c.classList.toggle('is-open'); + const p = $('p', c); + if (p && p.dataset.full) p.textContent = open ? p.dataset.full : p.dataset.gist; + }); })(); function revealTipsGrid() { const g = $('#ptGrid'); diff --git a/mama-box.css b/mama-box.css index bf3405a..5446ec1 100644 --- a/mama-box.css +++ b/mama-box.css @@ -2750,6 +2750,11 @@ a.skip:focus{left:16px;top:16px} .pt-card b{font-size:14px} .pt-card p{font-size:13px;line-height:1.6;margin-top:6px} .pt-foot{font-size:11.5px} +/* 四张小卡精简(2026-10-01):收起时只一句重点(最多 2 行),标题右侧小箭头提示可点;展开后箭头朝下、显示全文 */ +.pt-card{cursor:pointer;align-content:start} +.pt-card p{-webkit-line-clamp:2} +.pt-card b::after{content:"›";margin-left:4px;font-weight:700;opacity:.45;display:inline-block;transition:transform .2s} +.pt-card.is-open b::after{transform:rotate(90deg)} /* ============ 孕期盲盒 · 价值感改造(2026-10-01):下周预告 / 待解锁任务 / 集齐奖励 / 宝宝周记 ============ */ /* 下周预告:卡片剪影(同一张插画压成纯色)+ 倒计时 */