Compare commits
12 Commits
43448a85f6
...
a956f738af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a956f738af | ||
|
|
1761067777 | ||
|
|
a3cccb109b | ||
|
|
a56ce8c366 | ||
|
|
6f110cbd18 | ||
|
|
b70236a354 | ||
|
|
e3c92d1f8c | ||
|
|
173dfffc95 | ||
|
|
96b5a87d23 | ||
|
|
13bcc27cdf | ||
|
|
fc67dd8628 | ||
|
|
750be14823 |
140
assets/data/qa/hot.json
Normal file
@@ -0,0 +1,140 @@
|
||||
[
|
||||
{
|
||||
"q": "生娃计算器,到底要花多少钱?",
|
||||
"tag": "花钱",
|
||||
"a": "生娃的钱主要分四块:①孕期产检(建档、常规产检、NT、唐筛或无创、大排畸、糖耐等);②分娩住院(顺产比剖宫产便宜,公立比私立便宜,单人间另算);③月子(在家坐月子主要是营养和用品,请月嫂或去月子中心差别很大);④宝宝第一年(奶粉、纸尿裤、衣物、疫苗中的自费部分、玩具和绘本)。各城市、各医院价格差得很多,最准的算法是:问一下建档医院的分娩套餐价,再按自己的月子方式和喂养方式逐项估。别忘了生育保险:参保满足条件的,产检和分娩费用可以报销,还能领生育津贴,提前问清单位人事和当地医保。",
|
||||
"href": "topic/huafei/",
|
||||
"badge": "爆",
|
||||
"heat": 0.118
|
||||
},
|
||||
{
|
||||
"q": "测一测你是什么样的妈妈?",
|
||||
"tag": "趣味",
|
||||
"a": "8 道轻松小题,1 分钟测出你的妈妈类型,看看你的带娃优势和适合你的孕期工具。",
|
||||
"href": "topic/ceshi/",
|
||||
"badge": "热",
|
||||
"heat": 0.103
|
||||
},
|
||||
{
|
||||
"q": "孕期营养影响孩子智商吗?",
|
||||
"tag": "营养",
|
||||
"a": "孕期营养会影响宝宝大脑发育,但「吃什么就能变聪明」是夸大说法。真正要紧的是别缺:孕早期叶酸关系到神经管发育;碘是甲状腺激素的原料,影响大脑发育,平时吃加碘盐、每周吃一两次海带紫菜即可;DHA 可以通过每周吃两三次鱼虾来补;铁不够会贫血,影响宝宝供氧。做到饮食均衡、体重增长合适、按时产检,就已经给了宝宝大脑最好的营养基础。孩子以后聪不聪明,还和遗传、出生后的陪伴和教育关系很大,不用因为某顿没吃好而焦虑。",
|
||||
"href": "topic/yingyang/",
|
||||
"badge": "热",
|
||||
"heat": 0.091
|
||||
},
|
||||
{
|
||||
"q": "叶酸、DHA、铁、钙要不要补?",
|
||||
"tag": "补剂",
|
||||
"a": "叶酸:要补。备孕前 3 个月到孕早期每天 0.4mg,很多医生会建议吃到整个孕期,有特殊情况医生会调整剂量。铁:孕中晚期需要量大增,先多吃红肉、动物血、肝脏,产检查出贫血再按医生建议吃铁剂。钙:孕中期起每天约需 1000mg,每天 500ml 左右的奶或奶制品加豆制品、绿叶菜,基本能吃够;喝奶少的可以在医生指导下补钙片。DHA:每周吃 2~3 次鱼(优先三文鱼、鳕鱼、沙丁鱼这类低汞鱼)一般就够,吃鱼少的可以考虑补充。补剂不是越多越好,拿不准就带着清单问产检医生。",
|
||||
"href": "topic/buji/",
|
||||
"badge": "热",
|
||||
"heat": 0.083
|
||||
},
|
||||
{
|
||||
"q": "孕妈产后复工,职场维权指南",
|
||||
"tag": "职场",
|
||||
"a": "这几条是国家《女职工劳动保护特别规定》写明的:①孕期、产期、哺乳期,单位不能因为怀孕生育降低工资、辞退或单方解除劳动合同;②产假不少于 98 天(产前可休 15 天),难产增加 15 天,多胞胎每多一个增加 15 天,各省还有延长奖励假,以当地规定为准;③产检时间算劳动时间,不能扣工资;④怀孕 7 个月以上,单位不能延长工作时间或安排夜班,并应安排一定休息时间;⑤宝宝 1 岁内,每天有 1 小时哺乳时间。遇到不公平对待,先保留书面证据(通知、聊天记录、工资条),可以向当地劳动监察部门投诉或申请劳动仲裁。",
|
||||
"href": "topic/zhichang/",
|
||||
"badge": "新",
|
||||
"heat": 0.041
|
||||
},
|
||||
{
|
||||
"q": "妊娠纹,与体重管理",
|
||||
"tag": "专题",
|
||||
"href": "topic/wen/",
|
||||
"a": "妊娠纹和体重增长快慢关系很大,控制好体重是最省钱的预防办法。点进去看专题:为什么会长、不同阶段抹什么、成分怎么挑。",
|
||||
"badge": "热",
|
||||
"heat": 0.069
|
||||
},
|
||||
{
|
||||
"q": "怀孕后什么时候去医院建档?",
|
||||
"tag": "产检",
|
||||
"a": "一般在孕 6~8 周做第一次 B 超确认宫内孕、看到胎心胎芽后,就可以着手准备建档,多数医院在孕 12 周左右正式建档,并同时做 NT 检查。热门医院床位紧张,有的需要提前预约,最好早点打电话或在医院公众号上查清楚流程。建档一般要带身份证、医保卡、母子健康手册(或社区开的建册证明)和之前的检查报告。"
|
||||
},
|
||||
{
|
||||
"q": "唐筛、无创、羊穿,该怎么选?",
|
||||
"tag": "产检",
|
||||
"a": "三者都是查染色体问题,但准确度和风险不同。唐筛是抽血筛查,便宜无创伤,但准确度最低;无创 DNA 也是抽血,准确度明显高于唐筛,费用更高;羊水穿刺是诊断,结果最准,但属于有创操作,有很小的流产风险。一般没有高危因素的妈妈可以先做唐筛或无创;年龄偏大、筛查高风险、有家族史或 B 超发现异常的,医生会建议直接做羊穿。具体按产检医生的建议来。"
|
||||
},
|
||||
{
|
||||
"q": "孕期体重长多少合适?",
|
||||
"tag": "身体",
|
||||
"a": "看孕前体重来定:孕前偏瘦的,整个孕期可以长得多一些;体重正常的,一般建议长 8~14kg 左右;偏胖或肥胖的要长得更少。孕早期变化不大,孕中晚期每周增长约 0.3~0.5kg 比较合适。长得太快容易出现妊娠期糖尿病、高血压、巨大儿,还更容易长妊娠纹;长得太少又可能影响宝宝发育。可以用首页的「孕期体重」每周记一次,看看自己在不在合理范围。"
|
||||
},
|
||||
{
|
||||
"q": "孕期能喝咖啡、奶茶吗?",
|
||||
"tag": "营养",
|
||||
"a": "可以少量喝。孕期每天咖啡因建议不超过 200mg,大约是一杯中杯美式。要注意奶茶、浓茶、可乐、巧克力里也有咖啡因,要一起算。奶茶的问题更多在糖分高,喝多了体重和血糖都容易超标,想喝可以选小杯、少糖或无糖,一周偶尔一两次就好。"
|
||||
},
|
||||
{
|
||||
"q": "怀孕了还能养猫、养狗吗?",
|
||||
"tag": "生活",
|
||||
"a": "大多数情况下可以继续养。养猫主要担心弓形虫:室内长期饲养、只吃猫粮、不外出的猫感染概率很低。孕期尽量让家人铲屎,自己要铲的话戴手套、铲完洗手,每天及时清理猫砂。不要喂生肉,自己也别吃没熟的肉,处理生肉后洗手。可以在孕前或孕早期查一下弓形虫抗体,心里更有底。狗狗要按时打疫苗驱虫,避免被抓伤咬伤。"
|
||||
},
|
||||
{
|
||||
"q": "孕期可以染发、烫发吗?",
|
||||
"tag": "生活",
|
||||
"a": "建议尽量避开,尤其是孕早期宝宝器官形成的关键阶段。染发烫发剂里的化学成分通过头皮吸收的量很少,目前没有确切证据说明会伤害宝宝,但出于谨慎,孕期能不做就不做。实在需要,等到孕中期后,选择通风好的店,挑选不接触头皮的挑染,缩短停留时间。剪发、普通洗护不受影响。"
|
||||
},
|
||||
{
|
||||
"q": "孕期能坐飞机、出远门吗?",
|
||||
"tag": "生活",
|
||||
"a": "孕中期(孕 14~27 周)身体最舒服,是出行最合适的时候。孕早期反应大、孕晚期有早产风险,尽量少长途出行。多数航空公司对孕 32 周以上的孕妈有限制,需要医生开具适宜乘机的证明,36 周以上一般不能乘机,具体看航司规定。出行时穿宽松衣服和舒适的鞋,每隔 1 小时起来活动一下,多喝水,带好产检资料。有出血、前置胎盘、早产迹象的要遵医嘱,不要出行。"
|
||||
},
|
||||
{
|
||||
"q": "孕期能运动吗?做什么运动好?",
|
||||
"tag": "身体",
|
||||
"a": "没有医生明确禁止的话,孕期适当运动对妈妈和宝宝都有好处,能控制体重、减少腰背痛、改善睡眠,也有助于顺产。推荐散步、游泳、孕妇瑜伽、固定单车等低冲击运动,每周累计 150 分钟左右,以运动时还能正常说话为度。避免跳跃、对抗性运动、容易摔倒的运动和仰卧太久。运动中出现出血、腹痛、头晕、胸闷、流液要马上停下并就医。"
|
||||
},
|
||||
{
|
||||
"q": "孕吐什么时候能结束?",
|
||||
"tag": "身体",
|
||||
"a": "孕吐一般在孕 6 周左右开始,孕 8~10 周最明显,大多数妈妈在孕 12~14 周后逐渐减轻。缓解小办法:少量多餐,别让胃空着;早上起床前先吃几块苏打饼干;避开油腻和气味重的食物;吃点姜味食物或酸味水果。如果吐得什么都吃不下、喝水也吐、尿很少、体重明显下降,可能是妊娠剧吐,要及时去医院补液治疗。"
|
||||
},
|
||||
{
|
||||
"q": "什么时候能感觉到胎动?",
|
||||
"tag": "宝宝",
|
||||
"a": "第一胎的妈妈一般在孕 18~20 周第一次感觉到胎动,二胎妈妈经验多,可能早到 16 周左右。最开始的胎动很轻,像小鱼吐泡泡或肚子里冒泡。孕 28 周以后要每天留意胎动,可以用首页的「数胎动」记录:如果胎动明显减少、比平时弱很多或突然特别频繁,要及时去医院。"
|
||||
},
|
||||
{
|
||||
"q": "顺产还是剖宫产,怎么选?",
|
||||
"tag": "准备",
|
||||
"a": "没有医学指征时,一般更推荐顺产:产后恢复快、住院时间短,宝宝经过产道挤压,对呼吸系统也有好处。剖宫产是解决难产和高危情况的重要手段,比如胎位不正、前置胎盘、胎儿窘迫、骨盆过小等,由医生评估决定。害怕疼的话,可以了解一下医院有没有无痛分娩(分娩镇痛)。具体分娩方式要和产检医生一起商量。"
|
||||
},
|
||||
{
|
||||
"q": "待产包要准备些什么?",
|
||||
"tag": "准备",
|
||||
"a": "建议孕 32~35 周前准备好,放在门口方便拿。证件类:身份证、医保卡、母子健康手册、产检资料。妈妈用品:产褥垫、一次性内裤、哺乳内衣、防溢乳垫、吸管杯、拖鞋、洗漱用品、宽松保暖的衣服。宝宝用品:新生儿纸尿裤、包被、和尚服、口水巾、湿巾,以及出院穿的衣服。医院提供的物品不一样,提前问清楚可以少带很多。首页「待产清单」可以帮你逐项勾选。"
|
||||
},
|
||||
{
|
||||
"q": "生育津贴怎么领?能领多少?",
|
||||
"tag": "花钱",
|
||||
"a": "生育津贴由生育保险支付,一般条件是:产前单位为你连续缴纳生育保险(职工医保)满一定月数,具体月数各地不同。金额通常是:单位上年度职工月平均工资 ÷ 30 × 产假天数。多数地方由单位统一申请,也有的可以个人在当地医保 App 或线上服务平台申请,需要准备出生医学证明、住院病历等材料。具体条件和流程以当地医保部门为准,可以提前问单位人事。"
|
||||
},
|
||||
{
|
||||
"q": "孕期失眠、睡不好怎么办?",
|
||||
"tag": "身体",
|
||||
"a": "孕期睡不好很常见,原因有尿频、腿抽筋、胃灼热、肚子大翻身难,还有焦虑。可以试试:睡前 2 小时少喝水;晚饭别太饱,吃完别马上躺下;左侧卧,在两腿之间、肚子下面垫个孕妇枕;白天适当运动,但睡前别剧烈运动;固定作息,睡前少看手机。腿抽筋的话多晒太阳、吃奶制品,产检时问问医生需不需要补钙。长期严重失眠或情绪低落,要告诉医生。"
|
||||
},
|
||||
{
|
||||
"q": "孕期便秘怎么缓解?",
|
||||
"tag": "身体",
|
||||
"a": "孕激素让肠道蠕动变慢,加上子宫压迫和补铁,孕期便秘很常见。先从生活入手:每天喝够 1500~1700ml 水;多吃蔬菜、水果、粗杂粮、薯类,增加膳食纤维;每天适当散步;养成定时排便的习惯,不要憋。不要自己乱用泻药或开塞露,如果几天都排不出、肚子胀痛或便中带血,要问医生,用孕期安全的药物。"
|
||||
},
|
||||
{
|
||||
"q": "孕期可以同房吗?",
|
||||
"tag": "生活",
|
||||
"a": "孕期一切正常的话,可以有温和的性生活,一般建议避开孕早期前 3 个月和孕晚期最后 1 个月。注意动作轻柔、避免压迫腹部,选择舒适的体位,最好使用避孕套减少感染。如果有阴道出血、前置胎盘、先兆流产或早产迹象、宫颈机能不全、胎膜早破等情况,要禁止同房,听医生的。同房后出现腹痛、出血、流液要及时就医。"
|
||||
},
|
||||
{
|
||||
"q": "孕期情绪低落、焦虑怎么办?",
|
||||
"tag": "心情",
|
||||
"a": "孕期激素变化大,再加上身体不舒服和对未来的担心,情绪起伏很正常。试着把担心说出来,和老公、家人或其他孕妈聊聊;每天留点时间做喜欢的事,散步、听音乐、晒太阳;少在网上搜吓人的个例;规律作息,适当运动。如果连续两周以上情绪低落、对什么都提不起兴趣、睡不着或总想哭,甚至有伤害自己的念头,要及时告诉产检医生,寻求专业帮助。"
|
||||
},
|
||||
{
|
||||
"q": "准爸爸孕期能帮上什么忙?",
|
||||
"tag": "心情",
|
||||
"a": "准爸爸的陪伴对孕妈很重要。可以做这些:尽量陪着去产检,一起了解宝宝的情况;承担家务,特别是铲猫砂、搬重物、做饭;晚上帮她按摩腿脚、垫好孕妇枕;和她一起学分娩和新生儿护理知识,准备待产包;每天和宝宝说说话、讲故事;多听她倾诉,别说「别人都这样」。孕晚期保持电话畅通,提前规划好去医院的路线。"
|
||||
}
|
||||
]
|
||||
360
index.html
@@ -7,7 +7,7 @@
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>兜爸心选 · 孕育陪伴</title>
|
||||
<!-- V:26103102 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26103112 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<link rel="stylesheet" href="mama-box.css">
|
||||
<link rel="stylesheet" href="night.css">
|
||||
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
||||
@@ -204,87 +204,155 @@
|
||||
<button class="dock-all" data-sheet="open">所有工具 ›</button>
|
||||
</div>
|
||||
<p class="dock-note"><svg viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M11 2.6l1.9 5.2 5.2 1.9-5.2 1.9L11 16.8l-1.9-5.2L3.9 9.7l5.2-1.9L11 2.6z" fill="currentColor"/><path d="M18.4 14.6l.8 2.1 2.2.8-2.2.8-.8 2.1-.8-2.1-2.2-.8 2.2-.8.8-2.1z" fill="currentColor" opacity=".6"/></svg>妈妈每记录一次,宝宝就多一段成长记忆</p>
|
||||
<!-- 2026-09-30 五张卡改版:白色粗标题 + 各工具 LOGO 里的图形(取自点进去那个工具页左上角的 LOGO,
|
||||
只留里面的图形),做成白色单色半透明「水印」斜压在卡片右下角,只作装饰;assets/img/*.svg 矢量。卡底色跟点进去的工具页同色系、稍深一档。
|
||||
只换皮:排布、高度账、data-mini 跳转和各 id 的数据回填一律没动。样式见 mama-box.css「参考图改版」。 -->
|
||||
<!-- 五张工具卡 + 一个出口。宫格本身这一版没动:
|
||||
不等宽三列 + 竖向堆叠本来就是这一屏最不传统的部分,
|
||||
而且两列高度是硬凑齐的(见 style.css 里 .mini-card.curve 上面那段),
|
||||
动它得整列重算,收益也不在这儿。 -->
|
||||
<div class="bento">
|
||||
<div class="bento-col">
|
||||
<button class="mini-card kick ripple" data-mini="kick">
|
||||
<div class="mc-head">
|
||||
<div class="mc-title">数胎动</div>
|
||||
<!-- ⚠️ 默认值必须是中性占位,**不能写演示数字**:访客态(无 openid)与
|
||||
records 接口失败/超时这两种情况下没人会改它,写死 3 就是假数据。
|
||||
真实值由 __applyRecords() 写入(未记录的新用户是 0)。
|
||||
(2026-09-22 新用户实测:工具卡上的演示占位值一律归中性。) -->
|
||||
<div class="mc-sub">今天 <b id="kickTodayHome">--</b> 次</div>
|
||||
<!-- 第二行(上游 sub,如「2 段 · 最近 13:00」)——只有 kick 与 weight 两张卡
|
||||
有富余竖向空间;fweight/cal/curve 是固定高度且列很窄,放不下第二行。 -->
|
||||
<div class="mc-extra" id="kickExtra"></div>
|
||||
</div>
|
||||
<span class="mc-btn">记录</span>
|
||||
<img class="mc-art" src="assets/img/6add0c9e5856.svg" alt="" aria-hidden="true">
|
||||
</button>
|
||||
<!-- 第五个工具。原来是「胎心记录」,本批换成「胎儿估重」——
|
||||
后者是真正部署好的站点(beian1.douba.top),点了能用;
|
||||
而胎心记录在这张卡上一直只是个弹 toast 的占位入口。
|
||||
⚠️ 胎心记录**没有被删掉**:它还在「记一下」弹层里(快捷区 q3 +
|
||||
全部工具宫格),档案页那两条「来自「胎心记录」」的历史记录也照旧。
|
||||
这里换掉的只是首页宫格的一个坑位。
|
||||
⚠️ 类名、结构、三个尺寸全部照搬原来那张卡:外层仍是 .mini-card
|
||||
(.heart 只是改名成 .fweight,两条 CSS 跟着改),内部仍是
|
||||
「名字 + 状态两行叠着 + 右下角插画」。所以左列 158 + 10 + 64 = 232
|
||||
这笔账一个数都没动,右列(88 + 10 + 80 + 10 + 44)不用跟着补。
|
||||
图标换成了内联 SVG 的表盘,理由见 patch 脚本里那段注释。 -->
|
||||
<button class="mini-card fweight ripple" data-mini="fweight">
|
||||
<div class="mc-title sm">胎儿估重</div>
|
||||
<div class="mc-sub">去测算</div>
|
||||
<img class="mc-art" src="assets/img/3c4cf0da356c.svg" alt="" aria-hidden="true">
|
||||
</button>
|
||||
</div>
|
||||
<button class="mini-card weight ripple" data-mini="weight">
|
||||
<img class="mc-art big" src="assets/img/fc0ab3d2e21a.svg" alt="" aria-hidden="true">
|
||||
<div class="mc-title">孕期体重</div>
|
||||
<!-- ⚠️ 这里原来是写死的演示值「58.2 kg」,任何用户都会看到(2026-09-22 演示数据泄漏)。
|
||||
现在由 `applyRemoteCards()` 按 box_app 封装的卡片接口写入:
|
||||
有值时写 `value` + 小字 `<small>unit</small>`,没有值时保持中性占位 `--`
|
||||
(**不写 0**,0 是个看着像真的假值)。接口拿不到就保留这里的默认值。 -->
|
||||
<div class="mc-big" id="weightVal">--</div>
|
||||
<div class="mc-extra" id="weightExtra"></div>
|
||||
<!-- 图标:2026-10-31 改用 App 表里各应用的正式 logo(app.js applyToolLogos),「全部工具」没有应用 logo,保留渐变底白图形。 -->
|
||||
<!-- 2026-10-31 用户定:工具区改成育儿首页那种「图标宫格」——4 列 × 2 行,每格 彩色圆角图标 + 名字 + 状态胶囊。
|
||||
7 个孕期工具 + 「全部工具」出口。data-mini 与各 id(#kickTodayHome / #weightVal / #calNext)照旧,
|
||||
卡片接口回填、孕周没到换替补(swapHomeCards)、点击跳转都沿用原逻辑,只换皮。
|
||||
图标就是原来五张卡上的白色 LOGO 图形,铺在各工具同色系的渐变底上。样式在下面 <style>(不进 mama-box.css)。 -->
|
||||
<div class="tg-grid">
|
||||
<button class="tg kick ripple" data-mini="kick">
|
||||
<i class="tg-ic lg"><img src="/taidong/logo/logo-foot.svg" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">数胎动</span>
|
||||
<!-- 默认中性占位,不写演示数字(真实值由卡片接口写入) -->
|
||||
<span class="tg-s">今天 <b id="kickTodayHome">--</b> 次</span>
|
||||
</button>
|
||||
<div class="bento-col">
|
||||
<button class="mini-card cal ripple" data-mini="cal">
|
||||
<div class="mc-title sm">孕检日历</div>
|
||||
<div class="mc-sub" id="calNext">—</div>
|
||||
<img class="mc-art" src="assets/img/a693b92f3239.svg" alt="" aria-hidden="true">
|
||||
<button class="tg weight ripple" data-mini="weight">
|
||||
<i class="tg-ic lg"><img src="/upload/picture/a6d7e61edee2ff0395cf00587a7c4036.svg" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">孕期体重</span>
|
||||
<span class="tg-s" id="weightVal">--</span>
|
||||
</button>
|
||||
<button class="tg cal ripple" data-mini="cal">
|
||||
<i class="tg-ic lg"><img src="/chanjian-rili/logo/logo-7-dots.svg" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">孕检日历</span>
|
||||
<span class="tg-s" id="calNext">—</span>
|
||||
</button>
|
||||
<button class="tg fweight ripple" data-mini="fweight">
|
||||
<i class="tg-ic lg"><img src="/upload/picture/715333a69fb67d8812ab093f342fa00f.png" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">胎儿估重</span>
|
||||
<span class="tg-s">去测算</span>
|
||||
</button>
|
||||
<button class="tg curve ripple" data-mini="curve">
|
||||
<i class="tg-ic lg"><img src="/upload/picture/1c02d720e4d23b09c996e859703b8b5e.svg" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">数宫缩</span>
|
||||
<span class="tg-s" data-wk="cn">—</span>
|
||||
</button>
|
||||
<button class="tg bp ripple" data-mini="bp">
|
||||
<i class="tg-ic lg"><img src="/upload/picture/816227e3933211145bb8fc774ee32e82.svg" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">孕期血压</span>
|
||||
<span class="tg-s">量一量</span>
|
||||
</button>
|
||||
<button class="tg glu ripple" data-mini="glu">
|
||||
<i class="tg-ic lg"><img src="/upload/picture/fde3c920fae453f2642731e4135b88f5.png" alt="" aria-hidden="true"></i>
|
||||
<span class="tg-n">孕期血糖</span>
|
||||
<span class="tg-s">记一笔</span>
|
||||
</button>
|
||||
<button class="tg all ripple" data-sheet="open">
|
||||
<i class="tg-ic"><svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="#fff" stroke-width="2.2"><rect x="4" y="4" width="6.5" height="6.5" rx="2"/><rect x="13.5" y="4" width="6.5" height="6.5" rx="2"/><rect x="4" y="13.5" width="6.5" height="6.5" rx="2"/><rect x="13.5" y="13.5" width="6.5" height="6.5" rx="2"/></svg></i>
|
||||
<span class="tg-n">全部工具</span>
|
||||
<span class="tg-s">更多</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 2026-10-31 用户定:「我的孕期数据」——胎动 / 体重 / 血压 / 血糖常驻,数宫缩、胎儿估重有记录才出现;
|
||||
妈妈在哪个工具里记过,哪格就有数,并排到前面(app.js loadVitals / vtLayout)。毛玻璃格 + 彩色光斑底。
|
||||
有身份 + 孕期才显示;产后 / 访客整块隐藏。点哪格就进哪个工具。 -->
|
||||
<div class="vt hide" id="vitals">
|
||||
<div class="vt-h"><b>我的孕期数据</b><span>用过的工具,数据自动出现在这里</span></div>
|
||||
<div class="vt-row">
|
||||
<button type="button" class="vt-it vt-k ripple" data-vt="kick">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><ellipse cx="13" cy="15" rx="4.6" ry="5.8" transform="rotate(10 13 15)" fill="currentColor" opacity=".25" stroke="currentColor" stroke-width="1.8"/><circle cx="6.8" cy="8.2" r="1.7" fill="currentColor"/><circle cx="10.4" cy="6.2" r="1.5" fill="currentColor"/><circle cx="14" cy="5.6" r="1.35" fill="currentColor"/><circle cx="17.2" cy="6.6" r="1.2" fill="currentColor"/></svg></i><span class="vt-l">胎动</span><small class="vt-u">次</small></span>
|
||||
<span class="vt-v"><b id="vtK">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtKs"></span><span class="vt-d" id="vtKd"></span></span>
|
||||
</button>
|
||||
<!-- 生长曲线原来是 flex:1,把这一列剩下的高度全吃了(约 134px),
|
||||
而它的内容和上面的孕检日历一模一样多。压到 80px,
|
||||
省下的 54px 给下面那张「更多工具」。
|
||||
⚠️ 本批(第九批)把这张卡从「生长曲线」换成「数宫缩」:
|
||||
文案改这一行;落点改 app.js 的 MINI_APP_MAP.curve
|
||||
(taiershengzhang → gongsuopinlv,指向已上架的「宫缩频率计算」)。
|
||||
⚠️「生长曲线」工具本身**没被删**:App 表里 taiershengzhang /
|
||||
taierquxian 都还在,仍会出现在「记一下」的全部工具列表里;
|
||||
这里换掉的只是首页这一个坑位。
|
||||
图标(2026-09-30)已换成秒表萌物,见下面五张卡的改版注释。
|
||||
⚠️ 副标题仍是 data-wk="cn" 自动显示孕周,本批未要求改文案。 -->
|
||||
<button class="mini-card curve ripple" data-mini="curve">
|
||||
<div class="mc-title sm">数宫缩</div>
|
||||
<div class="mc-sub" data-wk="cn">—</div>
|
||||
<img class="mc-art" src="assets/img/ad7487f2e445.svg" alt="" aria-hidden="true">
|
||||
<button type="button" class="vt-it vt-w ripple" data-vt="weight">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="4" width="17" height="16" rx="5" fill="currentColor" opacity=".25"/><rect x="3.5" y="4" width="17" height="16" rx="5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8.5 10.5a3.5 3.5 0 017 0" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 10.5l1.6-1.8" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg></i><span class="vt-l">体重</span><small class="vt-u">kg</small></span>
|
||||
<span class="vt-v"><b id="vtW">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtWs"></span><span class="vt-d" id="vtWd"></span></span>
|
||||
</button>
|
||||
<!-- 通往「记一下」弹层里那十几个工具。底部那颗 FAB 开的也是它。
|
||||
故意不做成糖果色卡:它不是第六个工具,是个出口,
|
||||
灰米底 + 一行小字,和上面五张分得开。 -->
|
||||
<button class="mini-card more ripple" data-sheet="open">
|
||||
<span class="mc-more-t">更多工具</span><i class="chev">›</i>
|
||||
<button type="button" class="vt-it vt-p ripple" data-vt="bp">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20.5s-7.5-4.6-7.5-10.2A4.3 4.3 0 0112 7.6a4.3 4.3 0 017.5 2.7c0 5.6-7.5 10.2-7.5 10.2z" fill="currentColor" opacity=".25" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M6.5 12.5h3l1.3-2.3 2 4.3 1.3-2h3.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg></i><span class="vt-l">血压</span><small class="vt-u">mmHg</small></span>
|
||||
<span class="vt-v"><b id="vtP">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtPs"></span><span class="vt-d" id="vtPd"></span></span>
|
||||
</button>
|
||||
<button type="button" class="vt-it vt-g ripple" data-vt="glu">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3.5s6 6.6 6 10.9a6 6 0 01-12 0C6 10.1 12 3.5 12 3.5z" fill="currentColor" opacity=".25" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M9.3 14.6a2.8 2.8 0 002.7 2.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg></i><span class="vt-l">血糖</span><small class="vt-u">mmol/L</small></span>
|
||||
<span class="vt-v"><b id="vtG">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtGs"></span><span class="vt-d" id="vtGd"></span></span>
|
||||
</button>
|
||||
<button type="button" class="vt-it vt-c ripple hide" data-vt="curve">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="13" r="7.5" fill="currentColor" opacity=".25" stroke="currentColor" stroke-width="1.8"/><path d="M12 9v4l2.6 1.6M10 3h4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg></i><span class="vt-l">宫缩间隔</span><small class="vt-u"></small></span>
|
||||
<span class="vt-v"><b id="vtC">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtCs"></span><span class="vt-d" id="vtCd"></span></span>
|
||||
</button>
|
||||
<button type="button" class="vt-it vt-e ripple hide" data-vt="fweight">
|
||||
<span class="vt-top"><i class="vt-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8" fill="currentColor" opacity=".25" stroke="currentColor" stroke-width="1.8"/><path d="M12 12l3.6-3.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="1.6" fill="currentColor"/></svg></i><span class="vt-l">胎儿估重</span><small class="vt-u"></small></span>
|
||||
<span class="vt-v"><b id="vtE">--</b></span>
|
||||
<span class="vt-f"><span class="vt-s" id="vtEs"></span><span class="vt-d" id="vtEd"></span></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
/* —— 工具宫格(仿育儿首页) —— */
|
||||
.tg-grid{display:grid;grid-template-columns:repeat(4,1fr);row-gap:16px;column-gap:4px;margin-top:14px}
|
||||
.tg{position:relative;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;padding:2px 0;border:0;background:none;font:inherit;color:inherit;overflow:visible}
|
||||
.tg-ic{width:48px;height:48px;border-radius:15px;display:grid;place-items:center;box-shadow:0 6px 14px var(--tg-sh,rgba(230,110,80,.25)),inset 0 1px 0 rgba(255,255,255,.35);background:var(--tg-bg)}
|
||||
.tg-ic img,.tg-ic svg{width:27px;height:27px;object-fit:contain}
|
||||
/* 2026-10-31 用户:图标统一用正式上线的应用图标(App 表 logo,后台换了 JS 会跟着换;这里的 src 只是首屏占位) */
|
||||
.tg-ic.lg{display:block;width:50px;height:50px;padding:0;background:none;box-shadow:none;border-radius:0}
|
||||
.tg-ic.lg img{display:block;margin:0;position:static;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 5px 8px rgba(120,80,70,.18))}
|
||||
.tg-n{font-size:13px;font-weight:600;color:#3B2A2A;white-space:nowrap}
|
||||
.tg-s{max-width:100%;padding:1px 8px;border-radius:99px;font-size:11px;line-height:17px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--tg-pl);color:var(--tg-tx)}
|
||||
.tg-s b{font-weight:800}
|
||||
.tg-s small{margin-left:1px;font-size:9.5px}
|
||||
.tg.kick{--tg-bg:linear-gradient(150deg,#F7A072,#E9673F);--tg-pl:#FFEADF;--tg-tx:#D4552F;--tg-sh:rgba(233,103,63,.28)}
|
||||
.tg.weight{--tg-bg:linear-gradient(150deg,#F79A92,#E5606A);--tg-pl:#FFE6E6;--tg-tx:#D24B57;--tg-sh:rgba(229,96,106,.28)}
|
||||
.tg.cal{--tg-bg:linear-gradient(150deg,#9CC873,#68A043);--tg-pl:#E9F5DE;--tg-tx:#4E8A2C;--tg-sh:rgba(104,160,67,.28)}
|
||||
.tg.fweight{--tg-bg:linear-gradient(150deg,#8FB0EA,#5B7FCC);--tg-pl:#E5EDFC;--tg-tx:#4568B8;--tg-sh:rgba(91,127,204,.28)}
|
||||
.tg.curve{--tg-bg:linear-gradient(150deg,#B39BEA,#8366CC);--tg-pl:#EFE8FC;--tg-tx:#6F50BC;--tg-sh:rgba(131,102,204,.28)}
|
||||
.tg.bp{--tg-bg:linear-gradient(150deg,#F58FB0,#DC5584);--tg-pl:#FDE6EE;--tg-tx:#C93F70;--tg-sh:rgba(220,85,132,.28)}
|
||||
.tg.glu{--tg-bg:linear-gradient(150deg,#6FD0C2,#2FA192);--tg-pl:#DFF5F1;--tg-tx:#22887B;--tg-sh:rgba(47,161,146,.28)}
|
||||
.tg.all{--tg-bg:linear-gradient(150deg,#F2C17E,#E19A4C);--tg-pl:#FBEEDC;--tg-tx:#B9772D;--tg-sh:rgba(225,154,76,.28)}
|
||||
.tg.is-warn .tg-s{background:#FDE3E0;color:#D2453B}
|
||||
html.night .tg-n{color:#F1E6EE}
|
||||
html.night .tg-s{background:rgba(255,255,255,.1);color:#E9D6E2}
|
||||
/* —— 我的孕期数据:彩色光斑底 + 毛玻璃格 —— */
|
||||
/* 2026-10-31 用户:背景太乱太花 → 整块只留一层很淡的暖色底,格子去掉光晕和毛玻璃,字一律实色 */
|
||||
.vt{position:relative;margin-top:18px;padding:14px 12px 12px;border-radius:22px;background:linear-gradient(180deg,#FFE9DF,#FFF4EE);border:1px solid #F6DCD1}
|
||||
.vt.hide,.vt-it.hide{display:none}
|
||||
.vt-h{display:flex;align-items:baseline;gap:8px;margin:0 4px 11px}
|
||||
.vt-h b{font-size:15.5px;color:#3B2A2A}
|
||||
.vt-h span{font-size:11.5px;color:#7A6663}
|
||||
.vt-row{display:grid;grid-template-columns:repeat(2,1fr);gap:9px}
|
||||
.vt-it{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:11px 12px 11px;border-radius:16px;min-width:0;text-align:left;font:inherit;color:inherit;background:var(--vt-bg,#fff);border:0;box-shadow:0 2px 8px rgba(190,120,100,.06)}
|
||||
.vt-it.span2{grid-column:span 2}
|
||||
.vt-top{display:flex;align-items:center;gap:6px;width:100%}
|
||||
.vt-ic{flex:none;width:26px;height:26px;border-radius:9px;display:grid;place-items:center;color:var(--vt-c);background:#fff}
|
||||
.vt-ic svg{width:18px;height:18px}
|
||||
.vt-l{font-size:13.5px;color:#2F2424;font-weight:700;white-space:nowrap}
|
||||
.vt-u{margin-left:auto;font-size:11px;color:#7A6663}
|
||||
.vt-v{margin-top:2px;white-space:nowrap}
|
||||
.vt-v b{font-size:25px;line-height:1.15;font-weight:800;letter-spacing:-.5px;color:#3B2A2A;font-variant-numeric:tabular-nums}
|
||||
.vt-f{display:flex;align-items:center;gap:6px;width:100%;min-width:0}
|
||||
.vt-s{flex:none;font-size:11px;line-height:1.4;padding:1px 8px;border-radius:99px;background:#fff;color:var(--vt-c);font-weight:700;white-space:nowrap}
|
||||
.vt-s:empty{display:none}
|
||||
.vt-it.empty:not(.demo) .vt-s{background:none;padding:1px 0;color:var(--vt-c)}
|
||||
.vt-s.ok{background:rgba(47,138,94,.12);color:#2F8A5E}
|
||||
.vt-s.hi{background:rgba(210,69,59,.12);color:#D2453B}
|
||||
.vt-s.lo{background:rgba(199,122,30,.14);color:#C77A1E}
|
||||
.vt-d{font-size:11px;color:#6E5A57;white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
||||
.vt-d:empty{display:none}
|
||||
/* 每格一层很淡的同色底(2026-10-31 用户:稍微加一点点背景色) */
|
||||
.vt-k{--vt-c:#E9673F;--vt-bg:#FFF5F0}
|
||||
.vt-w{--vt-c:#E5606A;--vt-bg:#FFF4F4}
|
||||
.vt-p{--vt-c:#C94F8C;--vt-bg:#FDF3F8}
|
||||
.vt-g{--vt-c:#22968A;--vt-bg:#F0FAF8}
|
||||
.vt-c{--vt-c:#7A5BC8;--vt-bg:#F6F2FD}
|
||||
.vt-e{--vt-c:#4E74C4;--vt-bg:#F1F5FD}
|
||||
html.night .vt{background:#2A2231;border-color:rgba(255,255,255,.08)}
|
||||
html.night .vt-it{background:rgba(255,255,255,.07);border-color:rgba(255,255,255,.1);box-shadow:none}
|
||||
html.night .vt-ic,html.night .vt-s{background:rgba(255,255,255,.1)}
|
||||
html.night .vt-h b,html.night .vt-v b{color:#F3E8F0}
|
||||
html.night .vt-l{color:#CDBBC8}
|
||||
</style>
|
||||
<!-- 此刻(2026-10-01 需求文档 v1.0 第二节;同日两次改版)。数据 GET /api/mp/public/mama-box/pulse,渲染在 app.js pulseCard()。
|
||||
⚠️ 模拟数据是产品负责人 2026-10-01 拍板的例外(AGENTS.md §4.12),只限这一条。
|
||||
用户 2026-10-01:「把此刻跟上面的孕育工具结合到一起……此刻相当于上面那个卡片的一个轻量化的展示」
|
||||
@@ -337,28 +405,57 @@
|
||||
⚠️ 一周 7 个圆点 = 这一周的第 1–7 天。今天及以前可以点开回看;以后的几天锁着,
|
||||
写「明天见」—— 让每天回来看一条,而不是一口气翻完。 -->
|
||||
<section class="preg-tips hide" id="pregTips">
|
||||
<!-- 2026-10-01 用户要求:标题前写明孕周 ——「孕 26 周 · 今日孕期小知识」,按她填的孕周自动取,每天换一条;整块压矮一些。
|
||||
#ptWk 由 renderTips() 写;#ptWhen 改成「第 N 天」。下面四张小卡由 2×2 改成一行横滑,高度省一半。 -->
|
||||
<div class="pt-head">
|
||||
<h2 class="pt-title"><span class="pt-wk" id="ptWk">孕 — 周</span>今日孕期小知识</h2>
|
||||
<span class="pt-when" id="ptWhen"></span>
|
||||
</div>
|
||||
<div class="pt-today" id="ptToday">
|
||||
<span class="pt-float" id="ptFloat" aria-hidden="true"></span>
|
||||
<span class="pt-badge" id="ptBadge">今日小知识</span>
|
||||
<div class="pt-body" id="ptBody">
|
||||
<div class="pt-t" id="ptT"></div>
|
||||
<div class="pt-d" id="ptD"></div>
|
||||
</div>
|
||||
<div class="pt-days" id="ptDays" role="tablist" aria-label="本周每天的小知识"></div>
|
||||
</div>
|
||||
<!-- 2026-10-01 用户要求:四张卡不在首页放文字,只留图标 + 标题四个入口,点进详情页 #detailTips 看全文 -->
|
||||
<div class="pt-chips" id="ptChips">
|
||||
<button type="button" class="pt-chip pc-baby" data-pt="baby"><i id="ptChipBaby" aria-hidden="true">👶</i><span>宝宝这周</span></button>
|
||||
<button type="button" class="pt-chip pc-mom" data-pt="mom"><i aria-hidden="true">🤰</i><span>妈妈身体</span></button>
|
||||
<button type="button" class="pt-chip pc-eat" data-pt="eat"><i aria-hidden="true">🥗</i><span>吃点什么</span></button>
|
||||
<button type="button" class="pt-chip pc-care" data-pt="care"><i aria-hidden="true">📋</i><span>这周留心</span></button>
|
||||
<!-- 2026-10-31 用户定:「孕期小知识」首页这块改成「其他妈妈也在搜」(照用户给的参考图):
|
||||
黄色荧光笔大标题 + 一排 10 个妈妈头像 + 参考图上那 6 个问题(固定,assets/data/qa/hot.json 前 6 条),
|
||||
其余问题在「查看全部」进的 #detailQA 里。渲染在 app.js renderSearch()。 -->
|
||||
<div class="ms-head">
|
||||
<h2 class="ms-title"><span>其他妈妈也在搜</span></h2>
|
||||
<span class="ms-wk" id="msWk"></span>
|
||||
</div>
|
||||
<div class="ms-who"><span class="ms-avs" id="msAvs" aria-hidden="true"></span><span class="ms-cnt" id="msCnt"></span></div>
|
||||
<div class="ms-list" id="msList"></div>
|
||||
<button type="button" class="ms-all ripple hide" id="msAll"></button>
|
||||
<style>
|
||||
.ms-head{display:flex;align-items:center;gap:8px}
|
||||
.ms-title{margin:0;font-size:21px;font-weight:900;font-style:italic;letter-spacing:.5px;color:#2A1E1E}
|
||||
.ms-title span{background:linear-gradient(transparent 58%,#FFE066 58%,#FFE066 92%,transparent 92%);padding:0 3px}
|
||||
.ms-wk{margin-left:auto;padding:2px 9px;border-radius:99px;background:#FFEDE6;color:#E0573A;font-size:11.5px;font-weight:700}
|
||||
.ms-who{display:flex;align-items:center;gap:8px;margin:10px 0 4px}
|
||||
.ms-avs{display:flex}
|
||||
.ms-avs img{width:26px;height:26px;border-radius:50%;object-fit:cover;border:2px solid #fff;background:#FFE3D3;margin-left:-7px;box-shadow:0 2px 5px rgba(160,100,90,.15)}
|
||||
.ms-avs img:first-child{margin-left:0}
|
||||
.ms-cnt{font-size:12px;color:#9A8380}
|
||||
.ms-list{display:flex;flex-direction:column}
|
||||
.ms-it{display:flex;align-items:center;gap:10px;width:100%;padding:11px 2px;border:0;border-bottom:1px dashed #F1DDD6;background:none;font:inherit;color:inherit;text-align:left;text-decoration:none}
|
||||
.ms-it:last-child{border-bottom:0}
|
||||
.ms-no{flex:none;width:20px;font-size:16px;font-weight:900;font-style:italic;color:#C9B4AF;text-align:center}
|
||||
.ms-it:nth-child(1) .ms-no{color:#F2533A}
|
||||
.ms-it:nth-child(2) .ms-no{color:#F7843F}
|
||||
.ms-it:nth-child(3) .ms-no{color:#F5AE3A}
|
||||
.ms-m{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
|
||||
.ms-q{min-width:0;font-size:15.5px;line-height:1.4;font-weight:600;color:#2F2424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.ms-h{display:flex;align-items:center;gap:3px;font-size:11.5px;color:#B39C97}
|
||||
.ms-h svg{width:13px;height:13px;color:#F2694A}
|
||||
.ms-h b{font-weight:500}
|
||||
.ms-it:nth-child(-n+3) .ms-h{color:#E8613F}
|
||||
.ms-it:nth-child(-n+3) .ms-h b{font-weight:700}
|
||||
.ms-bd{flex:none;min-width:20px;padding:0 5px;border-radius:6px 6px 6px 2px;font-size:11px;line-height:18px;font-weight:800;text-align:center;background:#FFE7DF;color:#E8492F}
|
||||
.ms-bd.bao{background:linear-gradient(135deg,#FF7A45,#F2394A);color:#fff;box-shadow:0 3px 8px rgba(242,57,74,.28)}
|
||||
.ms-bd.new{background:#E6F5EC;color:#2F8A5E}
|
||||
.ms-it:nth-child(-n+3) .ms-no{font-size:18px}
|
||||
.ms-tag{flex:none;padding:0 6px;border-radius:6px;font-size:10.5px;line-height:17px;font-weight:700;background:#FFF1DC;color:#C77A1E}
|
||||
.ms-tag.hot{background:#FFE4DE;color:#E8492F}
|
||||
.ms-tag.new{background:#E6F5EC;color:#2F8A5E}
|
||||
.ms-go{flex:none;font-style:normal;font-size:18px;color:#D9C2BC}
|
||||
.ms-all{display:block;width:100%;text-align:center;margin:6px 0 2px;padding:10px;border:0;border-radius:14px;background:#FFF1EA;font:inherit;font-size:13.5px;font-weight:700;color:#E0573A}
|
||||
.ms-all.hide{display:none}
|
||||
html.night .ms-all{background:rgba(255,255,255,.07);color:#F3A58F}
|
||||
html.night .ms-title{color:#F3E8F0}
|
||||
html.night .ms-title span{background:linear-gradient(transparent 58%,rgba(255,214,90,.45) 58%,rgba(255,214,90,.45) 92%,transparent 92%)}
|
||||
html.night .ms-q{color:#EFE3EA}
|
||||
html.night .ms-it{border-color:rgba(255,255,255,.1)}
|
||||
html.night .ms-avs img{border-color:#2A2231}
|
||||
</style>
|
||||
<p class="pt-foot">仅供参考,身体有任何不适请以医生意见为准</p>
|
||||
</section>
|
||||
|
||||
@@ -416,7 +513,9 @@
|
||||
· AI 小结做成「宝宝写给妈妈的一张便签」:信纸横线 + 宝宝口吻 + 落款小名。
|
||||
⚠️ 「AI」角标必须保留(唯一的机器生成提示,见 syncBabyWords 那段注释)。
|
||||
JS 依赖的 id / class(.today-line / #tlSteps / .step 系列 / #tlGuide* / .ai-bubble / .ab-say / #abTag / #tlTitle)都沿用。 -->
|
||||
<section class="today-line fp2">
|
||||
<!-- 2026-10-31 用户:「把宝宝的今日脚印这个模块去掉」→ 整块不显示(含祈福掀角、AI 便签)。
|
||||
节点先留着:app.js 足迹 / AI 小结 / 此刻 等逻辑还在往里面写数,删节点要连带改 JS。 -->
|
||||
<section class="today-line fp2" hidden style="display:none">
|
||||
<!-- 2026-10-05 祈福树入口(用户:「放到今日脚印的右上角,把右上角掀开一点,露出祈福树」):
|
||||
卡片右上角像纸一样折起一角(.pl-flap 是翻过来的纸背),底下那块(.pl-hole)露出祈福树;点它跳祈福树(js/app.js #fpQifu)。
|
||||
之前放在工具卡右上角 / 头图底边的版本已撤,工具卡恢复「所有工具 ›」。样式见 mama-box.css「祈福树入口 · 今日脚印掀角」。 -->
|
||||
@@ -1232,6 +1331,69 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ================= 其他妈妈也在搜 · 全部问题(2026-10-31)=================
|
||||
首页 #pregTips 只露 6 条,其余在这里:取 assets/data/qa/hot.json(24 条,前 6 条是首页那 6 个),
|
||||
分类筛选 + 点开看答案;从首页点某一条进来,自动展开并滚到那一条。渲染在 app.js openQA()。 -->
|
||||
<section class="detail" id="detailQA">
|
||||
<div class="detail-bar">
|
||||
<button class="dt-back" data-detail="close">‹</button>
|
||||
<span class="dt-title" id="qaTitle">其他妈妈也在搜</span>
|
||||
</div>
|
||||
<div class="detail-body qa-page">
|
||||
<div class="qa-hero">
|
||||
<b id="qaHeroT">这周孕妈都在问</b>
|
||||
<span id="qaHeroD"></span>
|
||||
</div>
|
||||
<div class="qa-cats" id="qaCats" role="tablist"></div>
|
||||
<a class="qa-topic hide" id="qaTopic" href="topic/wen/">
|
||||
<img src="topic/wen/img/hero.webp" alt="" loading="lazy">
|
||||
<span><em>孕期专题</em><b>妊娠纹怎么防?现在该抹什么</b></span><i>›</i>
|
||||
</a>
|
||||
<div class="qa-list" id="qaList"></div>
|
||||
<button type="button" class="qa-more" id="qaTips">看看本周每日小知识 ›</button>
|
||||
<p class="pt-foot">仅供参考,身体有任何不适请以医生意见为准</p>
|
||||
</div>
|
||||
<style>
|
||||
.qa-page{padding:6px 16px 40px}
|
||||
.qa-hero{display:flex;flex-direction:column;gap:3px;margin:6px 2px 12px}
|
||||
.qa-hero b{font-size:20px;font-weight:900;color:#2A1E1E}
|
||||
.qa-hero span{font-size:12.5px;color:#7A6663}
|
||||
.qa-cats{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 10px;margin:0 -16px;padding-left:18px;padding-right:18px;scrollbar-width:none}
|
||||
.qa-cats::-webkit-scrollbar{display:none}
|
||||
.qa-cat{flex:none;padding:5px 12px;border-radius:99px;border:1px solid #F1DDD6;background:#fff;font:inherit;font-size:13px;color:#5E4B48}
|
||||
.qa-cat small{margin-left:3px;font-size:11px;color:#A8938F}
|
||||
.qa-cat.on{background:#F4593C;border-color:#F4593C;color:#fff;font-weight:700}
|
||||
.qa-cat.on small{color:rgba(255,255,255,.8)}
|
||||
.qa-topic{display:flex;align-items:center;gap:12px;margin:4px 0 10px;padding:8px 12px 8px 8px;border-radius:16px;background:linear-gradient(110deg,#FFEDE6,#FFF8F4);text-decoration:none;color:inherit}
|
||||
.qa-topic.hide{display:none}
|
||||
.qa-topic img{flex:none;width:54px;height:54px;border-radius:12px;object-fit:cover}
|
||||
.qa-topic span{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
|
||||
.qa-topic em{font-style:normal;font-size:11px;color:#F4593C;font-weight:700}
|
||||
.qa-topic b{font-size:14.5px;color:#2F2424}
|
||||
.qa-topic i{font-style:normal;font-size:20px;color:#E4A595}
|
||||
.qa-list{display:flex;flex-direction:column;gap:8px}
|
||||
.qa-it{border-radius:16px;background:#fff;box-shadow:0 2px 8px rgba(190,120,100,.07);overflow:hidden}
|
||||
.qa-it.hide{display:none}
|
||||
.qa-q{display:flex;align-items:center;gap:10px;width:100%;padding:13px 12px;border:0;background:none;font:inherit;color:inherit;text-align:left}
|
||||
.qa-no{flex:none;width:20px;font-size:15px;font-weight:900;font-style:italic;color:#C9B4AF;text-align:center}
|
||||
.qa-it.top .qa-no{color:#F2533A}
|
||||
.qa-tx{flex:1;min-width:0;font-size:15px;line-height:1.45;font-weight:600;color:#2F2424}
|
||||
.qa-tag{flex:none;padding:0 6px;border-radius:6px;font-size:10.5px;line-height:17px;font-weight:700;background:#F6EEEB;color:#8A7471}
|
||||
.qa-tag.hot{background:#FFE4DE;color:#E8492F}
|
||||
.qa-ch{flex:none;font-style:normal;font-size:16px;color:#D9C2BC;transition:transform .2s}
|
||||
.qa-it.open .qa-ch{transform:rotate(90deg)}
|
||||
.qa-a{display:none;margin:0 12px 13px 42px;padding:10px 12px;border-radius:12px;background:#FFF6F2;font-size:14px;line-height:1.75;color:#4A3B39}
|
||||
.qa-it.open .qa-a{display:block}
|
||||
.qa-it.hit{animation:qaHit 1.2s ease}
|
||||
@keyframes qaHit{0%,40%{box-shadow:0 0 0 2px #F4593C}100%{box-shadow:0 2px 8px rgba(190,120,100,.07)}}
|
||||
.qa-more{display:block;margin:16px auto 4px;padding:8px 16px;border-radius:99px;border:1px solid #F1DDD6;background:#fff;font:inherit;font-size:13px;color:#E0573A}
|
||||
html.night .qa-hero b,html.night .qa-tx,html.night .qa-topic b{color:#F1E6EE}
|
||||
html.night .qa-it,html.night .qa-cat,html.night .qa-more{background:#2F2737;border-color:rgba(255,255,255,.1);box-shadow:none}
|
||||
html.night .qa-a{background:rgba(255,255,255,.06);color:#E3D6DE}
|
||||
html.night .qa-topic{background:linear-gradient(110deg,#3a2a2a,#2c2222)}
|
||||
</style>
|
||||
</section>
|
||||
|
||||
<!-- ================= AI 小结 内容页 ================= -->
|
||||
<section class="detail" id="detailAI">
|
||||
<div class="detail-bar">
|
||||
@@ -2050,7 +2212,7 @@
|
||||
<!-- 2026-10-05 首页头图:宝宝时不时动一动小手小脚(独立文件,删掉这一行即下线) -->
|
||||
<script src="js/baby-limbs.js?v=26101201"></script>
|
||||
<script src="js/coach.js?v=26101211"></script>
|
||||
<script src="js/birth-flow.js?v=26103102"></script>
|
||||
<script src="js/birth-flow.js?v=26103112"></script>
|
||||
|
||||
<!-- 禁止下拉回弹(2026-10-11 统一规则,与孕期体重同一段):竖向拖动时从手指下往上找还能朝该方向滚的容器,找不到才拦;横滑、双指、可滚列表不受影响 -->
|
||||
<script>
|
||||
|
||||
350
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26103102';
|
||||
var VER = '26103112';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -414,19 +414,32 @@
|
||||
const SWAP_POOL = [
|
||||
{ id: 'yunqinengbuchi', name: '能不能吃', sub: '馋了先查一下', btn: '去查查' },
|
||||
{ id: 'bushui', name: '补水补剂', sub: '叶酸吃了吗', btn: '去记录' },
|
||||
{ id: 'yun', name: '孕期血压', sub: '量一量更安心', btn: '去记录' },
|
||||
{ id: 'yunqixuetang', name: '孕期血糖', sub: '餐后记一笔', btn: '去记录' },
|
||||
/* 2026-10-31:血压、血糖已在宫格里常驻,不再进替补池 */
|
||||
{ id: 'daichanqingdan', name: '待产清单', sub: '提前备起来', btn: '去看看' },
|
||||
];
|
||||
let lastCards = null; /* 上一次 tool-cards 的结果:换回原卡后重放 */
|
||||
function swapArt(id) {
|
||||
return '<svg class="mc-art sw-art" viewBox="2 2 20 20" aria-hidden="true" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' + (SWAP_ART[id] || '') + '</svg>';
|
||||
return '<svg class="sw-art" viewBox="2 2 20 20" aria-hidden="true" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' + (SWAP_ART[id] || '') + '</svg>';
|
||||
}
|
||||
/* 首页宫格图标 = 各应用在 App 表里的正式 logo(2026-10-31 用户定);替补坑位取替补应用的 logo,拿不到就保留现有图形 */
|
||||
function toolLogo(id) { const a = APP_BY_ID[id]; return a && (a.logo || a.icon) || ''; }
|
||||
function applyToolLogos() {
|
||||
try { MINI_APP_MAP; } catch (e) { return; } /* 早于 MINI_APP_MAP 定义被调用(替补首次计算)时先跳过,应用列表回来会再调 */
|
||||
$$('.tg[data-mini]').forEach(b => {
|
||||
const u = toolLogo(b.dataset.swap || MINI_APP_MAP[b.dataset.mini]);
|
||||
const ic = b.querySelector('.tg-ic');
|
||||
if (!u || !ic) return;
|
||||
let im = ic.querySelector('img');
|
||||
if (!im || ic.querySelector('svg')) { ic.innerHTML = '<img alt="" aria-hidden="true">'; im = ic.querySelector('img'); }
|
||||
ic.classList.add('lg');
|
||||
if (im.getAttribute('src') !== u) im.src = u;
|
||||
});
|
||||
}
|
||||
function swapHomeCards() {
|
||||
const used = new Set();
|
||||
let restored = false;
|
||||
SWAP_SLOTS.forEach(([slot, id]) => {
|
||||
const el = $('.mini-card[data-mini="' + slot + '"]');
|
||||
const el = $('.tg[data-mini="' + slot + '"]');
|
||||
if (!el) return;
|
||||
const g = STAGE_GATE.find(x => x.id === id);
|
||||
if (!stageLocked(g)) {
|
||||
@@ -443,12 +456,11 @@
|
||||
el.classList.add('is-swap');
|
||||
el.classList.remove('is-warn');
|
||||
el.setAttribute('aria-label', sub.name + ',' + sub.sub);
|
||||
el.innerHTML = slot === 'kick'
|
||||
? '<div class="mc-head"><div class="mc-title">' + sub.name + '</div><div class="mc-sub">' + sub.sub + '</div></div>' +
|
||||
'<span class="mc-btn">' + sub.btn + '</span>' + swapArt(sub.id)
|
||||
: '<div class="mc-title sm">' + sub.name + '</div><div class="mc-sub">' + sub.sub + '</div>' + swapArt(sub.id);
|
||||
/* 2026-10-31 宫格改版:替补也是「图标 + 名字 + 胶囊」,底色沿用坑位的颜色 */
|
||||
el.innerHTML = '<i class="tg-ic">' + swapArt(sub.id) + '</i><span class="tg-n">' + sub.name + '</span><span class="tg-s">' + sub.btn + '</span>';
|
||||
});
|
||||
if (restored && lastCards) applyRemoteCards(lastCards);
|
||||
applyToolLogos();
|
||||
}
|
||||
|
||||
/* 跳转到其它 H5 应用。identifier 可选(来自 App 表),用于 last_app 上报的服务端在架校验;
|
||||
@@ -504,6 +516,7 @@
|
||||
.filter(a => a.url && a.category === '孕期工具')
|
||||
.sort((x, y) => (y.seq || 0) - (x.seq || 0) || (y.no || 0) - (x.no || 0));
|
||||
apps.forEach(a => { APP_BY_ID[a.identifier] = a; }); /* 供首页工具卡按 identifier 取 URL */
|
||||
applyToolLogos();
|
||||
renderAppGrid(apps);
|
||||
})
|
||||
.catch(function () { /* 拉不到就保留弹层原有占位,不影响其余页面 */ });
|
||||
@@ -790,11 +803,13 @@
|
||||
weight: 'yunqitizhong', // 孕期体重管理 (1012)
|
||||
cal: 'chanjianrili', // 孕检日历 (1009)
|
||||
curve: 'gongsuopinlv', // 数宫缩(原「生长曲线」,第九批换坑位)
|
||||
fweight:'taierguzhong' // 胎儿估重 (1037)
|
||||
fweight:'taierguzhong', // 胎儿估重 (1037)
|
||||
bp: 'yun', // 孕期血压(2026-10-31 宫格改版加入)
|
||||
glu: 'yunqixuetang' // 孕期血糖(同上)
|
||||
};
|
||||
const APP_BY_ID = {};
|
||||
$$('[data-mini]').forEach(b => b.addEventListener('click', () => {
|
||||
const map = { kick: '数胎动', weight: '孕期体重', cal: '孕检日历', curve: '数宫缩', fweight: '胎儿估重' };
|
||||
const map = { kick: '数胎动', weight: '孕期体重', cal: '孕检日历', curve: '数宫缩', fweight: '胎儿估重', bp: '孕期血压', glu: '孕期血糖' };
|
||||
const sw = b.dataset.swap; /* 孕周没到、坑位换成了替补(见 swapHomeCards) */
|
||||
const app = APP_BY_ID[sw || MINI_APP_MAP[b.dataset.mini]];
|
||||
if (app && app.url) { jumpApp(app.url, app.identifier); return; }
|
||||
@@ -3355,6 +3370,7 @@
|
||||
applyRemoteAll();
|
||||
applyRemoteFootprint();
|
||||
applyRemoteCardsFetch();
|
||||
loadVitals();
|
||||
syncLaixinReminder();
|
||||
loadBlindbox().then(() => { // 孕期盲盒:要等 ② 的预产期落地(服务端按同一份上游视图算孕周)
|
||||
/* 2026-10-07 用户要盲盒直达链接:地址带 open=box(# 或 ? 里都行)→ 数据到了直接弹盲盒面板。
|
||||
@@ -3682,13 +3698,14 @@
|
||||
function applyRemoteCards(r) {
|
||||
if (!r || r.ok === false || !(r.cards || []).length) return; // 降级:保留现有值
|
||||
lastCards = r;
|
||||
vtCards(r);
|
||||
const bySlot = {};
|
||||
/* 换成替补的坑位(孕周没到)不吃原工具的数据,免得把「馋了先查一下」改成「今天 0 次」 */
|
||||
r.cards.forEach(c => {
|
||||
const el = c && c.slot ? $('.mini-card[data-mini="' + c.slot + '"]') : null;
|
||||
const el = c && c.slot ? $('.tg[data-mini="' + c.slot + '"]') : null;
|
||||
if (c && c.slot && !(el && el.dataset.swap)) bySlot[c.slot] = c;
|
||||
});
|
||||
const cardOf = slot => $('.mini-card[data-mini="' + slot + '"]');
|
||||
const cardOf = slot => $('.tg[data-mini="' + slot + '"]');
|
||||
const mark = (slot, c) => { const el = cardOf(slot); if (el) el.classList.toggle('is-warn', !!c.warn); };
|
||||
const setText = (sel, v) => { const el = $(sel); if (el) el.textContent = v || ''; };
|
||||
|
||||
@@ -3703,7 +3720,7 @@
|
||||
mark('kick', k);
|
||||
}
|
||||
const f = bySlot.fweight;
|
||||
if (f) { setText('.mini-card.fweight .mc-sub', f.text); mark('fweight', f); }
|
||||
if (f) { setText('.tg.fweight .tg-s', f.text); mark('fweight', f); }
|
||||
|
||||
const w = bySlot.weight;
|
||||
if (w) {
|
||||
@@ -3734,7 +3751,7 @@
|
||||
|
||||
const cv = bySlot.curve;
|
||||
if (cv) {
|
||||
const el = $('.mini-card.curve .mc-sub');
|
||||
const el = $('.tg.curve .tg-s');
|
||||
if (el) {
|
||||
/* 有数据时上游 text 是「最近间隔 4分12秒」,那列只有 ≈73px 放不下(会省略掉最关键的数字)→
|
||||
改用紧凑的 value+unit(「4分12秒」);空态 text 本来就是「孕 7 周」这种短句,直接用。 */
|
||||
@@ -4412,7 +4429,7 @@
|
||||
if (!sec) return;
|
||||
let seen = false, last = null, feed = [], fi = 0, ticking = null, peerMode = false, loadedWk = null, shownN = 0;
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]);
|
||||
const tapMini = k => { const b = $('.mini-card[data-mini="' + k + '"]'); if (b) b.click(); };
|
||||
const tapMini = k => { const b = $('.tg[data-mini="' + k + '"]'); if (b) b.click(); };
|
||||
const TODAY_GO = {
|
||||
kick: () => tapMini('kick'),
|
||||
weight: () => tapMini('weight'),
|
||||
@@ -4555,7 +4572,7 @@
|
||||
if (whLoad) whLoad(w);
|
||||
return fetch('/api/mp/public/mama-box/pulse' + (w ? '?week=' + w : ''))
|
||||
.then(r => (r.ok ? r.json() : null))
|
||||
.then(j => { if (j && j.code === 200 && j.result) { last = j.result; paint(); } })
|
||||
.then(j => { if (j && j.code === 200 && j.result) { last = j.result; window.__mbPulse = last; paint(); if (window.__mbHeat) window.__mbHeat(); } })
|
||||
.catch(() => { /* 静默:保持现状(首次失败即一直隐藏) */ });
|
||||
}
|
||||
/* 档案回来孕周才可信 → 孕周变了重拉;否则只是足迹 / 盲盒状态变了,就地重画「和你比」「今日待办」 */
|
||||
@@ -5021,38 +5038,16 @@
|
||||
if (!wk || !(wk.days || []).length) { sec.classList.add('hide'); return; }
|
||||
const today = Math.max(0, Math.min(6, state.day || 0));
|
||||
const size = babySize(w);
|
||||
$('#ptWk').textContent = '孕 ' + state.week + ' 周';
|
||||
$('#ptWhen').textContent = '本周第 ' + (today + 1) + ' 天';
|
||||
/* 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 || '';
|
||||
setHandIco($('#ptChipBaby'), hw && hw.id, size.emoji);
|
||||
$('#ptDtTitle').textContent = '孕 ' + state.week + ' 周 · 这一周';
|
||||
/* 一周 7 个圆点:以前可回看,今天实心,以后锁着 */
|
||||
const box = $('#ptDays');
|
||||
box.textContent = '';
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const b = document.createElement('button');
|
||||
b.type = 'button';
|
||||
b.className = 'pt-day ' + (i < today ? 'is-past' : i === today ? 'is-today' : 'is-lock');
|
||||
b.setAttribute('role', 'tab');
|
||||
const n = document.createElement('i'); n.textContent = i + 1;
|
||||
const t = document.createElement('span');
|
||||
t.textContent = i === today ? '今天' : (i === today + 1 ? '明天' : '\u00a0'); // 圈里已是「第几天」,只给今天/明天配字
|
||||
b.appendChild(n); b.appendChild(t);
|
||||
b.addEventListener('click', () => {
|
||||
if (i > today) { toast(i === today + 1 ? '明天再来看新的小知识~' : '到那天再来看哦~'); return; }
|
||||
showTip(wk, i, today);
|
||||
});
|
||||
box.appendChild(b);
|
||||
}
|
||||
/* 详情页「本周每日小知识」:今天在上,往前倒着排到第 1 天;后面几天只露一行「明天见」 */
|
||||
const list = $('#ptList');
|
||||
list.textContent = '';
|
||||
@@ -5074,25 +5069,138 @@
|
||||
lk.textContent = '第 ' + (today + 2) + (today < 5 ? '–7' : '') + ' 天 · 明天见,每天解锁一条';
|
||||
list.appendChild(lk);
|
||||
}
|
||||
tipSel = -1;
|
||||
showTip(wk, today, today);
|
||||
renderSearch(wk, today, size);
|
||||
sec.classList.remove('hide');
|
||||
revealTipsGrid();
|
||||
}
|
||||
function showTip(wk, i, today) {
|
||||
if (i === tipSel) return;
|
||||
tipSel = i;
|
||||
const d = wk.days[i] || wk.days[0];
|
||||
$('#ptBadge').textContent = i === today ? '今日小知识' : '第 ' + (i + 1) + ' 天 · 回看';
|
||||
$('#ptT').textContent = d.t || '';
|
||||
$('#ptD').textContent = d.d || '';
|
||||
$$('#ptDays .pt-day').forEach((b, k) => {
|
||||
b.classList.toggle('is-sel', k === i);
|
||||
b.setAttribute('aria-selected', k === i ? 'true' : 'false');
|
||||
});
|
||||
const body = $('#ptBody');
|
||||
body.classList.remove('is-in'); void body.offsetWidth; body.classList.add('is-in'); // 重播进场动画
|
||||
/* 2026-10-31 首页「其他妈妈也在搜」(用户给了参考图,定了问题):问题库 assets/data/qa/hot.json,共 24 条,
|
||||
前 6 条就是参考图上那 6 个问题,首页只露这 6 条;点任意一条 / 「查看全部」进 #detailQA 看答案和其余问题。
|
||||
条目字段:q 问题 / a 答案 / tag 分类 / hot 热 / href 有专题页的直接跳 / quiz 答案区是「测一测」小测试。
|
||||
问题库没加载到时退回 5 条本周小知识入口(落点 #detailTips),首页不空。 */
|
||||
let QA = null, qaLoading = null;
|
||||
function loadQA() {
|
||||
if (QA) return Promise.resolve(QA);
|
||||
if (!qaLoading) qaLoading = fetch('assets/data/qa/hot.json?v=' + VER).then(r => (r.ok ? r.json() : [])).catch(() => [])
|
||||
.then(a => (QA = Array.isArray(a) ? a : []));
|
||||
return qaLoading;
|
||||
}
|
||||
const qaHref = h => h + location.search + location.hash;
|
||||
const MS_FIRE = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12.6 2.5c.4 3-1.6 4.6-3 6.2C8 10.4 7 12 7 14.3A5 5 0 0012 19.5a5 5 0 005-5.2c0-2-1-3.6-1.9-4.6-.2 1.3-.9 2.2-1.9 2.6.6-3.4-.2-7-.6-9.8z" fill="currentColor"/><path d="M12 19.5a2.6 2.6 0 01-2.6-2.6c0-1.6 1.3-2.5 2-3.6.3 1 .9 1.6 1.6 1.9.9.4 1.6 1.2 1.6 2.1A2.6 2.6 0 0112 19.5z" fill="#FFD36B"/></svg>';
|
||||
function msHeat() {
|
||||
const p = window.__mbPulse, tot = (p && p.total && +p.total.value) || 1510000;
|
||||
$$('#msList .ms-h').forEach(h => {
|
||||
const n = tot * (+h.dataset.heat || 0);
|
||||
h.querySelector('b').textContent = (n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : Math.round(n)) + ' 人看过';
|
||||
});
|
||||
}
|
||||
window.__mbHeat = msHeat;
|
||||
function renderSearch(wk, today, size) {
|
||||
const W = state.week, L = $('#msList');
|
||||
if (!L) return;
|
||||
if (!QA) loadQA().then(q => { if (q.length) renderSearch(wk, today, size); });
|
||||
$('#msWk').textContent = '孕 ' + W + ' 周';
|
||||
$('#msCnt').textContent = '孕 ' + W + ' 周的妈妈都在看';
|
||||
const pool = AVA_TOP.concat(AVA_FEED), s0 = (W * 7) % pool.length;
|
||||
$('#msAvs').innerHTML = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(i => avaImg(pool[(s0 + i * 3) % pool.length])).join('');
|
||||
const bank = QA || [];
|
||||
let items;
|
||||
if (bank.length) {
|
||||
items = bank.slice(0, 6).map((x, i) => ({ q: x.q, href: x.href ? qaHref(x.href) : '', qa: i, badge: x.badge, heat: x.heat }));
|
||||
} else {
|
||||
const q = t => /[??吗呢]$/.test(t) ? t : t + (/怎么办|什么|多少|怎么|几/.test(t) ? '?' : '');
|
||||
const d0 = wk.days[today];
|
||||
items = [];
|
||||
if (d0 && d0.t) items.push({ q: q(d0.t), pt: '' });
|
||||
items.push({ q: '孕' + W + '周,宝宝长多大了?', pt: 'baby' });
|
||||
items.push({ q: '这周身体会有哪些变化?', pt: 'mom' });
|
||||
items.push({ q: '孕' + W + '周吃什么对宝宝好?', pt: 'eat' });
|
||||
items.push({ q: '这周产检和生活要留心什么?', pt: 'care' });
|
||||
}
|
||||
L.textContent = '';
|
||||
items.forEach((it, i) => {
|
||||
const el = document.createElement(it.href ? 'a' : 'button');
|
||||
el.className = 'ms-it ripple';
|
||||
if (it.href) el.href = it.href;
|
||||
else { el.type = 'button'; el.addEventListener('click', () => (it.qa != null ? openQA(it.qa) : openTips(it.pt))); }
|
||||
const no = document.createElement('i'); no.className = 'ms-no'; no.textContent = i + 1;
|
||||
const m = document.createElement('span'); m.className = 'ms-m';
|
||||
const t = document.createElement('span'); t.className = 'ms-q'; t.textContent = it.q;
|
||||
m.appendChild(t);
|
||||
/* 热度行:火苗 + 「N 万人看过」。人数 = 「此刻」同一个总人数(后台 pulseBase)× 每条固定比例,和首页其它人数同一口径 */
|
||||
if (it.heat) { const h = document.createElement('span'); h.className = 'ms-h'; h.dataset.heat = it.heat; h.innerHTML = MS_FIRE + '<b></b>'; m.appendChild(h); }
|
||||
el.appendChild(no); el.appendChild(m);
|
||||
if (it.badge) { const g = document.createElement('span'); g.className = 'ms-bd' + (it.badge === '爆' ? ' bao' : it.badge === '新' ? ' new' : ''); g.textContent = it.badge; el.appendChild(g); }
|
||||
const go = document.createElement('i'); go.className = 'ms-go'; go.textContent = '›'; el.appendChild(go);
|
||||
L.appendChild(el);
|
||||
});
|
||||
msHeat();
|
||||
const all = $('#msAll');
|
||||
if (all) {
|
||||
all.classList.toggle('hide', bank.length <= 6);
|
||||
all.textContent = '查看全部 ' + bank.length + ' 个问题 ›';
|
||||
}
|
||||
}
|
||||
/* 全部问题页:focus = 从首页点的那条的下标(展开 + 滚到它);不传 = 从「查看全部」进来 */
|
||||
function openQA(focus) {
|
||||
const bank = QA || [];
|
||||
if (!bank.length) { openTips(); return; }
|
||||
$('#qaTitle').textContent = '其他妈妈也在搜';
|
||||
$('#qaHeroT').textContent = '妈妈们最常问的 ' + bank.length + ' 个问题';
|
||||
$('#qaHeroD').textContent = '点开问题看答案';
|
||||
$('#qaTopic').classList.add('hide');
|
||||
const cats = [];
|
||||
bank.forEach(x => { if (x.tag && cats.indexOf(x.tag) < 0) cats.push(x.tag); });
|
||||
const cb = $('#qaCats');
|
||||
cb.textContent = '';
|
||||
['全部'].concat(cats).forEach(c => {
|
||||
const b = document.createElement('button');
|
||||
b.type = 'button'; b.className = 'qa-cat'; b.dataset.cat = c;
|
||||
b.textContent = c;
|
||||
const sm = document.createElement('small'); sm.textContent = c === '全部' ? bank.length : bank.filter(x => x.tag === c).length;
|
||||
b.appendChild(sm);
|
||||
b.addEventListener('click', () => qaFilter(c));
|
||||
cb.appendChild(b);
|
||||
});
|
||||
const L = $('#qaList');
|
||||
L.textContent = '';
|
||||
bank.forEach((x, i) => {
|
||||
const it = document.createElement('div');
|
||||
it.className = 'qa-it' + (i < 6 ? ' top' : '');
|
||||
it.dataset.cat = x.tag || '';
|
||||
const h = document.createElement('button'); h.type = 'button'; h.className = 'qa-q';
|
||||
const no = document.createElement('i'); no.className = 'qa-no'; no.textContent = i + 1;
|
||||
const t = document.createElement('span'); t.className = 'qa-tx'; t.textContent = x.q;
|
||||
const g = document.createElement('span'); g.className = 'qa-tag' + (x.badge ? ' hot' : ''); g.textContent = x.href ? '专题' : (x.tag || '');
|
||||
const ch = document.createElement('i'); ch.className = 'qa-ch'; ch.textContent = '›';
|
||||
h.appendChild(no); h.appendChild(t); if (g.textContent) h.appendChild(g); h.appendChild(ch);
|
||||
const a = document.createElement('div'); a.className = 'qa-a';
|
||||
a.textContent = x.a || '';
|
||||
/* 有专题页的条目(首页那 6 个)点了直接进专题页 */
|
||||
h.addEventListener('click', () => { if (x.href) { haptic(); location.href = qaHref(x.href); return; } it.classList.toggle('open'); haptic(); });
|
||||
it.appendChild(h); it.appendChild(a);
|
||||
L.appendChild(it);
|
||||
});
|
||||
qaFilter('全部');
|
||||
openPanel('detailQA');
|
||||
const body = $('#detailQA .detail-body');
|
||||
body.scrollTop = 0;
|
||||
if (focus != null && L.children[focus] && !bank[focus].href) {
|
||||
const c = L.children[focus];
|
||||
c.classList.add('open');
|
||||
setTimeout(() => {
|
||||
body.scrollTo({ top: Math.max(0, c.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop - 12), behavior: 'smooth' });
|
||||
c.classList.remove('hit'); void c.offsetWidth; c.classList.add('hit');
|
||||
}, 400); // 等详情页滑入再滚
|
||||
}
|
||||
}
|
||||
function qaFilter(c) {
|
||||
$$('#qaCats .qa-cat').forEach(b => b.classList.toggle('on', b.dataset.cat === c));
|
||||
$$('#qaList .qa-it').forEach(it => it.classList.toggle('hide', c !== '全部' && it.dataset.cat !== c));
|
||||
}
|
||||
(function () {
|
||||
const all = $('#msAll'); if (all) all.addEventListener('click', () => openQA());
|
||||
const tp = $('#qaTips'); if (tp) tp.addEventListener('click', () => openTips());
|
||||
})();
|
||||
/* 首页四个入口 → 详情页,滚到对应那张卡并闪一下 */
|
||||
function openTips(key) {
|
||||
openPanel('detailTips');
|
||||
@@ -5105,13 +5213,6 @@
|
||||
c.classList.remove('is-hit'); void c.offsetWidth; c.classList.add('is-hit');
|
||||
}, 400); // 等详情页滑入再滚
|
||||
}
|
||||
(function () {
|
||||
const ch = $('#ptChips');
|
||||
if (ch) ch.addEventListener('click', e => { const b = e.target.closest('.pt-chip'); if (b) openTips(b.dataset.pt); });
|
||||
/* 首页今日小知识大卡也能点进详情页;底下 7 个圆点仍是切换回看,不跳页 */
|
||||
const td = $('#ptToday');
|
||||
if (td) td.addEventListener('click', e => { if (!e.target.closest('#ptDays')) openTips(); });
|
||||
})();
|
||||
function revealTipsGrid() {
|
||||
const g = $('#ptGrid');
|
||||
if (!g || g.classList.contains('is-shown')) return;
|
||||
@@ -5140,6 +5241,133 @@
|
||||
],
|
||||
} : null;
|
||||
|
||||
/* ---------- 我的孕期数据(体重 / 血压 / 血糖,2026-10-31 用户定) ----------
|
||||
上游 /user/app-cards 只聚合了五张工具卡,没有血压、血糖 → 这里直接读三个工具自己的数据(只读):
|
||||
· 体重 yunqi-tizhong:GET /taidong/api/state → pw_data_v1.weights(跳过 demo:true 示例记录)
|
||||
· 血糖 yunqi-xuetang:GET /taidong/api/state → tmrj.v1.readings(跳过 demo:1 与老种子 id 如 r29fasting)
|
||||
· 血压 yunqi-xueya :GET /taidong/api/xueya/records(服务端只存真实记录)
|
||||
每个工具单独 openid-login 换 token(state 按 app_id 分区),token 在 sessionStorage 缓存 20 分钟。
|
||||
回到前台 / bfcache 恢复时重拉:妈妈在工具里刚填完,回首页就看到新数。 */
|
||||
const VT_API = '/taidong/api';
|
||||
const VT_SLOT = { fasting: '空腹', b1: '早餐后1h', b2: '早餐后2h', l1: '午餐后1h', l2: '午餐后2h', d1: '晚餐后1h', d2: '晚餐后2h', bed: '睡前', night: '夜间' };
|
||||
const VT_TGT = { fasting: [3.3, 5.3], b1: [3.3, 7.8], l1: [3.3, 7.8], d1: [3.3, 7.8], b2: [3.3, 6.7], l2: [3.3, 6.7], d2: [3.3, 6.7], bed: [4.4, 6.7], night: [3.3, 6.7] };
|
||||
let _vtAt = 0;
|
||||
function vtToken(app) {
|
||||
const openid = hashParam('openid'), unionid = hashParam('unionid');
|
||||
const ck = 'mmbox.vt.tok.' + app;
|
||||
try { const c = JSON.parse(sessionStorage.getItem(ck) || 'null'); if (c && c.o === openid && Date.now() - c.t < 20 * 60e3) return Promise.resolve(c.k); } catch (e) {}
|
||||
return fetch(VT_API + '/auth/openid-login', {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ openid: openid, unionid: unionid || null, app_id: app })
|
||||
}).then(r => (r.ok ? r.json() : null)).then(j => {
|
||||
const k = j && (j.token || (j.data && j.data.token)); if (!k) return null;
|
||||
try { sessionStorage.setItem(ck, JSON.stringify({ o: openid, k: k, t: Date.now() })); } catch (e) {}
|
||||
return k;
|
||||
});
|
||||
}
|
||||
function vtGet(app, path) {
|
||||
return vtToken(app).then(k => k ? fetch(VT_API + path, { headers: { Authorization: 'Bearer ' + k } }).then(r => (r.ok ? r.json() : null)) : null).catch(() => null);
|
||||
}
|
||||
function vtVal(items, key) { /* state 条目可能是 {value:"…json…"} 或直接值 */
|
||||
let v = items && items[key];
|
||||
if (v && typeof v === 'object' && 'value' in v) v = v.value;
|
||||
if (typeof v === 'string') { try { v = JSON.parse(v); } catch (e) { v = null; } }
|
||||
return v && typeof v === 'object' ? v : null;
|
||||
}
|
||||
function vtDay(d) { /* 'YYYY-MM-DD…' 或时间戳 → 今天 / 昨天 / M月D日 */
|
||||
const t = typeof d === 'number' ? new Date(d) : parseDay(String(d || '').slice(0, 10));
|
||||
if (!t || isNaN(t)) return '';
|
||||
const a = new Date(); a.setHours(0, 0, 0, 0);
|
||||
const b = new Date(t); b.setHours(0, 0, 0, 0);
|
||||
const n = Math.round((a - b) / DAY_MS);
|
||||
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 };
|
||||
/* 2026-10-31 用户:去掉「示例」两个字,没记过的格直接按正常数据的样子显示(值 / 胶囊 / 胶囊样式 / 时间) */
|
||||
const VT_DEMO = { kick: ['12', '今天', '', '最近 14:20'], weight: ['58.2', '比孕前 +4.6', '', '今天记录'], bp: ['115/75', '正常', 'ok', '昨天记录'], glu: ['5.1', '达标', 'ok', '今天 空腹'] }; /* 这两格有记录才出现 */
|
||||
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' : '';
|
||||
/* 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 ? dm[1] : (key === 'kick' ? '去数一数 ›' : '去记一笔 ›')); s.className = 'vt-s' + (val && cls ? ' ' + cls : dm && dm[2] ? ' ' + dm[2] : '');
|
||||
$('#' + id + 'd').textContent = val ? (when || '') : (dm ? dm[3] : '');
|
||||
vtLayout();
|
||||
}
|
||||
/* 记过的格排前面;数宫缩 / 胎儿估重没记录就不出现;孕周没到的数胎动没记录也先不出现;单数时最后一格占满一行 */
|
||||
function vtLayout() {
|
||||
const its = $$('.vt-it[data-vt]');
|
||||
const kg = STAGE_GATE.find(x => x.id === 'taidong');
|
||||
its.forEach(it => {
|
||||
const k = it.dataset.vt, has = !!it.dataset.has;
|
||||
it.classList.toggle('hide', !has && (VT_EXTRA[k] || (k === 'kick' && stageLocked(kg))));
|
||||
it.style.order = has ? 0 : 1;
|
||||
it.classList.remove('span2');
|
||||
});
|
||||
const vis = its.filter(it => !it.classList.contains('hide')).sort((a, b) => (+a.style.order - +b.style.order) || (its.indexOf(a) - its.indexOf(b)));
|
||||
if (vis.length % 2) vis[vis.length - 1].classList.add('span2');
|
||||
}
|
||||
/* 胎动 / 数宫缩 / 胎儿估重 来自卡片接口(tool-cards),applyRemoteCards 收到就喂进来 */
|
||||
function vtCards(r) {
|
||||
const by = {}; ((r && r.cards) || []).forEach(c => { if (c && c.slot) by[c.slot] = c; });
|
||||
const k = by.kick;
|
||||
if (k) vtSet('kick', !k.empty && +k.value > 0 ? String(k.value) : '', '今天', '', String(k.sub || '').replace(/^.*·\s*/, ''));
|
||||
const c = by.curve;
|
||||
if (c) vtSet('curve', !c.empty && c.value ? c.value + (c.unit || '') : '', '最近一次', '', c.sub || '');
|
||||
const f = by.fweight;
|
||||
if (f) vtSet('fweight', !f.empty && (f.value || f.text) ? (f.value ? f.value + (f.unit || '') : f.text) : '', '', '', f.sub || '');
|
||||
}
|
||||
function loadVitals() {
|
||||
const box = $('#vitals'); if (!box) return;
|
||||
if (!hashParam('openid') || state.postpartum) { box.classList.add('hide'); return; }
|
||||
box.classList.remove('hide');
|
||||
_vtAt = Date.now();
|
||||
vtLayout();
|
||||
vtGet('yunqi-tizhong', '/state').then(j => {
|
||||
const pw = vtVal(j && j.items, 'pw_data_v1');
|
||||
const ws = ((pw && pw.weights) || []).filter(w => w && !w.demo && +w.weight > 0).sort((a, b) => String(a.date).localeCompare(String(b.date)) || (a.updatedAt || 0) - (b.updatedAt || 0));
|
||||
const last = ws[ws.length - 1];
|
||||
if (!last) { vtSet('weight', ''); return; }
|
||||
const pre = pw && !pw.demo && pw.profile && +pw.profile.preWeight;
|
||||
const gain = pre ? Math.round((last.weight - pre) * 10) / 10 : null;
|
||||
vtSet('weight', (+last.weight).toFixed(1), gain != null ? '比孕前 ' + (gain >= 0 ? '+' : '') + gain : '', '', vtDay(last.date) + '记录');
|
||||
});
|
||||
vtGet('yunqi-xueya', '/xueya/records?limit=5').then(j => {
|
||||
const rs = ((j && j.items) || []).filter(r => r && r.systolic && r.diastolic).sort((a, b) => String(b.measured_at).localeCompare(String(a.measured_at)));
|
||||
const r = rs[0];
|
||||
if (!r) { vtSet('bp', ''); return; }
|
||||
const sy = +r.systolic, di = +r.diastolic;
|
||||
/* 孕期口径:≥140/90 偏高(≥160/110 很高),<90/60 偏低 */
|
||||
const st = (sy >= 160 || di >= 110) ? ['很高,请就医', 'hi'] : (sy >= 140 || di >= 90) ? ['偏高', 'hi'] : (sy < 90 || di < 60) ? ['偏低', 'lo'] : ['正常', 'ok'];
|
||||
vtSet('bp', sy + '/' + di, st[0], st[1], vtDay(r.measured_at) + '记录');
|
||||
});
|
||||
vtGet('yunqi-xuetang', '/state').then(j => {
|
||||
const tm = vtVal(j && j.items, 'tmrj.v1');
|
||||
const rs = ((tm && tm.readings) || []).filter(r => r && !r.demo && !/^r\d{1,3}[a-z]/.test(String(r.id || '')) && +r.value > 0).sort((a, b) => (a.ts || 0) - (b.ts || 0));
|
||||
const r = rs[rs.length - 1];
|
||||
if (!r) { vtSet('glu', ''); return; }
|
||||
const t = (tm.targets && tm.targets[r.slot]) || VT_TGT[r.slot] || [3.3, 7.8];
|
||||
const st = r.value > t[1] ? ['偏高', 'hi'] : r.value < t[0] ? ['偏低', 'lo'] : ['达标', 'ok'];
|
||||
vtSet('glu', (+r.value).toFixed(1), st[0], st[1], vtDay(r.ts) + (VT_SLOT[r.slot] ? ' ' + VT_SLOT[r.slot] : ''));
|
||||
});
|
||||
}
|
||||
$$('.vt-it[data-vt]').forEach(b => b.addEventListener('click', () => {
|
||||
const k = b.dataset.vt;
|
||||
const app = APP_BY_ID[MINI_APP_MAP[k]];
|
||||
if (app && app.url) { jumpApp(app.url, app.identifier); return; }
|
||||
const path = { kick: '/taidong/', weight: '/yunqi-tizhong/', bp: '/yunqi-xueya/', glu: '/yunqi-xuetang/', curve: '/gongsuo-pinlv/', fweight: '/taier-guzhong/' }[k];
|
||||
haptic(); location.href = withIdentity(location.origin + path);
|
||||
}));
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
if (document.visibilityState === 'visible' && _vtAt && Date.now() - _vtAt > 3000) loadVitals();
|
||||
});
|
||||
window.addEventListener('pageshow', function (e) { if (e.persisted && _vtAt) loadVitals(); });
|
||||
|
||||
function applyRemoteCardsFetch() {
|
||||
if (DEMO_CARDS) { applyRemoteCards(DEMO_CARDS); return; }
|
||||
const openid = hashParam('openid');
|
||||
|
||||
BIN
topic/buji/img/doctor.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
topic/buji/img/fish.webp
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
topic/buji/img/greens.webp
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
topic/buji/img/hero.webp
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
topic/buji/img/iron.webp
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
topic/buji/img/milk.webp
Normal file
|
After Width: | Height: | Size: 25 KiB |
377
topic/buji/index.html
Normal file
@@ -0,0 +1,377 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>叶酸、DHA、铁、钙要不要补?</title>
|
||||
<!-- 孕期专题 · 孕期补剂(孕期首页「其他妈妈也在搜」第 4 条)。
|
||||
2026-10-31 按 /tmp/pl/topic-spec.md v2 重做:清新、简洁、核心明确;主色 #2E7CF6。
|
||||
只写营养成分,不写品牌和药品名;百分比只出现在页底来源。
|
||||
自成一页:不引 app.js;返回回 ../../;跳补水补剂走同源 /yunqi-bushui/yindao/,带 search + hash。 -->
|
||||
<style>
|
||||
:root{--c:#2E7CF6;--cb:#EAF2FF;--h:#1F2329;--t:#4E5969;--s:#86909C;--bg2:#F7F8FA;--ln:#EEF0F3}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--t);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
b{color:var(--h)}
|
||||
.ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.hide{position:absolute;width:0;height:0;overflow:hidden}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;padding-top:env(safe-area-inset-top);background:transparent;border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
|
||||
.bar.on{background:#fff;border-bottom-color:var(--ln)}
|
||||
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--h)}
|
||||
.bar .back .ic{width:22px;height:22px}
|
||||
.bar .t{font-weight:600;font-size:16px;color:var(--h)}
|
||||
|
||||
/* Hero */
|
||||
.hero{padding:4px 16px 0}
|
||||
.hero img{width:100%;height:180px;object-fit:cover;border-radius:20px;background:var(--cb)}
|
||||
.hero h1{margin-top:18px;font-size:26px;font-weight:800;line-height:1.3;color:var(--h)}
|
||||
.answer{margin-top:14px;padding:13px 14px 13px 16px;border-radius:14px;background:var(--cb);border-left:4px solid var(--c);font-size:16px;font-weight:700;line-height:1.6;color:var(--h)}
|
||||
|
||||
/* 区块通用 */
|
||||
.blk{margin:32px 16px 0}
|
||||
.blk h2{font-size:18px;font-weight:700;line-height:1.4;color:var(--h)}
|
||||
.key{margin-top:6px;font-weight:700;color:var(--c)}
|
||||
.card{margin-top:12px;background:#fff;border:1px solid var(--ln);border-radius:18px}
|
||||
|
||||
/* 记住这 3 点 */
|
||||
.three{margin:28px 16px 0;padding:16px;border-radius:18px;background:var(--bg2)}
|
||||
.three h2{font-size:18px;font-weight:700;color:var(--h)}
|
||||
.three ol{list-style:none;margin-top:6px}
|
||||
.three li{display:flex;gap:14px;align-items:flex-start;padding:10px 0}
|
||||
.three li+li{border-top:1px solid var(--ln)}
|
||||
.three .no{flex:none;width:24px;font-size:26px;font-weight:800;line-height:1.1;color:var(--c);font-family:"DIN Alternate","Helvetica Neue",Arial,sans-serif}
|
||||
.three b{display:block;font-size:16px;line-height:1.45}
|
||||
.three span{display:block;font-size:13px;color:var(--s);line-height:1.6}
|
||||
|
||||
/* 1 对照表 */
|
||||
.tbl{width:100%;border-collapse:collapse;font-size:13.5px;line-height:1.5;table-layout:fixed}
|
||||
.tbl th{padding:10px 8px;text-align:left;font-size:12.5px;font-weight:500;color:var(--s);background:var(--bg2)}
|
||||
.tbl th:first-child{border-top-left-radius:17px}
|
||||
.tbl th:last-child{border-top-right-radius:17px}
|
||||
.tbl td{padding:11px 8px;border-top:1px solid var(--ln);vertical-align:top;color:var(--t)}
|
||||
.tbl td:first-child{font-weight:700;color:var(--h)}
|
||||
.tbl .y{color:var(--c);font-weight:700}
|
||||
.tbl col.c1{width:15%}.tbl col.c2{width:24%}.tbl col.c3{width:26%}
|
||||
.why{margin-top:10px}
|
||||
.why summary{list-style:none;display:inline-flex;align-items:center;gap:4px;font-size:13px;color:var(--c);cursor:pointer}
|
||||
.why summary::-webkit-details-marker{display:none}
|
||||
.why summary .ic{width:16px;height:16px;transition:transform .2s}
|
||||
.why[open] summary .ic{transform:rotate(180deg)}
|
||||
.why p{margin-top:6px;font-size:13.5px;line-height:1.7;color:var(--t)}
|
||||
|
||||
/* 2 横向时间轴 */
|
||||
.me{display:none;margin-top:10px;font-size:12.5px;color:var(--c);background:var(--cb);border-radius:99px;padding:4px 12px;width:max-content;max-width:100%}
|
||||
.me.on{display:block}
|
||||
.tl{position:relative;display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:14px}
|
||||
.tl::before{content:"";position:absolute;left:12%;right:12%;top:7px;height:2px;background:var(--ln)}
|
||||
.st{position:relative;text-align:center}
|
||||
.st .dot{position:relative;display:block;width:16px;height:16px;margin:0 auto;border-radius:50%;background:#fff;border:2px solid #D5DAE1}
|
||||
.st b{display:block;margin-top:8px;font-size:13.5px;line-height:1.35;white-space:nowrap;letter-spacing:-.2px}
|
||||
.st p{margin-top:4px;padding:8px 6px;border-radius:12px;background:var(--bg2);font-size:12.5px;line-height:1.5;color:var(--t);min-height:62px}
|
||||
.st.hl .dot{border-color:var(--c);background:var(--c);box-shadow:0 0 0 4px var(--cb)}
|
||||
.st.hl b{color:var(--c)}
|
||||
.st.hl p{background:var(--cb);color:var(--h)}
|
||||
|
||||
/* 3 标签云 */
|
||||
.doc{display:flex;gap:12px;align-items:center;margin-top:12px}
|
||||
.doc img{flex:none;width:76px;height:76px;border-radius:16px;object-fit:cover}
|
||||
.doc p{font-size:14px;color:var(--t);line-height:1.65}
|
||||
.tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
|
||||
.tags span{font-size:13.5px;line-height:1.4;padding:6px 12px;border-radius:99px;background:var(--bg2);color:var(--h);white-space:nowrap}
|
||||
|
||||
/* 自查 */
|
||||
.tool{padding:16px 14px}
|
||||
.q+.q{margin-top:14px}
|
||||
.q-t{font-size:14.5px;font-weight:700;color:var(--h)}
|
||||
.opts{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
|
||||
.opt{padding:6px 13px;border-radius:99px;background:var(--bg2);border:1px solid transparent;font-size:13.5px;line-height:1.5;color:var(--t);white-space:nowrap;transition:all .15s}
|
||||
.opt.on{background:var(--cb);border-color:var(--c);color:var(--c);font-weight:600}
|
||||
.hint{margin-top:14px;font-size:12.5px;color:var(--s)}
|
||||
.res{display:none;margin-top:16px;padding-top:14px;border-top:1px solid var(--ln)}
|
||||
.res.on{display:block}
|
||||
.res h3{font-size:15px;font-weight:700;color:var(--h)}
|
||||
.res ul{list-style:none;margin-top:6px}
|
||||
.res li{display:flex;gap:10px;align-items:flex-start;padding:8px 0}
|
||||
.res li i{flex:none;margin-top:2px;font-style:normal;font-size:12px;line-height:20px;padding:0 8px;border-radius:99px;white-space:nowrap;min-width:52px;text-align:center;background:var(--bg2);color:var(--s)}
|
||||
.res li.a i{background:var(--c);color:#fff}
|
||||
.res li.t i{background:var(--cb);color:var(--c)}
|
||||
.res li b{display:block;font-size:14px;line-height:1.5}
|
||||
.res li span{display:block;font-size:12.5px;color:var(--s);line-height:1.55}
|
||||
.res-note{margin-top:6px;font-size:12px;color:var(--s)}
|
||||
|
||||
/* 工具入口 */
|
||||
.go{display:flex;gap:12px;align-items:center;padding:14px}
|
||||
.go .gi{flex:none;width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:var(--cb);color:var(--c)}
|
||||
.go .gi .ic{width:22px;height:22px}
|
||||
.go .gt{flex:1;min-width:0}
|
||||
.go b{display:block;font-size:15px;line-height:1.4}
|
||||
.go span{display:block;font-size:12.5px;color:var(--s);line-height:1.5}
|
||||
.btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:46px;border-radius:99px;background:var(--c);color:#fff;font-size:15.5px;font-weight:600}
|
||||
.btn .ic{width:18px;height:18px}
|
||||
.go-wrap{padding:0 14px 14px}
|
||||
|
||||
/* 来源 */
|
||||
.src{margin:32px 16px 0;border-radius:18px;background:var(--bg2)}
|
||||
.src summary{list-style:none;padding:13px 16px;font-size:14px;font-weight:600;color:var(--h);display:flex;align-items:center}
|
||||
.src summary::-webkit-details-marker{display:none}
|
||||
.src summary::after{content:"展开";margin-left:auto;font-size:12px;font-weight:400;color:var(--s)}
|
||||
.src[open] summary::after{content:"收起"}
|
||||
.src ul{list-style:none;padding:0 16px 12px}
|
||||
.src li{padding:8px 0;border-top:1px solid var(--ln);font-size:12.5px;line-height:1.65;color:var(--t)}
|
||||
.foot{margin:14px 20px 0;font-size:12px;color:var(--s);text-align:center;line-height:1.7}
|
||||
|
||||
.fade{opacity:0;transform:translateY(8px);transition:opacity .4s,transform .4s}
|
||||
.fade.in{opacity:1;transform:none}
|
||||
@media (prefers-reduced-motion:reduce){.fade{opacity:1;transform:none;transition:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标,stroke 1.8 -->
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-down" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"/></symbol>
|
||||
<symbol id="i-cup" viewBox="0 0 24 24"><path d="M5 8h11v7a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 10h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1.5 1 1.5 1 3M12 3.5c0 1.5 1 1.5 1 3"/></symbol>
|
||||
<symbol id="i-arrow" viewBox="0 0 24 24"><path d="M5 12h13M13 6.5l5.5 5.5-5.5 5.5"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<section class="hero">
|
||||
<img src="img/hero.webp" alt="孕妈妈坐在窗边,桌上有牛奶、绿叶菜和鱼">
|
||||
<h1>叶酸、DHA、铁、钙<br>要不要补?</h1>
|
||||
<div class="answer">叶酸要补;钙、铁、DHA 先靠吃,不够再按医生建议补。</div>
|
||||
</section>
|
||||
|
||||
<section class="three fade">
|
||||
<h2>记住这 3 点</h2>
|
||||
<ol>
|
||||
<li><span class="no">1</span><div><b>叶酸 0.4mg/天</b><span>备孕前 3 个月开始,至少吃到孕 12 周</span></div></li>
|
||||
<li><span class="no">2</span><div><b>钙铁错开 2 小时</b><span>一起吃会抢吸收,比如铁早上、钙睡前</span></div></li>
|
||||
<li><span class="no">3</span><div><b>补剂不是越多越好</b><span>复合维生素和单补别叠加,先算总量</span></div></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- 1 四种营养一张表 -->
|
||||
<section class="blk fade" id="s1">
|
||||
<h2>四种营养一张表</h2>
|
||||
<p class="key">只有叶酸人人要补,其余三样先吃够。</p>
|
||||
<div class="card">
|
||||
<table class="tbl">
|
||||
<colgroup><col class="c1"><col class="c2"><col class="c3"><col></colgroup>
|
||||
<thead><tr><th>营养</th><th>要不要补</th><th>每天多少</th><th>先吃什么</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>叶酸</td><td class="y">要补</td><td>0.4mg</td><td>深绿叶菜、豆类</td></tr>
|
||||
<tr><td>钙</td><td>先食补</td><td>孕中晚期约 1000mg</td><td>奶、酸奶、豆腐</td></tr>
|
||||
<tr><td>铁</td><td>先食补,贫血听医生</td><td>20~29mg,越往后越多</td><td>红肉、动物血,配维 C 果蔬</td></tr>
|
||||
<tr><td>DHA</td><td>常吃鱼就不用</td><td>约 200mg</td><td>低汞鱼,每周 2~3 次</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<details class="why">
|
||||
<summary>为什么?<svg class="ic"><use href="#i-down" xlink:href="#i-down"/></svg></summary>
|
||||
<p>宝宝神经管在怀孕 3~4 周就闭合,那时很多人还不知道怀孕,而食物里的叶酸怕热易流失,所以要提前补。钙、铁、DHA 从奶、红肉、鱼里吃更全面;植物里的铁吸收差,鲨鱼、旗鱼等大型鱼汞高要少吃。</p>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<!-- 2 按孕周怎么补 -->
|
||||
<section class="blk fade" id="s2">
|
||||
<h2>按孕周怎么补</h2>
|
||||
<p class="key">早期抓叶酸,中期起加上钙、铁、DHA。</p>
|
||||
<div class="me" id="me"></div>
|
||||
<div class="tl">
|
||||
<div class="st" id="stPre"><span class="dot"></span><b>备孕</b><p>开始每天 0.4mg 叶酸</p></div>
|
||||
<div class="st" id="stE"><span class="dot"></span><b>孕早期</b><p>叶酸别断,孕吐别硬吃</p></div>
|
||||
<div class="st" id="stM"><span class="dot"></span><b>孕中期</b><p>奶加量,常吃鱼和红肉</p></div>
|
||||
<div class="st" id="stL"><span class="dot"></span><b>孕晚期·哺乳</b><p>铁需要最多,奶和鱼别断</p></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 3 这些情况先问医生 -->
|
||||
<section class="blk fade" id="s3">
|
||||
<h2>这些情况先问医生</h2>
|
||||
<p class="key">符合任一条,补什么、补多少听医生的。</p>
|
||||
<div class="doc">
|
||||
<img src="img/doctor.webp" alt="孕妈妈和医生面对面交谈" loading="lazy">
|
||||
<p>上面的量只适合一般情况。下面这些人需要量不同,产检时带着问。</p>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<span>贫血</span><span>甲状腺问题</span><span>素食 / 不吃鱼</span><span>双胎 / 多胎</span><span>生过神经管缺陷宝宝</span><span>糖尿病</span><span>长期用药</span><span>在吃复合维生素</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 我的补剂自查 -->
|
||||
<section class="blk fade" id="s4">
|
||||
<h2>我的补剂自查</h2>
|
||||
<p class="key">选 3 个问题,看看该注意什么。</p>
|
||||
<div class="card tool" id="tool">
|
||||
<div class="q" data-q="stage">
|
||||
<div class="q-t">我现在处于</div>
|
||||
<div class="opts"><button class="opt" data-v="pre">备孕</button><button class="opt" data-v="e">孕早期</button><button class="opt" data-v="m">孕中期</button><button class="opt" data-v="l">孕晚期</button><button class="opt" data-v="b">哺乳期</button></div>
|
||||
</div>
|
||||
<div class="q" data-q="milk">
|
||||
<div class="q-t">每天喝奶(或酸奶)吗</div>
|
||||
<div class="opts"><button class="opt" data-v="2">每天 1~2 杯</button><button class="opt" data-v="1">偶尔喝</button><button class="opt" data-v="0">基本不喝</button></div>
|
||||
</div>
|
||||
<div class="q" data-q="fish">
|
||||
<div class="q-t">每周吃鱼虾几次</div>
|
||||
<div class="opts"><button class="opt" data-v="2">2 次以上</button><button class="opt" data-v="1">1 次左右</button><button class="opt" data-v="0">几乎不吃</button></div>
|
||||
</div>
|
||||
<p class="hint" id="hint">3 题选完自动出结果,只在本机计算</p>
|
||||
<div class="res" id="res">
|
||||
<h3 id="resT">给你的 3 条建议</h3>
|
||||
<ul id="resL"></ul>
|
||||
<p class="res-note">仅供参考,补什么、补多少以产检医生意见为准。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 工具入口 -->
|
||||
<section class="blk fade">
|
||||
<div class="card">
|
||||
<div class="go">
|
||||
<span class="gi"><svg class="ic"><use href="#i-cup" xlink:href="#i-cup"/></svg></span>
|
||||
<div class="gt"><b>补水补剂打卡</b><span>每天吃了没记一笔,不漏吃也不重复</span></div>
|
||||
</div>
|
||||
<div class="go-wrap"><button class="btn" id="goBushui">去记录<svg class="ic"><use href="#i-arrow" xlink:href="#i-arrow"/></svg></button></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<details class="src">
|
||||
<summary>参考来源</summary>
|
||||
<ul>
|
||||
<li>《围受孕期增补叶酸预防神经管缺陷指南(2017)》:无高危因素者从孕前至少 3 个月起每天增补 0.4mg 或 0.8mg 叶酸至孕满 3 个月;高危者由医生定剂量。研究汇总显示可使神经管缺陷风险降低约 50%~70%</li>
|
||||
<li>《中国居民膳食指南(2022)》备孕和孕期妇女膳食指南;《中国居民膳食营养素参考摄入量》:孕早、中、晚期铁约 20、24、29mg/天,孕中晚期钙约 1000mg/天;孕期和哺乳期 DHA 约 200mg/天</li>
|
||||
<li>中华医学会围产医学分会《妊娠期铁缺乏和缺铁性贫血诊治指南》</li>
|
||||
<li>WHO《孕期保健建议:积极的妊娠体验》(2016)</li>
|
||||
<li>钙会影响非血红素铁吸收,同时补充建议分开服用;孕期食鱼宜选低汞鱼</li>
|
||||
</ul>
|
||||
</details>
|
||||
<p class="foot">本页为科普参考,不能代替医生诊断。</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var $$ = function (s, r) { return [].slice.call((r || document).querySelectorAll(s)); };
|
||||
function hp(n) { var h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || ''); var m = h.match(new RegExp('(?:^|&)' + n + '=([^&]*)')); return m ? decodeURIComponent(m[1]) : ''; }
|
||||
var openid = hp('openid');
|
||||
var sc = $('#scroll');
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
/* 顶栏:滚动后白底 + 细分割线 */
|
||||
sc.addEventListener('scroll', function () { $('#bar').classList.toggle('on', sc.scrollTop > 8); }, { passive: true });
|
||||
|
||||
function go(id) {
|
||||
var el = document.getElementById(id); if (!el) return;
|
||||
var top = el.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop - 60;
|
||||
sc.scrollTo({ top: top, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
/* 补水补剂记录:同源相对路径,带身份 */
|
||||
$('#goBushui').addEventListener('click', function () { location.href = '/yunqi-bushui/yindao/' + location.search + location.hash; });
|
||||
|
||||
/* ---------- 我的补剂自查:3 题,最多 3 条建议 ---------- */
|
||||
var ans = { stage: '', milk: '', fish: '' };
|
||||
function pick(q, v) {
|
||||
$$('.opt', $('.q[data-q="' + q + '"]')).forEach(function (o) { o.classList.toggle('on', o.dataset.v === v); });
|
||||
ans[q] = v;
|
||||
if (ans.stage && ans.milk && ans.fish) build();
|
||||
}
|
||||
$$('.q').forEach(function (box) {
|
||||
$$('.opt', box).forEach(function (o) {
|
||||
o.addEventListener('click', function () {
|
||||
var first = !$('#res').classList.contains('on');
|
||||
pick(box.dataset.q, o.dataset.v);
|
||||
if (first && $('#res').classList.contains('on')) setTimeout(function () { go('res'); }, 60);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var TAG = { a: '问医生', t: '加一点', k: '保持' };
|
||||
function build() {
|
||||
var s = ans.stage, milk = +ans.milk, fish = +ans.fish;
|
||||
var later = s === 'm' || s === 'l' || s === 'b';
|
||||
var L = [];
|
||||
function add(t, b, d) { L.push({ t: t, b: b, d: d }); }
|
||||
|
||||
if (s === 'pre' || s === 'e') add('t', '叶酸每天 0.4mg,一天别落下', s === 'pre' ? '备孕前 3 个月开始是关键' : '孕早期是神经管发育关键期');
|
||||
else if (s === 'b') add('a', '哺乳期叶酸是否继续,问医生', '有的医生会建议继续吃');
|
||||
else add('k', '叶酸按医生建议继续吃', '很多医生建议吃到整个孕期');
|
||||
|
||||
if (milk === 0) add('a', '钙可能不够,问医生要不要补', later ? '孕中晚期和哺乳期每天约需 1000mg' : '先试试酸奶、奶酪、豆腐');
|
||||
else if (milk === 1) add('t', '奶加到每天 300~500ml', later ? '偶尔喝时钙容易不足' : '孕中期起钙需要量会增加');
|
||||
else add('k', '钙靠喝奶就够,继续保持', '再加点豆腐、深绿叶菜');
|
||||
|
||||
if (fish === 0) add('a', '问医生是否需要补 DHA', '几乎不吃鱼虾时 DHA 容易不足');
|
||||
else if (fish === 1) add('t', '鱼加到每周 2~3 次', '选三文鱼、鳕鱼、鲈鱼等低汞鱼');
|
||||
else add('k', 'DHA 吃鱼就够,继续保持', '记得选低汞鱼');
|
||||
|
||||
var order = { a: 0, t: 1, k: 2 };
|
||||
L.sort(function (x, y) { return order[x.t] - order[y.t]; });
|
||||
var ul = $('#resL'); ul.innerHTML = '';
|
||||
L.slice(0, 3).forEach(function (it) {
|
||||
var li = document.createElement('li'); li.className = it.t;
|
||||
li.innerHTML = '<i></i><div><b></b><span></span></div>';
|
||||
li.querySelector('i').textContent = TAG[it.t];
|
||||
li.querySelector('b').textContent = it.b; li.querySelector('span').textContent = it.d;
|
||||
ul.appendChild(li);
|
||||
});
|
||||
$('#hint').style.display = 'none';
|
||||
$('#res').classList.add('on');
|
||||
}
|
||||
|
||||
/* 按孕周点亮时间轴,并预选自查的阶段 */
|
||||
function mark(stage, txt, v) {
|
||||
var el = document.getElementById(stage); if (el) el.classList.add('hl');
|
||||
var me = $('#me'); me.textContent = txt; me.classList.add('on');
|
||||
if (v && !ans.stage) pick('stage', v);
|
||||
}
|
||||
if (openid) {
|
||||
fetch('/api/mp/public/mama-box/pregnancy?openid=' + encodeURIComponent(openid))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (j) {
|
||||
var p = j && j.code === 200 && j.result; if (!p) return;
|
||||
if (p.postpartum) mark('stL', '宝宝出生了 · 你在哺乳期', 'b');
|
||||
else if (p.week != null && !p.empty) {
|
||||
var w = p.week;
|
||||
if (w >= 28) mark('stL', '你在孕 ' + w + ' 周 · 孕晚期', 'l');
|
||||
else if (w >= 13) mark('stM', '你在孕 ' + w + ' 周 · 孕中期', 'm');
|
||||
else mark('stE', '你在孕 ' + w + ' 周 · 孕早期', 'e');
|
||||
}
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
/* 进场动画(轻) */
|
||||
if ('IntersectionObserver' in window) {
|
||||
var io = new IntersectionObserver(function (es) { es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { root: sc, threshold: .08 });
|
||||
$$('.fade').forEach(function (el) { io.observe(el); });
|
||||
} else $$('.fade').forEach(function (el) { el.classList.add('in'); });
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
topic/ceshi/img/hero.webp
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
topic/ceshi/img/nuan.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
topic/ceshi/img/re.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
topic/ceshi/img/song.webp
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
topic/ceshi/img/xue.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
435
topic/ceshi/index.html
Normal file
@@ -0,0 +1,435 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>测一测你是什么样的妈妈?</title>
|
||||
<!-- 孕期专题 · 趣味测试(孕期首页「其他妈妈也在搜」第 2 条入口)。
|
||||
2026-10-31 按《孕期专题页统一设计规范 v2》重做:主色 #7C5CFC、白底、单色线性图标、16 道题。
|
||||
一页三屏:开始 / 答题(一题一屏)/ 结果;结果存 localStorage「mmbox.ceshi.v2」(题目已换,不复用 v1)。
|
||||
插画复用 img/*.webp。自成一页:不引 app.js;返回走 history 或相对路径 ../../,跳工具走 /<slug>/ 并带 search + hash。
|
||||
纯娱乐,不采集、不上报答题数据。 -->
|
||||
<style>
|
||||
:root{--c:#7C5CFC;--cbg:#F1EDFF;--ink:#1F2329;--txt:#4E5969;--sub:#86909C;--line:#EEF0F3;--soft:#F7F8FA}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--txt);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
.ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.hide{position:absolute;width:0;height:0;overflow:hidden}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;padding-top:env(safe-area-inset-top);background:#fff;border-bottom:1px solid transparent;transition:border-color .2s}
|
||||
.bar.sh{border-bottom-color:var(--line)}
|
||||
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--ink)}
|
||||
.bar .back .ic{width:22px;height:22px}
|
||||
.bar .t{font-weight:600;font-size:16px;color:var(--ink)}
|
||||
|
||||
/* 三屏 */
|
||||
.view{display:none;padding:0 20px}
|
||||
.view.on{display:block;animation:vin .35s ease both}
|
||||
@keyframes vin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
||||
|
||||
.pic{width:100%;height:200px;object-fit:cover;object-position:center 40%;border-radius:20px;background:var(--soft)}
|
||||
.btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:46px;border-radius:99px;font-size:16px;font-weight:700}
|
||||
.btn.pri{background:var(--c);color:#fff}
|
||||
.btn.sec{background:#fff;color:var(--c);border:1px solid var(--c)}
|
||||
.btn:active{opacity:.85}
|
||||
|
||||
/* 开始 */
|
||||
#vStart{padding-top:12px;text-align:center}
|
||||
#vStart h1{margin-top:22px;font-size:26px;font-weight:800;line-height:1.3;color:var(--ink)}
|
||||
#vStart .meta{margin-top:10px;font-size:14px;color:var(--sub)}
|
||||
#vStart .meta b{color:var(--c);font-weight:700}
|
||||
#vStart .btn{margin-top:28px}
|
||||
#vStart .note{margin-top:12px;font-size:12.5px;color:var(--sub)}
|
||||
|
||||
/* 答题 */
|
||||
#vQuiz{padding-top:8px}
|
||||
.qtop{display:flex;align-items:center;justify-content:space-between;height:32px}
|
||||
.qtop .no{font-size:13px;color:var(--sub)}
|
||||
.qtop .no b{font-size:15px;color:var(--c);font-weight:700}
|
||||
.qtop button{display:inline-flex;align-items:center;gap:2px;font-size:13.5px;color:var(--sub);padding:4px 0 4px 8px}
|
||||
.qtop button .ic{width:16px;height:16px}
|
||||
.qtop button:disabled{visibility:hidden}
|
||||
.track{height:4px;border-radius:4px;background:var(--line);overflow:hidden}
|
||||
.track i{display:block;height:100%;width:0;border-radius:4px;background:var(--c);transition:width .35s ease}
|
||||
.qbody{margin-top:28px;transition:opacity .2s ease,transform .2s ease}
|
||||
.qbody.out{opacity:0;transform:translateY(-8px)}
|
||||
.qbody.pre{opacity:0;transform:translateY(8px);transition:none}
|
||||
.qbody h2{font-size:22px;font-weight:700;line-height:1.45;color:var(--ink);min-height:64px}
|
||||
.opts{display:flex;flex-direction:column;gap:12px;margin-top:22px}
|
||||
.opt{display:flex;align-items:center;gap:12px;width:100%;min-height:58px;padding:12px 16px;border-radius:18px;background:#fff;border:1px solid var(--line);text-align:left;font-size:16px;line-height:1.45;color:var(--ink);transition:border-color .2s,background .2s,color .2s}
|
||||
.opt .l{flex:none;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--soft);color:var(--sub);font-size:13px;font-weight:700;transition:background .2s,color .2s}
|
||||
.opt.sel{border-color:var(--c);background:var(--cbg);color:var(--c);font-weight:600}
|
||||
.opt.sel .l{background:var(--c);color:#fff}
|
||||
.qtip{margin-top:18px;text-align:center;font-size:12.5px;color:var(--sub)}
|
||||
|
||||
/* 结果 */
|
||||
#vResult{padding-top:12px}
|
||||
.rhead{position:relative;text-align:center}
|
||||
.rhead .last{position:absolute;left:10px;top:10px;background:rgba(255,255,255,.92);border-radius:99px;padding:0 10px;font-size:12px;line-height:24px;color:var(--sub);display:none}
|
||||
.rhead .last.on{display:block}
|
||||
.rhead .you{margin-top:18px;font-size:14px;color:var(--sub)}
|
||||
.rhead h1{margin-top:2px;font-size:26px;font-weight:800;line-height:1.3;color:var(--ink)}
|
||||
.rhead h1 em{font-style:normal;color:var(--c)}
|
||||
.rhead p{margin-top:6px;font-size:15px;color:var(--txt)}
|
||||
.blk{margin-top:24px}
|
||||
.blk h2{display:flex;align-items:center;gap:6px;font-size:18px;font-weight:700;color:var(--ink);line-height:1.4}
|
||||
.blk h2 .ic{color:var(--c)}
|
||||
.tags{display:flex;gap:8px;margin-top:12px}
|
||||
.tags span{flex:1;text-align:center;padding:8px 4px;border-radius:12px;background:var(--cbg);color:var(--c);font-size:14px;font-weight:600;line-height:1.4;white-space:nowrap}
|
||||
.tip{margin-top:12px;padding:14px 16px;border-radius:14px;background:var(--cbg);border-left:4px solid var(--c);font-size:15.5px;font-weight:600;color:var(--ink);line-height:1.7}
|
||||
.dist{margin-top:12px;padding:14px 16px;border:1px solid var(--line);border-radius:18px;display:flex;flex-direction:column;gap:10px}
|
||||
.dr{display:flex;align-items:center;gap:10px;font-size:13.5px;color:var(--txt)}
|
||||
.dr .n{flex:none;width:68px;white-space:nowrap}
|
||||
.dr .tr{flex:1;height:6px;border-radius:6px;background:var(--soft);overflow:hidden}
|
||||
.dr .tr i{display:block;height:100%;width:0;border-radius:6px;background:#D6CCFE;transition:width .8s cubic-bezier(.3,.7,.2,1)}
|
||||
.dr .p{flex:none;width:36px;text-align:right;color:var(--sub)}
|
||||
.dr.me .n{color:var(--c);font-weight:700}
|
||||
.dr.me .tr i{background:var(--c)}
|
||||
.dr.me .p{color:var(--c);font-weight:700}
|
||||
.tool{margin-top:24px;padding:16px;border:1px solid var(--line);border-radius:18px;display:flex;align-items:center;gap:12px}
|
||||
.tool .ti{flex:none;width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:var(--cbg);color:var(--c)}
|
||||
.tool .ti .ic{width:22px;height:22px}
|
||||
.tool .tx{flex:1;min-width:0}
|
||||
.tool small{display:block;font-size:12.5px;color:var(--sub);line-height:1.5}
|
||||
.tool b{display:block;font-size:16px;color:var(--ink);line-height:1.4}
|
||||
.tool .go{flex:none;height:34px;padding:0 16px;border-radius:99px;background:var(--c);color:#fff;font-size:14px;font-weight:600}
|
||||
.acts{display:flex;gap:10px;margin-top:20px}
|
||||
.acts .btn{flex:1;font-size:15px}
|
||||
|
||||
.foot{margin:28px 20px 0;font-size:12px;color:var(--sub);text-align:center}
|
||||
.toast{position:fixed;left:50%;bottom:calc(80px + env(safe-area-inset-bottom));transform:translate(-50%,8px);max-width:300px;padding:10px 16px;border-radius:12px;background:rgba(31,35,41,.88);color:#fff;font-size:13.5px;line-height:1.6;text-align:center;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:50}
|
||||
.toast.on{opacity:1;transform:translate(-50%,0)}
|
||||
|
||||
.fade{opacity:0;transform:translateY(8px);transition:opacity .4s,transform .4s}
|
||||
.fade.in{opacity:1;transform:none}
|
||||
@media (prefers-reduced-motion:reduce){.fade,.qbody,.view.on{opacity:1;transform:none;transition:none;animation:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标 -->
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-arrow" viewBox="0 0 24 24"><path d="M5 12h13M13 6.5l5.5 5.5-5.5 5.5"/></symbol>
|
||||
<symbol id="i-star" viewBox="0 0 24 24"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></symbol>
|
||||
<symbol id="i-bulb" viewBox="0 0 24 24"><path d="M9 18.5h6M10.2 21.5h3.6M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"/></symbol>
|
||||
<symbol id="i-chart" viewBox="0 0 24 24"><path d="M4 20h16M7 16v-4M12 16V7M17 16v-6"/></symbol>
|
||||
<symbol id="i-refresh" viewBox="0 0 24 24"><path d="M20 12a8 8 0 1 1-2.4-5.7M20 4v4.5h-4.5"/></symbol>
|
||||
<symbol id="i-share" viewBox="0 0 24 24"><path d="M12 15V4M8 7.5L12 3.5l4 4M5 12v6.5A1.5 1.5 0 0 0 6.5 20h11a1.5 1.5 0 0 0 1.5-1.5V12"/></symbol>
|
||||
<symbol id="i-baby" viewBox="0 0 24 24"><circle cx="12" cy="12.5" r="8.5"/><path d="M9.2 11.5h.01M14.8 11.5h.01M9.5 15.2c1.4 1.2 3.6 1.2 5 0M12 4c-1.2 0-1.6 1.2-.8 2"/></symbol>
|
||||
<symbol id="i-scale" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="4"/><path d="M8 11a4 4 0 0 1 8 0M12 11l2-2.2"/></symbol>
|
||||
<symbol id="i-cal" viewBox="0 0 24 24"><rect x="3.5" y="5" width="17" height="15.5" rx="3"/><path d="M3.5 10h17M8 3v4M16 3v4M8 14h2M14 14h2M8 17.2h2"/></symbol>
|
||||
<symbol id="i-bag" viewBox="0 0 24 24"><rect x="3.5" y="8" width="17" height="12.5" rx="3"/><path d="M8.5 8V6a3.5 3.5 0 0 1 7 0v2M3.5 13h17"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<!-- ① 开始 -->
|
||||
<main class="view" id="vStart">
|
||||
<img class="pic" src="img/hero.webp" alt="孕妈拿着小测试卡片微笑">
|
||||
<h1>测一测<br>你是什么样的妈妈?</h1>
|
||||
<p class="meta"><b>16</b> 道题 · 约 <b>2</b> 分钟</p>
|
||||
<button class="btn pri" id="startBtn">开始测试<svg class="ic"><use href="#i-arrow" xlink:href="#i-arrow"/></svg></button>
|
||||
<p class="note">没有对错,凭第一感觉选就好</p>
|
||||
</main>
|
||||
|
||||
<!-- ② 答题 -->
|
||||
<main class="view" id="vQuiz">
|
||||
<div class="qtop">
|
||||
<span class="no">第 <b id="qNo">1</b> / <span id="qTotal">16</span> 题</span>
|
||||
<button id="prevBtn"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg>上一题</button>
|
||||
</div>
|
||||
<div class="track"><i id="qFill"></i></div>
|
||||
<div class="qbody" id="qBody">
|
||||
<h2 id="qTitle"></h2>
|
||||
<div class="opts" id="qOpts"></div>
|
||||
</div>
|
||||
<p class="qtip">选完自动进入下一题</p>
|
||||
</main>
|
||||
|
||||
<!-- ③ 结果 -->
|
||||
<main class="view" id="vResult">
|
||||
<div class="rhead">
|
||||
<img class="pic" id="rImg" src="" alt="">
|
||||
<span class="last" id="rLast"></span>
|
||||
<p class="you">你是</p>
|
||||
<h1><em id="rName"></em></h1>
|
||||
<p id="rLine"></p>
|
||||
</div>
|
||||
|
||||
<section class="blk fade">
|
||||
<h2><svg class="ic"><use href="#i-star" xlink:href="#i-star"/></svg>你的优势</h2>
|
||||
<div class="tags" id="rAdv"></div>
|
||||
</section>
|
||||
|
||||
<section class="blk fade">
|
||||
<h2><svg class="ic"><use href="#i-bulb" xlink:href="#i-bulb"/></svg>给你一句建议</h2>
|
||||
<p class="tip" id="rTip"></p>
|
||||
</section>
|
||||
|
||||
<section class="blk fade">
|
||||
<h2><svg class="ic"><use href="#i-chart" xlink:href="#i-chart"/></svg>你的类型占比</h2>
|
||||
<div class="dist" id="rDist"></div>
|
||||
</section>
|
||||
|
||||
<div class="tool fade">
|
||||
<span class="ti"><svg class="ic"><use id="rToolIc" href="#i-baby" xlink:href="#i-baby"/></svg></span>
|
||||
<span class="tx"><small>适合你的工具</small><b id="rToolName"></b></span>
|
||||
<button class="go" id="rTool">去用</button>
|
||||
</div>
|
||||
|
||||
<div class="acts fade">
|
||||
<button class="btn sec" id="againBtn"><svg class="ic"><use href="#i-refresh" xlink:href="#i-refresh"/></svg>再测一次</button>
|
||||
<button class="btn pri" id="shareBtn"><svg class="ic"><use href="#i-share" xlink:href="#i-share"/></svg>分享给老公看看</button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<p class="foot">趣味测试,仅供娱乐</p>
|
||||
</div>
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var sc = $('#scroll');
|
||||
var KEY = 'mmbox.ceshi.v2';
|
||||
var XL = 'http://www.w3.org/1999/xlink';
|
||||
function useRef(el, id) { el.setAttribute('href', '#i-' + id); el.setAttributeNS(XL, 'xlink:href', '#i-' + id); }
|
||||
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
sc.addEventListener('scroll', function () { $('#bar').classList.toggle('sh', sc.scrollTop > 4); }, { passive: true });
|
||||
|
||||
/* 4 种类型(ORDER 顺序即平分时的优先级) */
|
||||
var TYPES = {
|
||||
nuan: { name: '温柔守护型', img: 'img/nuan.webp', alt: '妈妈温柔地抱着宝宝',
|
||||
line: '你的爱细腻又安稳,是宝宝最软的依靠',
|
||||
adv: ['共情力强', '细心周到', '安全感满满'],
|
||||
tip: '担心时别一个人扛,拿不准就问产检医生;累了就让家人搭把手。',
|
||||
tool: { name: '数胎动', path: '/taidong/', ic: 'baby' } },
|
||||
xue: { name: '理性研究型', img: 'img/xue.webp', alt: '孕妈认真看书做笔记',
|
||||
line: '知识是你的底气,每个决定都做过功课',
|
||||
adv: ['会甄别信息', '计划周全', '遇事冷静'],
|
||||
tip: '网上说法真假混杂,看到吓人的先打个问号,一切以产检医生意见为准。',
|
||||
tool: { name: '孕期体重', path: '/yunqi-tizhong/', ic: 'scale' } },
|
||||
song: { name: '松弛自在型', img: 'img/song.webp', alt: '孕妈靠在软垫上悠闲喝茶',
|
||||
line: '情绪稳定心态好,好心情就是最好的胎教',
|
||||
adv: ['情绪稳定', '抓大放小', '快乐能量'],
|
||||
tip: '松弛也别错过产检,唐筛、大排畸、糖耐记得提前预约。',
|
||||
tool: { name: '孕检日历', path: '/chanjian-rili/', ic: 'cal' } },
|
||||
re: { name: '元气分享型', img: 'img/re.webp', alt: '孕妈和朋友们开心聊天',
|
||||
line: '热情开朗爱连接,总有人陪你期待宝宝',
|
||||
adv: ['社交满分', '乐于分享', '行动力强'],
|
||||
tip: '群里的经验只作参考,涉及身体和用药,以产检医生意见为准。',
|
||||
tool: { name: '待产清单', path: '/daichan-qingdan/', ic: 'bag' } }
|
||||
};
|
||||
var ORDER = ['nuan', 'xue', 'song', 're'];
|
||||
|
||||
/* 16 道题:每个选项对应一种类型,顺序已打散 */
|
||||
var QS = [
|
||||
{ q: '刚知道怀孕的那一刻,你第一件事是?', o: [
|
||||
['nuan', '摸摸肚子,跟宝宝打招呼'], ['xue', '马上搜孕早期注意事项'], ['re', '第一时间告诉最亲的人'], ['song', '先吃顿好的庆祝一下'] ] },
|
||||
{ q: '明天要产检了,今晚你会?', o: [
|
||||
['xue', '把要问医生的问题列好'], ['song', '早早睡觉,明天再说'], ['nuan', '有点忐忑,多摸摸肚子'], ['re', '去妈妈群问问要查啥'] ] },
|
||||
{ q: '产检排队等了一个多小时,你在干嘛?', o: [
|
||||
['re', '和旁边孕妈聊成了朋友'], ['xue', '翻看之前的检查报告'], ['song', '刷剧玩手机,不着急'], ['nuan', '和肚里宝宝说悄悄话'] ] },
|
||||
{ q: '半夜宝宝在肚子里拳打脚踢,你会?', o: [
|
||||
['song', '翻个身接着睡'], ['nuan', '轻轻拍拍:妈妈在呢'], ['xue', '看看时间,记一下胎动'], ['re', '叫醒老公一起感受'] ] },
|
||||
{ q: '刷到一条「孕期千万别吃 XX」,你会?', o: [
|
||||
['re', '转给姐妹们一起讨论'], ['nuan', '宁可信其有,先不吃'], ['song', '适量就好,不太在意'], ['xue', '先查查权威说法'] ] },
|
||||
{ q: '突然特别想吃一样东西,你会?', o: [
|
||||
['xue', '先查查孕妇能不能吃'], ['song', '想吃就吃,开心最重要'], ['nuan', '自己做一份,吃得放心'], ['re', '发朋友圈求推荐好店'] ] },
|
||||
{ q: '婆婆端来一大锅补汤,你会?', o: [
|
||||
['re', '拍照发群:被宠到了'], ['xue', '先问问汤里放了什么'], ['nuan', '笑着喝两口,谢谢婆婆'], ['song', '喝一碗,剩下全家分'] ] },
|
||||
{ q: '莫名其妙想哭的时候,你会?', o: [
|
||||
['song', '睡一觉,醒来就好了'], ['re', '打电话找闺蜜倾诉'], ['xue', '查查是不是激素在作怪'], ['nuan', '抱抱自己,允许情绪来'] ] },
|
||||
{ q: '家里人对带娃方式意见不同时,你会?', o: [
|
||||
['nuan', '先照顾大家情绪再沟通'], ['song', '大方向对就行,不纠结'], ['re', '全家开个小会摊开聊'], ['xue', '拿出资料讲科学依据'] ] },
|
||||
{ q: '老公说「我也想参与孕期」,你会让他?', o: [
|
||||
['xue', '学会看懂产检报告'], ['nuan', '每晚给宝宝讲个故事'], ['song', '负责每天逗你开心'], ['re', '陪你去上孕妈课'] ] },
|
||||
{ q: '理想的孕期周末是?', o: [
|
||||
['re', '约朋友喝个下午茶'], ['song', '窝在家睡到自然醒'], ['xue', '上节孕妈课或看本书'], ['nuan', '给宝宝写日记、理衣柜'] ] },
|
||||
{ q: '给宝宝取名,你的方式是?', o: [
|
||||
['song', '小名先叫着,大名不急'], ['xue', '查字义、读音和寓意'], ['re', '发起全家投票'], ['nuan', '选一个念着最温柔的'] ] },
|
||||
{ q: '准备待产包,你的风格更像?', o: [
|
||||
['nuan', '小衣服洗好晒好叠整齐'], ['re', '拉闺蜜一起逛,顺手分享'], ['song', '买齐必需品,缺啥再补'], ['xue', '按清单逐项打勾'] ] },
|
||||
{ q: '离预产期还有一个月,你在?', o: [
|
||||
['xue', '反复熟悉入院流程路线'], ['re', '和孕妈群约好互报喜讯'], ['nuan', '每天跟宝宝说慢慢来'], ['song', '该吃吃该睡睡,等发动'] ] },
|
||||
{ q: '想象宝宝出生后的第一张照片,你希望是?', o: [
|
||||
['re', '全家围着宝宝笑成一团'], ['song', '宝宝睡得四仰八叉'], ['nuan', '小手紧紧握着你的手指'], ['xue', '宝宝和身长体重出生卡'] ] },
|
||||
{ q: '想象宝宝第一次大哭不止,你会?', o: [
|
||||
['song', '先稳住自己,别慌'], ['nuan', '抱在怀里轻轻哼歌'], ['xue', '逐项排查:饿了还是尿了'], ['re', '视频问问有经验的妈妈'] ] }
|
||||
];
|
||||
$('#qTotal').textContent = QS.length;
|
||||
|
||||
var views = { start: $('#vStart'), quiz: $('#vQuiz'), result: $('#vResult') };
|
||||
var io = 'IntersectionObserver' in window ? new IntersectionObserver(function (es) {
|
||||
es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } });
|
||||
}, { root: sc, threshold: .1 }) : null;
|
||||
|
||||
function show(name) {
|
||||
Object.keys(views).forEach(function (k) { views[k].classList.toggle('on', k === name); });
|
||||
sc.scrollTop = 0;
|
||||
[].forEach.call(views[name].querySelectorAll('.fade'), function (el) {
|
||||
el.classList.remove('in');
|
||||
if (io) { io.unobserve(el); io.observe(el); } else el.classList.add('in');
|
||||
});
|
||||
}
|
||||
|
||||
/* 答题 */
|
||||
var cur = 0, ans = [], busy = false;
|
||||
var body = $('#qBody');
|
||||
|
||||
function paint() {
|
||||
var q = QS[cur];
|
||||
$('#qNo').textContent = cur + 1;
|
||||
$('#qFill').style.width = ((cur + 1) / QS.length * 100) + '%';
|
||||
$('#qTitle').textContent = q.q;
|
||||
$('#qOpts').innerHTML = q.o.map(function (o, i) {
|
||||
return '<button class="opt' + (ans[cur] === i ? ' sel' : '') + '" data-i="' + i + '" data-t="' + o[0] + '"><span class="l">' + 'ABCD'[i] + '</span><span>' + esc(o[1]) + '</span></button>';
|
||||
}).join('');
|
||||
$('#prevBtn').disabled = cur === 0;
|
||||
}
|
||||
|
||||
/* 轻柔切换:淡出上移 → 换内容 → 自下淡入 */
|
||||
function swap(after) {
|
||||
busy = true;
|
||||
body.classList.add('out');
|
||||
setTimeout(function () {
|
||||
after();
|
||||
body.classList.remove('out');
|
||||
body.classList.add('pre');
|
||||
void body.offsetWidth;
|
||||
body.classList.remove('pre');
|
||||
setTimeout(function () { busy = false; }, 200);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
$('#qOpts').addEventListener('click', function (e) {
|
||||
var b = e.target.closest('.opt'); if (!b || busy) return;
|
||||
busy = true;
|
||||
ans[cur] = +b.dataset.i;
|
||||
[].forEach.call(document.querySelectorAll('#qOpts .opt'), function (x) { x.classList.toggle('sel', x === b); });
|
||||
setTimeout(function () {
|
||||
if (cur < QS.length - 1) swap(function () { cur++; paint(); });
|
||||
else { busy = false; finish(); }
|
||||
}, 250);
|
||||
});
|
||||
$('#prevBtn').addEventListener('click', function () {
|
||||
if (busy || cur === 0) return;
|
||||
swap(function () { cur--; paint(); });
|
||||
});
|
||||
|
||||
function startQuiz() {
|
||||
cur = 0; ans = []; busy = false;
|
||||
body.classList.remove('out', 'pre');
|
||||
paint();
|
||||
show('quiz');
|
||||
}
|
||||
$('#startBtn').addEventListener('click', startQuiz);
|
||||
$('#againBtn').addEventListener('click', startQuiz);
|
||||
|
||||
function finish() {
|
||||
var s = { nuan: 0, xue: 0, song: 0, re: 0 };
|
||||
ans.forEach(function (i, qi) { s[QS[qi].o[i][0]]++; });
|
||||
var top = ORDER.reduce(function (a, k) { return s[k] > s[a] ? k : a; }, ORDER[0]);
|
||||
/* 平分时以最后一题的选择打破平局(如果它属于并列第一) */
|
||||
var last = QS[QS.length - 1].o[ans[QS.length - 1]][0];
|
||||
if (s[last] === s[top]) top = last;
|
||||
var rec = { type: top, scores: s, at: Date.now() };
|
||||
try { localStorage.setItem(KEY, JSON.stringify(rec)); } catch (e) {}
|
||||
render(rec, false);
|
||||
}
|
||||
|
||||
var curType = null;
|
||||
function render(rec, fromCache) {
|
||||
var t = TYPES[rec.type];
|
||||
curType = t;
|
||||
$('#rImg').src = t.img; $('#rImg').alt = t.alt;
|
||||
$('#rName').textContent = t.name + '妈妈';
|
||||
$('#rLine').textContent = t.line;
|
||||
var last = $('#rLast');
|
||||
if (fromCache && rec.at) {
|
||||
var d = new Date(rec.at);
|
||||
last.textContent = '上次测试 · ' + (d.getMonth() + 1) + '月' + d.getDate() + '日';
|
||||
last.classList.add('on');
|
||||
} else last.classList.remove('on');
|
||||
$('#rAdv').innerHTML = t.adv.map(function (a) { return '<span>' + esc(a) + '</span>'; }).join('');
|
||||
$('#rTip').textContent = t.tip;
|
||||
useRef($('#rToolIc'), t.tool.ic);
|
||||
$('#rToolName').textContent = t.tool.name;
|
||||
$('#rTool').onclick = function () { location.href = t.tool.path + location.search + location.hash; };
|
||||
var total = 0; ORDER.forEach(function (k) { total += rec.scores[k] || 0; });
|
||||
total = total || 1;
|
||||
/* 占比按四舍五入后补差,保证合计 100% */
|
||||
var pcts = ORDER.map(function (k) { return Math.round((rec.scores[k] || 0) / total * 100); });
|
||||
var diff = 100 - pcts.reduce(function (a, b) { return a + b; }, 0);
|
||||
pcts[ORDER.indexOf(rec.type)] += diff;
|
||||
$('#rDist').innerHTML = ORDER.map(function (k, i) {
|
||||
return '<div class="dr' + (k === rec.type ? ' me' : '') + '"><span class="n">' + TYPES[k].name.slice(0, 4) + '</span>' +
|
||||
'<span class="tr"><i data-w="' + pcts[i] + '"></i></span><span class="p">' + pcts[i] + '%</span></div>';
|
||||
}).join('');
|
||||
show('result');
|
||||
var bars = document.querySelectorAll('#rDist i');
|
||||
function grow() { [].forEach.call(bars, function (b) { b.style.width = b.dataset.w + '%'; }); }
|
||||
if (io) {
|
||||
var bo = new IntersectionObserver(function (es) { if (es[0].isIntersecting) { setTimeout(grow, 120); bo.disconnect(); } }, { root: sc, threshold: .2 });
|
||||
bo.observe($('#rDist'));
|
||||
} else grow();
|
||||
}
|
||||
|
||||
/* 分享:复制一段文字(链接不带身份 hash),复制不了就提示截图 */
|
||||
var tt;
|
||||
function toast(msg) {
|
||||
var el = $('#toast'); el.textContent = msg; el.classList.add('on');
|
||||
clearTimeout(tt); tt = setTimeout(function () { el.classList.remove('on'); }, 2400);
|
||||
}
|
||||
function copy(text) {
|
||||
function legacy() { return new Promise(function (ok, no) {
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = text; ta.setAttribute('readonly', ''); ta.style.cssText = 'position:fixed;top:-999px;opacity:0';
|
||||
document.body.appendChild(ta); ta.select();
|
||||
var r = false; try { r = document.execCommand('copy'); } catch (e) {}
|
||||
document.body.removeChild(ta);
|
||||
r ? ok() : no();
|
||||
}); }
|
||||
if (navigator.clipboard && window.isSecureContext) return navigator.clipboard.writeText(text).catch(legacy);
|
||||
return legacy();
|
||||
}
|
||||
$('#shareBtn').addEventListener('click', function () {
|
||||
if (!curType) return;
|
||||
var text = '老公,我测出来是「' + curType.name + '妈妈」:' + curType.line + '。你觉得像吗?';
|
||||
copy(text).then(function () { toast('已复制,发给老公看看吧'); }, function () { toast('截个图发给老公看看吧'); });
|
||||
});
|
||||
|
||||
/* 入口:有上次结果直接看结果,否则开始页 */
|
||||
var saved = null;
|
||||
try { saved = JSON.parse(localStorage.getItem(KEY) || 'null'); } catch (e) {}
|
||||
if (saved && TYPES[saved.type] && saved.scores) render(saved, true);
|
||||
else show('start');
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
topic/huafei/img/baby.webp
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
topic/huafei/img/hero.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
topic/huafei/img/hospital.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
topic/huafei/img/plan.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
447
topic/huafei/index.html
Normal file
@@ -0,0 +1,447 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>生娃计算器 · 到底要花多少钱</title>
|
||||
<!-- 孕期专题 · 生娃计算器(孕期首页「其他妈妈也在搜」第 1 条入口)。
|
||||
2026-10-31 v2 重做:按 topic-spec v2(主色 #18A058),改成「一屏一题 → 出结果」的分步计算器。
|
||||
开始屏 → 7 个问题(城市 / 医院 / 分娩 / 月子 / 喂养 / 1~3 岁谁带 / 花钱风格)→ 结果屏(生下来 / 养到 1、2、3 岁切换)。
|
||||
选择存 localStorage「mmbox.huafei.v2」,再进来直接看上次结果。改价格只改脚本顶部 COST 表。
|
||||
自成一页:不引 app.js;返回走 history.back 或相对路径 ../../ 并带回 search + hash。 -->
|
||||
<style>
|
||||
:root{--c:#18A058;--cbg:#EAF7F0;--h:#1F2329;--t:#4E5969;--s:#86909C;--line:#EEF0F3;--gray:#F7F8FA}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--t);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
.ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.hide{position:absolute;width:0;height:0;overflow:hidden}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;padding-top:env(safe-area-inset-top);background:rgba(255,255,255,0);border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
|
||||
.bar.on{background:#fff;border-bottom-color:var(--line)}
|
||||
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--h)}
|
||||
.bar .back .ic{width:22px;height:22px}
|
||||
.bar .t{font-size:16px;font-weight:600;color:var(--h)}
|
||||
|
||||
.screen{display:none;padding:0 20px}
|
||||
.screen.on{display:block;animation:fd .35s ease both}
|
||||
@keyframes fd{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
||||
@media (prefers-reduced-motion:reduce){.screen.on{animation:none}}
|
||||
|
||||
.btn{display:flex;align-items:center;justify-content:center;width:100%;height:46px;border-radius:99px;background:var(--c);color:#fff;font-size:16px;font-weight:600}
|
||||
.btn.ghost{background:#fff;color:var(--c);border:1px solid var(--c)}
|
||||
|
||||
/* 开始屏 */
|
||||
.hero{margin-top:8px;height:200px;border-radius:20px;overflow:hidden;background:var(--gray)}
|
||||
.hero img{width:100%;height:100%;object-fit:cover}
|
||||
h1{margin-top:22px;font-size:26px;font-weight:800;line-height:1.3;color:var(--h)}
|
||||
.lead{margin-top:8px;color:var(--t)}
|
||||
.start-list{margin:20px 0 26px;padding:14px 16px;border-radius:18px;background:var(--gray);display:grid;grid-template-columns:1fr 1fr;gap:6px 12px;font-size:13.5px;color:var(--t);line-height:1.6}
|
||||
.start-list span{display:flex;align-items:center;gap:6px}
|
||||
.start-list i{flex:none;width:5px;height:5px;border-radius:50%;background:var(--c)}
|
||||
.tiny{margin-top:12px;font-size:12.5px;color:var(--s);text-align:center;line-height:1.6}
|
||||
|
||||
/* 问题屏 */
|
||||
.prog{display:flex;align-items:center;gap:12px;margin-top:6px}
|
||||
.prog .pb{flex:1;height:6px;border-radius:9px;background:var(--line);overflow:hidden}
|
||||
.prog .pb i{display:block;height:100%;border-radius:9px;background:var(--c);transition:width .3s}
|
||||
.prog span{font-size:13px;color:var(--s);font-variant-numeric:tabular-nums}
|
||||
.qh{margin-top:26px;font-size:22px;font-weight:800;line-height:1.35;color:var(--h)}
|
||||
.qs{margin-top:4px;font-size:13.5px;color:var(--s)}
|
||||
.opts{margin-top:20px;display:flex;flex-direction:column;gap:12px}
|
||||
.opt{display:flex;align-items:center;gap:12px;width:100%;min-height:68px;padding:12px 16px;border-radius:18px;border:1.5px solid var(--line);background:#fff;text-align:left;transition:border-color .15s,background .15s}
|
||||
.opt .ox{flex:1;min-width:0}
|
||||
.opt b{display:block;font-size:16.5px;font-weight:700;color:var(--h);line-height:1.4}
|
||||
.opt small{display:block;margin-top:2px;font-size:13px;color:var(--s);line-height:1.45}
|
||||
.opt .rd{flex:none;width:22px;height:22px;border-radius:50%;border:1.5px solid #D5D9DE;display:grid;place-items:center}
|
||||
.opt.on{border-color:var(--c);background:var(--cbg)}
|
||||
.opt.on .rd{border-color:var(--c);background:var(--c)}
|
||||
.opt.on .rd::after{content:"";width:8px;height:8px;border-radius:50%;background:#fff}
|
||||
.prev{display:inline-flex;align-items:center;gap:2px;margin-top:22px;padding:6px 4px;font-size:14px;color:var(--s)}
|
||||
.prev .ic{width:18px;height:18px}
|
||||
|
||||
/* 结果屏 */
|
||||
.r-t{margin-top:6px;font-size:20px;font-weight:800;color:var(--h)}
|
||||
.chips{margin-top:8px;display:flex;flex-wrap:wrap;gap:6px}
|
||||
.chips button{padding:2px 10px;border-radius:99px;background:var(--gray);font-size:12.5px;color:var(--t);line-height:1.8}
|
||||
.hint{margin-top:6px;font-size:12.5px;color:var(--s)}
|
||||
.tabs{margin-top:16px;display:flex;padding:3px;border-radius:99px;background:var(--gray)}
|
||||
.tabs button{flex:1;min-width:0;height:36px;border-radius:99px;font-size:14px;color:var(--t);white-space:nowrap;transition:background .2s,color .2s}
|
||||
.tabs button.on{background:#fff;color:var(--c);font-weight:700;box-shadow:0 2px 8px rgba(0,0,0,.06)}
|
||||
.total{margin-top:14px;padding:20px 16px 18px;border-radius:18px;background:var(--cbg);text-align:center}
|
||||
.total .l{font-size:13px;color:var(--t)}
|
||||
.total .v{margin-top:2px;font-size:30px;font-weight:800;color:var(--c);line-height:1.3;font-variant-numeric:tabular-nums}
|
||||
.total .v span{white-space:nowrap}
|
||||
.total .m{margin-top:4px;font-size:13.5px;color:var(--t)}
|
||||
.total .m b{color:var(--h)}
|
||||
.stack{margin-top:18px;display:flex;gap:2px;height:12px;border-radius:9px;overflow:hidden}
|
||||
.stack i{display:block;height:100%;transition:flex-grow .4s,background .3s}
|
||||
.list{margin-top:10px;border-top:1px solid var(--line)}
|
||||
.list details{border-bottom:1px solid var(--line)}
|
||||
.list summary{list-style:none;display:flex;align-items:center;gap:10px;padding:13px 2px;cursor:pointer}
|
||||
.list summary::-webkit-details-marker{display:none}
|
||||
.list .dot{flex:none;width:10px;height:10px;border-radius:3px}
|
||||
.list .nm{flex:1;min-width:0;font-size:15px;color:var(--h)}
|
||||
.list .rg{font-size:15px;font-weight:700;color:var(--h);white-space:nowrap;font-variant-numeric:tabular-nums}
|
||||
.list .ar{flex:none;width:16px;height:16px;color:#C0C5CC;transition:transform .2s}
|
||||
.list details[open] .ar{transform:rotate(180deg)}
|
||||
.list .ds{padding:0 2px 12px 20px;font-size:13px;color:var(--s);line-height:1.6}
|
||||
.list details.off .nm,.list details.off .rg{color:#C0C5CC;font-weight:400}
|
||||
.list details.off .rg{font-size:13px}
|
||||
|
||||
.card{margin-top:16px;padding:14px 16px;border-radius:18px;border:1px solid var(--line);background:#fff}
|
||||
.row{display:flex;gap:10px;align-items:flex-start}
|
||||
.row+.row{margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
|
||||
.row .ic{margin-top:3px;color:var(--c)}
|
||||
.row b{display:block;font-size:15px;color:var(--h);line-height:1.5}
|
||||
.row b em{font-style:normal;color:var(--c)}
|
||||
.row p{font-size:13.5px;color:var(--t);line-height:1.6}
|
||||
.ins p{margin-top:2px}
|
||||
.ins .f span{white-space:nowrap}
|
||||
.ins .f{display:inline-block;margin-top:6px;padding:4px 10px;border-radius:10px;background:var(--gray);font-size:12.5px;color:var(--h)}
|
||||
.acts{margin-top:22px}
|
||||
.note{margin-top:14px;font-size:12px;color:var(--s);line-height:1.6;text-align:center}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-down" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"/></symbol>
|
||||
<symbol id="i-coin" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9 7.5l3 4 3-4M12 11.5V17M9 12.5h6M9 15h6"/></symbol>
|
||||
<symbol id="i-bulb" viewBox="0 0 24 24"><path d="M9 18.5h6M10.2 21.5h3.6M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"/></symbol>
|
||||
<symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z"/><path d="M9 12l2 2 4-4"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<!-- 开始屏 -->
|
||||
<section class="screen" id="sStart">
|
||||
<div class="hero"><img src="img/hero.webp" alt="孕妈在桌前记账"></div>
|
||||
<h1>生娃计算器<br>到底要花多少钱?</h1>
|
||||
<p class="lead">回答 7 个小问题,算出从怀孕到宝宝 3 岁大概要花多少。</p>
|
||||
<div class="start-list">
|
||||
<span><i></i>孕期产检</span><span><i></i>分娩住院</span>
|
||||
<span><i></i>坐月子</span><span><i></i>养到 1~3 岁</span>
|
||||
</div>
|
||||
<button class="btn" id="go">开始计算</button>
|
||||
<p class="tiny">约 1 分钟 · 不用填个人信息</p>
|
||||
</section>
|
||||
|
||||
<!-- 问题屏 -->
|
||||
<section class="screen" id="sQ">
|
||||
<div class="prog"><div class="pb"><i id="pbar"></i></div><span id="pnum">1 / 7</span></div>
|
||||
<h2 class="qh" id="qh"></h2>
|
||||
<p class="qs" id="qs"></p>
|
||||
<div class="opts" id="opts"></div>
|
||||
<button class="prev" id="prev"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg>上一步</button>
|
||||
</section>
|
||||
|
||||
<!-- 结果屏 -->
|
||||
<section class="screen" id="sRes">
|
||||
<h2 class="r-t">你家大概要花</h2>
|
||||
<div class="chips" id="chips"></div>
|
||||
<p class="hint">点任一项可单独修改</p>
|
||||
<div class="tabs" id="tabs">
|
||||
<button data-s="0">生下来</button><button data-s="1">养到1岁</button><button data-s="2">养到2岁</button><button data-s="3">养到3岁</button>
|
||||
</div>
|
||||
<div class="total" aria-live="polite">
|
||||
<div class="l" id="totL"></div>
|
||||
<div class="v" id="totV"></div>
|
||||
<div class="m" id="totM"></div>
|
||||
</div>
|
||||
<div class="stack" id="stack"></div>
|
||||
<div class="list" id="list"></div>
|
||||
|
||||
<div class="card">
|
||||
<div class="row"><svg class="ic"><use href="#i-coin" xlink:href="#i-coin"/></svg><div><b id="bigT"></b><p id="bigD"></p></div></div>
|
||||
<div class="row"><svg class="ic"><use href="#i-bulb" xlink:href="#i-bulb"/></svg><div><b>能省的地方</b><p id="save"></p></div></div>
|
||||
</div>
|
||||
|
||||
<div class="card ins">
|
||||
<div class="row"><svg class="ic"><use href="#i-shield" xlink:href="#i-shield"/></svg><div>
|
||||
<b>生育保险能报一部分</b>
|
||||
<p>产检和分娩费用可按规定报销;产假期间还能领生育津贴。以当地医保为准。</p>
|
||||
<span class="f"><span>生育津贴 = 单位上年度职工月平均工资</span> <span>÷ 30 × 产假天数</span></span>
|
||||
</div></div>
|
||||
</div>
|
||||
|
||||
<div class="acts"><button class="btn ghost" id="redo">重新选择</button></div>
|
||||
<p class="note">按常见价格区间粗略估算,各地各医院差别很大,以实际为准;不含孕期并发症、早产、住院等意外支出。</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/* ================= 费用表(单位:元,[低, 高],医保报销前的常见区间,偏保守取整) =================
|
||||
城市下标 c:0 一线 / 1 新一线及省会 / 2 普通地级市 / 3 县城及乡镇
|
||||
×STYLE 的项是「可选消费」,按第 7 题花钱风格乘系数;其余是刚性支出,不乘。 */
|
||||
var COST = {
|
||||
// —— 生下来 ——
|
||||
// 孕期产检全程(约 10~13 次 + 筛查)[c][医院],医院 0 公立普通 / 1 公立特需或单间 / 2 私立
|
||||
check: [
|
||||
[[6000, 10000], [15000, 30000], [20000, 50000]],
|
||||
[[4000, 8000], [10000, 20000], [15000, 35000]],
|
||||
[[3000, 6000], [6000, 12000], [8000, 20000]],
|
||||
[[2000, 4000], [4000, 8000], [5000, 12000]]
|
||||
],
|
||||
// 孕妇装、待产包等孕期用品 [c],×STYLE
|
||||
pregGoods: [[2000, 5000], [1500, 4000], [1200, 3000], [1000, 2500]],
|
||||
// 分娩住院 [c][医院][方式],方式 0 顺产 / 1 剖宫产;「还不确定」取两者合并区间(顺产低值 ~ 剖宫产高值)
|
||||
birth: [
|
||||
[[[6000, 12000], [12000, 20000]], [[15000, 30000], [25000, 45000]], [[30000, 60000], [45000, 90000]]],
|
||||
[[[4000, 8000], [8000, 15000]], [[10000, 20000], [15000, 30000]], [[18000, 40000], [28000, 60000]]],
|
||||
[[[3000, 6000], [6000, 11000]], [[6000, 12000], [10000, 18000]], [[10000, 25000], [15000, 35000]]],
|
||||
[[[2000, 4000], [4000, 8000]], [[4000, 8000], [6000, 12000]], [[6000, 15000], [10000, 22000]]]
|
||||
],
|
||||
// 坐月子(含月子餐、产妇用品)[c][方式],0 家人照顾 / 1 月嫂约 26 天 / 2 月子中心约 28 天
|
||||
yuezi: [
|
||||
[[3000, 8000], [15000, 30000], [40000, 100000]],
|
||||
[[2500, 6000], [10000, 20000], [25000, 60000]],
|
||||
[[2000, 5000], [7000, 14000], [15000, 35000]],
|
||||
[[1500, 4000], [5000, 10000], [10000, 25000]]
|
||||
],
|
||||
|
||||
// —— 0~1 岁 ——
|
||||
eat01: [[1000, 3000], [5000, 9000], [8000, 14000]], // 奶粉/辅食 [喂养]:0 母乳为主 / 1 混合 / 2 奶粉为主(不分城市)
|
||||
diaper01: [3000, 5000], // 纸尿裤湿巾(不分城市)
|
||||
goods01: [[5000, 10000], [4000, 8000], [3000, 6000], [2500, 5000]], // 衣物、婴儿床推车安全座椅、洗护玩具 [c],×STYLE
|
||||
med01: [[1500, 6000], [1200, 5000], [1000, 4000], [800, 3000]], // 看病 + 自费疫苗 [c]
|
||||
// 0~1 岁按产假 + 家人带计,不算带娃费用(第 6 题只管 1~3 岁)
|
||||
|
||||
// —— 1~2 岁 ——
|
||||
eat12: [[3000, 6000], [5000, 9000], [6000, 11000]], // 奶粉/辅食/日常饮食 [喂养]
|
||||
diaper12: [2500, 4000],
|
||||
goods12: [[4000, 8000], [3000, 6000], [2500, 5000], [2000, 4000]], // 衣物用品玩具 [c],×STYLE
|
||||
edu12: [[2000, 8000], [1500, 6000], [1000, 4000], [500, 3000]], // 早教、绘本、游乐 [c],×STYLE
|
||||
med12: [[1200, 4000], [1000, 3500], [800, 3000], [600, 2500]],
|
||||
|
||||
// —— 2~3 岁 ——
|
||||
eat23: [[6000, 10000], [5000, 8000], [4000, 7000], [3000, 6000]], // 日常饮食 + 牛奶 [c]
|
||||
diaper23: [800, 2000], // 逐步戒纸尿裤
|
||||
goods23: [[4000, 8000], [3000, 6000], [2500, 5000], [2000, 4000]], // ×STYLE
|
||||
edu23: [[3000, 10000], [2000, 8000], [1500, 5000], [800, 3500]], // ×STYLE
|
||||
med23: [[1000, 3500], [800, 3000], [600, 2500], [500, 2000]],
|
||||
|
||||
// —— 1~3 岁谁来带(按年计)[带法][c] ——
|
||||
// 0 老人或自己带:少量补贴(约 100~1000 元/月)
|
||||
// 1 育儿嫂或保姆:月薪 × 12;2 托育园全日托:月费 × 12
|
||||
care: [
|
||||
[[4800, 12000], [3600, 9600], [2400, 7200], [1200, 6000]],
|
||||
[[7000 * 12, 10000 * 12], [5000 * 12, 7500 * 12], [4000 * 12, 6000 * 12], [3000 * 12, 4500 * 12]],
|
||||
[[4000 * 12, 8000 * 12], [2500 * 12, 5000 * 12], [1800 * 12, 3500 * 12], [1200 * 12, 2500 * 12]]
|
||||
],
|
||||
|
||||
STYLE: [0.6, 1, 1.8] // 花钱风格系数:精打细算 / 适中 / 想给最好的
|
||||
};
|
||||
|
||||
/* ================= 问题 ================= */
|
||||
var QS = [
|
||||
{ k: 'city', h: '你在哪类城市?', s: '各地价格差别最大的一项', o: [
|
||||
['一线城市', '北京、上海、广州、深圳'], ['新一线及省会', '如成都、杭州、武汉、各省会'], ['普通地级市', '三四线城市'], ['县城及乡镇', '县城、镇上']] },
|
||||
{ k: 'hosp', h: '打算在哪生?', s: '产检一般也在同一家', o: [
|
||||
['公立医院普通病房', '多人间,大多数人的选择'], ['公立医院特需或单间', '单人间、特需门诊,部分自费'], ['私立医院', '环境服务好,基本全自费']] },
|
||||
{ k: 'way', h: '分娩方式?', s: '最终听医生评估', o: [
|
||||
['顺产', '住院约 2~3 天'], ['剖宫产', '住院约 4~6 天,费用更高'], ['还不确定', '两种都算进去,区间宽一些']] },
|
||||
{ k: 'yz', h: '月子怎么坐?', s: '这项差距最大', o: [
|
||||
['家人照顾', '主要花在月子餐和产妇用品'], ['请月嫂', '上门照顾,一般 26 天'], ['月子中心', '一般 28 天套餐']] },
|
||||
{ k: 'feed', h: '宝宝怎么喂?', s: '大概的打算就行', o: [
|
||||
['母乳为主', '奶粉钱很少'], ['混合喂养', '母乳加一部分奶粉'], ['奶粉为主', '奶粉是每月固定开销']] },
|
||||
{ k: 'care', h: '1~3 岁谁来带?', s: '产假结束后的安排', o: [
|
||||
['老人或自己带', '给老人一点补贴'], ['请育儿嫂或保姆', '按月薪算'], ['上托育园(全日托)', '按月费算']] },
|
||||
{ k: 'style', h: '平时花钱风格?', s: '影响用品、衣物、玩具、早教', o: [
|
||||
['精打细算', '够用就行,能借能用二手'], ['适中', '买点好的,不追高'], ['想给最好的', '用品玩具早教都挑好的']] }
|
||||
];
|
||||
var SHORT = { // 结果页的选择标签
|
||||
city: ['一线', '新一线/省会', '地级市', '县城乡镇'], hosp: ['公立普通', '公立特需', '私立'], way: ['顺产', '剖宫产', '方式未定'],
|
||||
yz: ['家人坐月子', '请月嫂', '月子中心'], feed: ['母乳', '混合喂养', '奶粉'], care: ['老人带', '育儿嫂', '托育园'], style: ['精打细算', '适中', '给最好的']
|
||||
};
|
||||
var STAGES = ['孕期产检', '分娩住院', '坐月子', '0~1岁', '1~2岁', '2~3岁'];
|
||||
var SHADES = ['#0B6E3A', '#18A058', '#45B779', '#79CC9E', '#A8DFC0', '#D2F0DF'];
|
||||
var TAB_L = ['怀孕到坐完月子', '怀孕到宝宝 1 岁', '怀孕到宝宝 2 岁', '怀孕到宝宝 3 岁'];
|
||||
var UPTO = [3, 4, 5, 6]; // 每个标签包含前几段
|
||||
var MONTHS = [10, 21, 33, 45]; // 平均每月的分母:怀孕约 9 个月 + 月子 1 个月;之后每岁 12 个月
|
||||
var KEY = 'mmbox.huafei.v2';
|
||||
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var sc = $('#scroll');
|
||||
var st = { city: 1, hosp: 0, way: 2, yz: 0, feed: 1, care: 0, style: 1 };
|
||||
var stage = 1, qi = 0, editing = false;
|
||||
|
||||
function add(a, b) { return [a[0] + b[0], a[1] + b[1]]; }
|
||||
function mul(a, k) { return [a[0] * k, a[1] * k]; }
|
||||
function sum() { return [].slice.call(arguments).reduce(add, [0, 0]); }
|
||||
|
||||
/* 六段费用,返回 [[低, 高] × 6] */
|
||||
function calc(s) {
|
||||
var c = s.city, k = COST.STYLE[s.style];
|
||||
var b = COST.birth[c][s.hosp];
|
||||
var birth = s.way === 2 ? [Math.min(b[0][0], b[1][0]), Math.max(b[0][1], b[1][1])] : b[s.way];
|
||||
var care = COST.care[s.care][c];
|
||||
return [
|
||||
sum(COST.check[c][s.hosp], mul(COST.pregGoods[c], k)),
|
||||
birth,
|
||||
COST.yuezi[c][s.yz],
|
||||
sum(COST.eat01[s.feed], COST.diaper01, mul(COST.goods01[c], k), COST.med01[c]),
|
||||
sum(COST.eat12[s.feed], COST.diaper12, mul(COST.goods12[c], k), mul(COST.edu12[c], k), COST.med12[c], care),
|
||||
sum(COST.eat23[c], COST.diaper23, mul(COST.goods23[c], k), mul(COST.edu23[c], k), COST.med23[c], care)
|
||||
];
|
||||
}
|
||||
|
||||
function wan(n) { return (Math.round(n / 1000) / 10) + '万'; }
|
||||
function yuan(n) { return String(Math.round(n / 100) * 100).replace(/\B(?=(\d{3})+(?!\d))/g, ','); }
|
||||
function rng(a) { return wan(a[0]) + '~' + wan(a[1]); } // 统一用「万」,一位小数
|
||||
|
||||
function detail(i) {
|
||||
var s = st;
|
||||
var careTxt = ['老人带的少量补贴', '育儿嫂 12 个月工资', '托育园 12 个月费用'][s.care];
|
||||
return [
|
||||
'约 10~13 次产检和筛查(' + QS[1].o[s.hosp][0] + '),加孕妇装、待产包',
|
||||
(s.way === 2 ? '按顺产到剖宫产的范围算' : QS[2].o[s.way][0] + ',' + QS[2].o[s.way][1].replace(',费用更高', '')) + ';含接生或手术、麻醉、床位、新生儿筛查',
|
||||
['月子餐食材、产妇用品、产后复查', '月嫂约 26 天工资,加月子餐和产妇用品', '月子中心约 28 天套餐,含住宿餐食和母婴护理'][s.yz],
|
||||
QS[4].o[s.feed][0] + '的奶粉辅食、纸尿裤、衣物和婴儿床推车等用品、看病和自费疫苗',
|
||||
'奶粉辅食、纸尿裤、衣物玩具早教、看病疫苗,加' + careTxt,
|
||||
'日常饮食、纸尿裤(逐步戒掉)、衣物玩具早教、看病,加' + careTxt
|
||||
][i];
|
||||
}
|
||||
|
||||
/* 能省的地方(≤30 字),按最花钱的那段给 */
|
||||
function saveTip(i) {
|
||||
var s = st;
|
||||
if (i === 0) return s.hosp ? '常规产检在公立医院做,只把分娩放在想去的医院。' : '跟着医生的产检表走,不额外加做没必要的项目。';
|
||||
if (i === 1) return s.hosp ? '公立医院普通病房也安全,单间按需再升级。' : '提前问清医保能不能直接结算,出院少垫钱。';
|
||||
if (i === 2) return s.yz === 2 ? '月子中心可只住 2 周,后面换月嫂或家人接手。' : s.yz === 1 ? '月嫂可只请前 2 周,之后家人接手。' : '月子餐自己做,产妇用品按需买不囤货。';
|
||||
if (i === 3) return s.feed ? '奶粉先买小罐试,宝宝适合再按需补,别囤货。' : '大件用品能借就借,衣服各尺码几套够换洗就行。';
|
||||
if (s.care === 1) return '老人能搭把手的话,育儿嫂可只请白天或半天。';
|
||||
if (s.care === 2) return '托育园可先上半日托,或等 2 岁后再上全日托。';
|
||||
return s.style === 2 ? '早教班不用早报,玩具绘本可以轮换或借阅。' : '衣物玩具亲友送、买二手都行,省下的留作备用金。';
|
||||
}
|
||||
|
||||
/* ================= 屏幕切换 ================= */
|
||||
function show(id) {
|
||||
[].forEach.call(document.querySelectorAll('.screen'), function (el) { el.classList.toggle('on', el.id === id); });
|
||||
sc.scrollTop = 0;
|
||||
}
|
||||
|
||||
function renderQ() {
|
||||
var q = QS[qi];
|
||||
$('#pbar').style.width = ((qi + 1) / QS.length * 100) + '%';
|
||||
$('#pnum').textContent = (qi + 1) + ' / ' + QS.length;
|
||||
$('#qh').textContent = q.h;
|
||||
$('#qs').textContent = q.s;
|
||||
$('#opts').innerHTML = q.o.map(function (o, v) {
|
||||
return '<button class="opt' + (st[q.k] === v && st._done ? ' on' : '') + '" data-v="' + v + '"><span class="ox"><b>' + o[0] + '</b><small>' + o[1] + '</small></span><span class="rd"></span></button>';
|
||||
}).join('');
|
||||
$('#prev').style.visibility = editing ? 'hidden' : 'visible';
|
||||
show('sQ');
|
||||
}
|
||||
|
||||
$('#opts').addEventListener('click', function (e) {
|
||||
var b = e.target.closest('.opt'); if (!b || $('#opts').dataset.lock) return;
|
||||
[].forEach.call(this.children, function (x) { x.classList.toggle('on', x === b); });
|
||||
st[QS[qi].k] = +b.dataset.v;
|
||||
$('#opts').dataset.lock = '1';
|
||||
setTimeout(function () {
|
||||
delete $('#opts').dataset.lock;
|
||||
if (editing || qi === QS.length - 1) { st._done = true; editing = false; save(); renderRes(); show('sRes'); }
|
||||
else { qi++; renderQ(); }
|
||||
}, 220);
|
||||
});
|
||||
$('#prev').addEventListener('click', function () { if (qi > 0) { qi--; renderQ(); } else show('sStart'); });
|
||||
$('#go').addEventListener('click', function () { qi = 0; editing = false; renderQ(); });
|
||||
$('#redo').addEventListener('click', function () { qi = 0; editing = false; renderQ(); });
|
||||
|
||||
function renderRes() {
|
||||
var parts = calc(st), n = UPTO[stage];
|
||||
var mids = parts.map(function (p) { return (p[0] + p[1]) / 2; });
|
||||
var all = mids.reduce(function (a, b) { return a + b; }, 0);
|
||||
var tot = parts.slice(0, n).reduce(add, [0, 0]);
|
||||
|
||||
[].forEach.call($('#tabs').children, function (b, i) { b.classList.toggle('on', i === stage); });
|
||||
$('#chips').innerHTML = QS.map(function (q, i) { return '<button data-q="' + i + '">' + SHORT[q.k][st[q.k]] + '</button>'; }).join('');
|
||||
$('#totL').textContent = TAB_L[stage] + ',合计约';
|
||||
var w = tot[1] >= 10000;
|
||||
$('#totV').innerHTML = '<span>' + (w ? wan(tot[0]) : yuan(tot[0])) + '~</span><wbr><span>' + (w ? wan(tot[1]) : yuan(tot[1]) + '元') + '</span>';
|
||||
$('#totM').innerHTML = '平均每月约 <b>' + yuan((tot[0] + tot[1]) / 2 / MONTHS[stage]) + '</b> 元';
|
||||
|
||||
$('#stack').innerHTML = mids.map(function (m, i) {
|
||||
return '<i style="flex-grow:' + (m / all * 1000).toFixed(0) + ';background:' + (i < n ? SHADES[i] : '#E5E8EC') + '"></i>';
|
||||
}).join('');
|
||||
|
||||
var open = {};
|
||||
[].forEach.call(document.querySelectorAll('#list details'), function (d, i) { if (d.open) open[i] = 1; });
|
||||
$('#list').innerHTML = parts.map(function (p, i) {
|
||||
var on = i < n;
|
||||
return '<details' + (on ? '' : ' class="off"') + (open[i] ? ' open' : '') + '><summary><span class="dot" style="background:' + (on ? SHADES[i] : '#E5E8EC') + '"></span>' +
|
||||
'<span class="nm">' + STAGES[i] + '</span><span class="rg">' + (on ? rng(p) : '未计入') + '</span>' +
|
||||
'<svg class="ic ar"><use href="#i-down" xlink:href="#i-down"/></svg></summary><div class="ds">' + detail(i) + '</div></details>';
|
||||
}).join('');
|
||||
|
||||
var big = 0;
|
||||
for (var i = 1; i < n; i++) if (mids[i] > mids[big]) big = i;
|
||||
$('#bigT').innerHTML = '最花钱的是<em>' + STAGES[big] + '</em>';
|
||||
var why = [
|
||||
st.hosp ? '特需和私立的产检套餐偏贵' : '主要是产检和筛查',
|
||||
st.hosp ? '贵在病房和服务升级' : '主要是接生、手术和住院',
|
||||
['主要是月子餐和产妇用品', '主要是月嫂工资', '主要是月子中心套餐'][st.yz],
|
||||
st.feed ? '奶粉和纸尿裤每月都要买' : '主要是用品、纸尿裤和看病',
|
||||
['主要是日常吃用和老人补贴', '主要是育儿嫂工资', '主要是托育园月费'][st.care]
|
||||
][Math.min(big, 4)];
|
||||
$('#bigD').textContent = '约 ' + rng(parts[big]) + ',' + why + '。';
|
||||
$('#save').textContent = saveTip(big);
|
||||
}
|
||||
|
||||
$('#tabs').addEventListener('click', function (e) {
|
||||
var b = e.target.closest('button'); if (!b) return;
|
||||
stage = +b.dataset.s; save(); renderRes();
|
||||
});
|
||||
$('#chips').addEventListener('click', function (e) {
|
||||
var b = e.target.closest('button'); if (!b) return;
|
||||
qi = +b.dataset.q; editing = true; renderQ();
|
||||
});
|
||||
|
||||
function save() {
|
||||
try { var o = {}; QS.forEach(function (q) { o[q.k] = st[q.k]; }); o.stage = stage; localStorage.setItem(KEY, JSON.stringify(o)); } catch (e) {}
|
||||
}
|
||||
function load() {
|
||||
try {
|
||||
var o = JSON.parse(localStorage.getItem(KEY) || 'null'); if (!o) return false;
|
||||
var ok = QS.every(function (q) { return o[q.k] >= 0 && o[q.k] < q.o.length; });
|
||||
if (!ok) return false;
|
||||
QS.forEach(function (q) { st[q.k] = o[q.k]; });
|
||||
if (o.stage >= 0 && o.stage < 4) stage = o.stage;
|
||||
st._done = true; return true;
|
||||
} catch (e) { return false; }
|
||||
}
|
||||
|
||||
if (load()) { renderRes(); show('sRes'); } else show('sStart');
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
sc.addEventListener('scroll', function () { $('#bar').classList.toggle('on', sc.scrollTop > 4); }, { passive: true });
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
topic/wen/img/clinic.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
topic/wen/img/fiber.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
topic/wen/img/food.webp
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
topic/wen/img/hero.webp
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
topic/wen/img/lotion.webp
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
topic/wen/img/myth.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
topic/wen/img/redgel.webp
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
topic/wen/img/slow.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
topic/wen/img/snap.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
topic/wen/img/stretch.webp
Normal file
|
After Width: | Height: | Size: 16 KiB |
302
topic/wen/index.html
Normal file
@@ -0,0 +1,302 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>妊娠纹,与体重管理</title>
|
||||
<!-- 孕期专题 · 妊娠纹与体重管理(孕期首页「其他妈妈也在搜」第 6 条)。
|
||||
2026-10-31 v2 按 /tmp/pl/topic-spec.md 统一规范重做:清新、简洁、核心明确;主色 #F25C78。
|
||||
体重管理是核心之一(第 1 节 + 增重简表 + #goWeight 跳 /yunqi-tizhong/);
|
||||
「为什么这样做」本页例外:可见的一句话(≤30 字)。只写成分和品类、不点名品牌;百分比只出现在页底「参考来源」。
|
||||
自成一页:不引 app.js;回首页走相对路径 ../../,站内跳转带 location.search + location.hash。
|
||||
旧版备份 /tmp/pl/wen-v2-backup.html。 -->
|
||||
<style>
|
||||
:root{--c:#F25C78;--cs:#FFEFF2;--ink:#1F2329;--tx:#4E5969;--sub:#86909C;--line:#EEF0F3;--sec:#F7F8FA;
|
||||
--green:#18A058;--gbg:#EAF7F0;--amber:#E08A1E;--abg:#FFF4E5;--red:#E5484D;--rbg:#FFEDEE}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--tx);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
b,strong{color:var(--ink)}
|
||||
.ic{width:20px;height:20px;flex:none;fill:none;stroke:var(--c);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.hide{position:absolute;width:0;height:0;overflow:hidden}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;padding-top:env(safe-area-inset-top);background:rgba(255,255,255,0);border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
|
||||
.bar.solid{background:#fff;border-bottom-color:var(--line)}
|
||||
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center}
|
||||
.bar .back .ic{width:22px;height:22px;stroke:var(--ink)}
|
||||
.bar .t{font-size:16px;font-weight:600;color:var(--ink)}
|
||||
|
||||
.wrap{padding:0 20px}
|
||||
|
||||
/* Hero */
|
||||
.hero img{width:100%;height:190px;object-fit:cover;object-position:50% 40%;border-radius:20px;background:var(--cs)}
|
||||
h1{margin-top:18px;font-size:26px;font-weight:800;line-height:1.3;color:var(--ink)}
|
||||
.ans{margin-top:12px;padding:12px 14px;border-radius:14px;background:var(--cs);border-left:4px solid var(--c);font-size:16px;font-weight:700;line-height:1.6;color:var(--ink)}
|
||||
|
||||
/* 个性化提示条 */
|
||||
.me{display:none;margin-top:14px;align-items:center;gap:10px;padding:10px 12px;border-radius:14px;border:1px solid var(--line);font-size:13.5px;line-height:1.5}
|
||||
.me.on{display:flex}
|
||||
.me .mt{flex:1;min-width:0}
|
||||
.me b{display:block;font-size:14px}
|
||||
.me span{color:var(--sub);font-size:12.5px}
|
||||
.me .go{flex:none;height:30px;padding:0 12px;border-radius:99px;border:1px solid var(--c);color:var(--c);font-size:13px;white-space:nowrap}
|
||||
|
||||
/* 记住这 3 点 */
|
||||
.pts{margin-top:28px}
|
||||
h2{font-size:18px;font-weight:700;line-height:1.4;color:var(--ink)}
|
||||
.pts ol{list-style:none;margin-top:8px}
|
||||
.pts li{display:flex;gap:14px;padding:12px 0;border-top:1px solid var(--line)}
|
||||
.pts li:first-child{border-top:0}
|
||||
.pts .no{flex:none;width:26px;font-size:26px;font-weight:800;line-height:1.1;color:var(--c);font-family:"DIN Alternate","Helvetica Neue",Arial,sans-serif}
|
||||
.pts b{display:block;font-size:15.5px;line-height:1.5}
|
||||
.pts span{display:block;font-size:13px;color:var(--sub);line-height:1.5}
|
||||
|
||||
/* 目录 */
|
||||
.toc{display:flex;gap:8px;margin-top:16px}
|
||||
.toc button{flex:1;min-width:0;height:36px;border-radius:99px;background:var(--sec);font-size:13px;color:var(--tx);white-space:nowrap}
|
||||
|
||||
/* 节 */
|
||||
.sec{margin-top:36px;scroll-margin-top:56px}
|
||||
.sec-h{display:flex;align-items:center;gap:8px}
|
||||
.sec-h .n{flex:none;font-size:18px;font-weight:800;color:var(--c);font-family:"DIN Alternate","Helvetica Neue",Arial,sans-serif}
|
||||
.key{margin-top:6px;font-weight:700;color:var(--c)}
|
||||
.card{margin-top:14px;border:1px solid var(--line);border-radius:18px;background:#fff;overflow:hidden}
|
||||
|
||||
/* 1 体重 */
|
||||
.wpic{width:100%;height:120px;object-fit:cover;object-position:60% 55%}
|
||||
table{width:100%;border-collapse:collapse;font-size:14px}
|
||||
th{font-size:12.5px;font-weight:500;color:var(--sub);text-align:left;padding:10px 14px 6px}
|
||||
td{padding:9px 14px;border-top:1px solid var(--line);color:var(--tx);white-space:nowrap}
|
||||
td:first-child b{font-weight:600}
|
||||
td small{display:block;font-size:12px;color:var(--sub);line-height:1.3}
|
||||
td.v{font-weight:700;color:var(--ink)}
|
||||
.note{padding:8px 14px 12px;font-size:12.5px;color:var(--sub);line-height:1.6}
|
||||
.btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:46px;margin-top:14px;border-radius:99px;background:var(--c);color:#fff;font-size:15px;font-weight:600}
|
||||
.btn .ic{stroke:#fff}
|
||||
|
||||
/* 2 时间轴 */
|
||||
.tl{margin-top:16px;position:relative;padding-left:22px}
|
||||
.tl::before{content:"";position:absolute;left:6px;top:10px;bottom:10px;width:2px;background:var(--line)}
|
||||
.st{position:relative;padding:14px 14px 12px;margin-top:10px;border:1px solid var(--line);border-radius:18px;background:#fff;scroll-margin-top:60px;transition:border-color .3s,background .3s}
|
||||
.st:first-child{margin-top:0}
|
||||
.st::before{content:"";position:absolute;left:-22px;top:20px;width:14px;height:14px;border-radius:50%;background:#fff;border:2px solid #D5D9E0}
|
||||
.st.hl{border-color:var(--c);background:var(--cs)}
|
||||
.st.hl::before{border-color:var(--c);background:var(--c)}
|
||||
.st .hd{display:flex;align-items:center;gap:8px}
|
||||
.st .hd b{font-size:15.5px}
|
||||
.st .now{display:none;margin-left:auto;font-size:12px;line-height:20px;padding:0 8px;border-radius:99px;background:var(--c);color:#fff;white-space:nowrap}
|
||||
.st.hl .now{display:inline-block}
|
||||
.st p{margin-top:4px;font-size:14.5px;line-height:1.7}
|
||||
.st .why{margin-top:6px;font-size:12.5px;line-height:1.6;color:var(--sub)}
|
||||
.st .why em{font-style:normal;color:var(--c);margin-right:4px}
|
||||
|
||||
/* 3 成分速查 */
|
||||
.ing{display:flex;gap:12px;align-items:flex-start;padding:13px 14px;border-top:1px solid var(--line)}
|
||||
.ing:first-child{border-top:0}
|
||||
.ing .lt{flex:none;margin-top:3px;width:52px;text-align:center;font-size:12px;font-weight:700;line-height:22px;border-radius:99px;white-space:nowrap}
|
||||
.ing .r{background:var(--rbg);color:var(--red)}
|
||||
.ing .g{background:var(--gbg);color:var(--green)}
|
||||
.ing .a{background:var(--abg);color:var(--amber)}
|
||||
.ing b{display:block;font-size:15px;line-height:1.5}
|
||||
.ing span{display:block;font-size:13px;color:var(--sub);line-height:1.55}
|
||||
|
||||
/* 来源 + 免责 */
|
||||
.src{margin-top:36px;border-radius:18px;background:var(--sec)}
|
||||
.src summary{list-style:none;display:flex;align-items:center;gap:8px;padding:13px 16px;font-size:14px;font-weight:600;color:var(--ink)}
|
||||
.src summary::-webkit-details-marker{display:none}
|
||||
.src summary::after{content:"展开";margin-left:auto;font-size:12.5px;font-weight:400;color:var(--sub)}
|
||||
.src[open] summary::after{content:"收起"}
|
||||
.src ul{list-style:none;padding:0 16px 12px}
|
||||
.src li{padding:8px 0;border-top:1px solid #E9ECF0;font-size:12.5px;line-height:1.65;color:var(--tx)}
|
||||
.foot{margin-top:14px;font-size:12px;line-height:1.7;color:var(--sub);text-align:center}
|
||||
|
||||
.fade{opacity:0;transform:translateY(8px);transition:opacity .4s,transform .4s}
|
||||
.fade.in{opacity:1;transform:none}
|
||||
@media (prefers-reduced-motion:reduce){.fade{opacity:1;transform:none;transition:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标:stroke 1.8,颜色走 .ic(主色) -->
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-scale" viewBox="0 0 24 24"><rect x="3.5" y="4" width="17" height="16" rx="4"/><path d="M8 11a4 4 0 0 1 8 0M12 11l2-2.2"/></symbol>
|
||||
<symbol id="i-arrow" viewBox="0 0 24 24"><path d="M5 12h13M13 6.5l5.5 5.5-5.5 5.5"/></symbol>
|
||||
<symbol id="i-book" viewBox="0 0 24 24"><path d="M5 19.5v-15A1.5 1.5 0 0 1 6.5 3H19v15H6.5A1.5 1.5 0 0 0 5 19.5 1.5 1.5 0 0 0 6.5 21H19M9 7.5h6"/></symbol>
|
||||
<symbol id="i-mom" viewBox="0 0 24 24"><circle cx="11" cy="4.5" r="2"/><path d="M10 8.5c-1.5 1.5-2 3.5-2 6V21M12 9c4 .5 8 2.5 8 5.5s-2.5 4.5-6 4.5h-2M12 21v-2"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<main class="wrap">
|
||||
<section class="hero">
|
||||
<img src="img/hero.webp" alt="孕妈坐在沙发上轻抚孕肚">
|
||||
<h1>妊娠纹,与体重管理</h1>
|
||||
<div class="ans">控制体重慢慢长、每天抹两次打底,红纹一出现就处理。</div>
|
||||
</section>
|
||||
|
||||
<!-- 按 openid 读孕周 / 产后状态点亮对应阶段(拿不到身份就不显示) -->
|
||||
<div class="me" id="me">
|
||||
<svg class="ic"><use href="#i-mom" xlink:href="#i-mom"/></svg>
|
||||
<div class="mt"><b id="meT"></b><span id="meD"></span></div>
|
||||
<button class="go" id="meGo">去看看</button>
|
||||
</div>
|
||||
|
||||
<section class="pts">
|
||||
<h2>记住这 3 点</h2>
|
||||
<ol>
|
||||
<li><span class="no">1</span><div><b>每周增重不超过 0.5kg</b><span>孕中晚期起,长得慢纹就少</span></div></li>
|
||||
<li><span class="no">2</span><div><b>早晚各抹一次</b><span>从孕早期开始,坚持整个孕期</span></div></li>
|
||||
<li><span class="no">3</span><div><b>维 A 酸类孕期禁用</b><span>含视黄醇、视黄醛的也别用</span></div></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<nav class="toc">
|
||||
<button data-go="s1">体重和妊娠纹</button>
|
||||
<button data-go="s2">不同阶段</button>
|
||||
<button data-go="s3">成分速查</button>
|
||||
</nav>
|
||||
|
||||
<!-- 1 体重 -->
|
||||
<section class="sec" id="s1">
|
||||
<div class="sec-h"><span class="n">01</span><h2>体重和妊娠纹</h2></div>
|
||||
<p class="key">肚皮撑得越快越容易长纹,控体重是最省钱的预防。</p>
|
||||
<div class="card fade">
|
||||
<img class="wpic" src="img/slow.webp" alt="孕妈牵着背体重秤的小乌龟散步" loading="lazy">
|
||||
<table>
|
||||
<thead><tr><th>孕前体重</th><th>整个孕期</th><th>孕中晚期每周</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><b>偏瘦</b><small>BMI < 18.5</small></td><td class="v">11~16 kg</td><td>约 0.46 kg</td></tr>
|
||||
<tr><td><b>正常</b><small>BMI 18.5~23.9</small></td><td class="v">8~14 kg</td><td>约 0.37 kg</td></tr>
|
||||
<tr><td><b>偏胖</b><small>BMI ≥ 24</small></td><td class="v">5~11 kg</td><td>约 0.22~0.30 kg</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="note">BMI = 体重(kg) ÷ 身高(m)²。双胎或有并发症,以产检医生建议为准。</p>
|
||||
</div>
|
||||
<button class="btn" id="goWeight"><svg class="ic"><use href="#i-scale" xlink:href="#i-scale"/></svg>去算我的增重范围<svg class="ic"><use href="#i-arrow" xlink:href="#i-arrow"/></svg></button>
|
||||
</section>
|
||||
|
||||
<!-- 2 时间轴:当前阶段按孕周高亮 -->
|
||||
<section class="sec" id="s2">
|
||||
<div class="sec-h"><span class="n">02</span><h2>不同阶段怎么做</h2></div>
|
||||
<p class="key">早打底,红纹趁早处理,白纹留到产后。</p>
|
||||
<div class="tl">
|
||||
<article class="st fade" id="stA">
|
||||
<div class="hd"><b>孕早期起 · 预防</b><span class="now">你在这里</span></div>
|
||||
<p>洗澡后和睡前,肚皮、大腿、臀部抹保湿霜,按摩到吸收。<span id="stA2">饮食吃够蛋白质和维 C。</span></p>
|
||||
<div class="why"><em>为什么这样做</em>皮肤水润有弹性,纤维不易拉断。</div>
|
||||
</article>
|
||||
<article class="st fade" id="stB">
|
||||
<div class="hd"><b>冒出红纹 · 马上处理</b><span class="now">你在这里</span></div>
|
||||
<p>红纹处每天薄涂 2 次医用硅酮凝胶,至少坚持 2 个月。</p>
|
||||
<div class="why"><em>为什么这样做</em>红纹期还在修复,最容易变淡。</div>
|
||||
</article>
|
||||
<article class="st fade" id="stC">
|
||||
<div class="hd"><b>白纹 · 产后</b><span class="now">你在这里</span></div>
|
||||
<p>涂抹作用有限,产后去正规医院皮肤科,评估激光、微针等。</p>
|
||||
<div class="why"><em>为什么这样做</em>白纹已是疤,要靠刺激长新胶原。</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 3 成分速查 -->
|
||||
<section class="sec" id="s3">
|
||||
<div class="sec-h"><span class="n">03</span><h2>成分速查</h2></div>
|
||||
<p class="key">买之前翻成分表,红色的孕期别碰。</p>
|
||||
<div class="card fade">
|
||||
<div class="ing"><span class="lt r">禁用</span><div><b>维 A 酸 / 视黄醇 / 视黄醛</b><span>可能影响胎儿,孕期哺乳期都别用</span></div></div>
|
||||
<div class="ing"><span class="lt g">可用</span><div><b>透明质酸、神经酰胺、角鲨烷</b><span>补水修护,日常打底用</span></div></div>
|
||||
<div class="ing"><span class="lt g">可用</span><div><b>医用硅酮凝胶</b><span>成膜保湿,帮红纹变淡</span></div></div>
|
||||
<div class="ing"><span class="lt a">先问医生</span><div><b>积雪草类修护霜</b><span>抗炎促修复,用前问产检医生</span></div></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<details class="src">
|
||||
<summary><svg class="ic"><use href="#i-book" xlink:href="#i-book"/></svg>参考来源</summary>
|
||||
<ul>
|
||||
<li><b>增重范围:</b>中国营养学会《中国妇女妊娠期体重监测与评价》(T/CNSS 009-2021)及 WS/T 801-2022,按孕前 BMI 分档;偏胖档含超重 7~11kg、肥胖(BMI≥28)5~9kg。</li>
|
||||
<li><b>维 A 酸:</b>0.1% 维 A 酸涂早期红纹 6 个月,10 人中 8 人明显改善,对照组 12 人中 1 人(Arch Dermatol 1996,小样本)。孕期哺乳期禁用,产后不哺乳时遵医嘱使用。</li>
|
||||
<li><b>医用硅酮:</b>1522 人连用 2 个月以上,颜色、柔软度改善约 70%~85%(研究对象为疤痕,非专门针对妊娠纹,仅作参考)。</li>
|
||||
<li><b>透明质酸复方凝胶:</b>约 50 人连用 12 周,红纹深度和颜色明显减轻,但不会完全消失。</li>
|
||||
<li><b>点阵激光:</b>联合强脉冲光的 60 人研究中纹路面积平均缩小约 37%,约 25% 有不良反应。</li>
|
||||
<li><b>可可脂、橄榄油:</b>210 人随机对照研究,可可脂 45% 长纹、安慰剂 49%;70 人研究,橄榄油 45.7% 对 62.9%,均无统计学差异,润肤可以、防纹别指望。</li>
|
||||
</ul>
|
||||
</details>
|
||||
<p class="foot">本页为科普参考,不能代替医生诊断。孕期用药、护肤有疑问请咨询医生。</p>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
function hp(n) { var h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || ''); var m = h.match(new RegExp('(?:^|&)' + n + '=([^&]*)')); return m ? decodeURIComponent(m[1]) : ''; }
|
||||
var openid = hp('openid');
|
||||
var sc = $('#scroll'), bar = $('#bar');
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
/* 滚动后顶栏白底 + 细分割线 */
|
||||
sc.addEventListener('scroll', function () { bar.classList.toggle('solid', sc.scrollTop > 8); }, { passive: true });
|
||||
|
||||
function go(id) {
|
||||
var el = document.getElementById(id); if (!el) return;
|
||||
var top = el.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop - 56;
|
||||
sc.scrollTo({ top: top, behavior: 'smooth' });
|
||||
}
|
||||
[].forEach.call(document.querySelectorAll('[data-go]'), function (b) { b.addEventListener('click', function () { go(b.dataset.go); }); });
|
||||
|
||||
/* 体重管理:同源相对路径,带身份 */
|
||||
$('#goWeight').addEventListener('click', function () { location.href = '/yunqi-tizhong/' + location.search + location.hash; });
|
||||
|
||||
/* 按孕周点亮阶段(stA 预防 / stA2 饮食并在 stA 内 / stB 红纹 / stC 白纹产后) */
|
||||
function mark(stage, t, d) {
|
||||
var id = stage === 'stA2' ? 'stA' : stage;
|
||||
var el = document.getElementById(id); if (el) el.classList.add('hl');
|
||||
$('#meT').textContent = t; $('#meD').textContent = d;
|
||||
$('#meGo').onclick = function () { go(id); };
|
||||
$('#me').classList.add('on');
|
||||
}
|
||||
if (openid) {
|
||||
fetch('/api/mp/public/mama-box/pregnancy?openid=' + encodeURIComponent(openid))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (j) {
|
||||
var p = j && j.code === 200 && j.result; if (!p) return;
|
||||
if (p.postpartum) mark('stB', '宝宝出生了,重点看修复', '红纹趁早处理,白纹找皮肤科');
|
||||
else if (p.week != null && !p.empty) {
|
||||
var w = p.week;
|
||||
if (w >= 20) mark('stA', '孕 ' + w + ' 周 · 肚子长得最快', '坚持打底,留意有没有冒红纹');
|
||||
else mark('stA', '孕 ' + w + ' 周 · 正是打底好时候', '现在开始抹,比长了再补管用');
|
||||
}
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
/* 进场动画(轻) */
|
||||
if ('IntersectionObserver' in window) {
|
||||
var io = new IntersectionObserver(function (es) { es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { root: sc, threshold: .1 });
|
||||
[].forEach.call(document.querySelectorAll('.fade'), function (el) { io.observe(el); });
|
||||
} else [].forEach.call(document.querySelectorAll('.fade'), function (el) { el.classList.add('in'); });
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
topic/yingyang/img/early.webp
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
topic/yingyang/img/foods.webp
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
topic/yingyang/img/hero.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
topic/yingyang/img/late.webp
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
topic/yingyang/img/love.webp
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
topic/yingyang/img/mid.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
topic/yingyang/img/myth.webp
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
topic/yingyang/img/nutri.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
264
topic/yingyang/index.html
Normal file
@@ -0,0 +1,264 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>孕期营养影响孩子智商吗?</title>
|
||||
<!-- 孕期专题 · 营养与智力(孕期首页「其他妈妈也在搜」第 3 条进入)。
|
||||
2026-10-31 按《孕期专题统一设计规范 v2》重做:清新、简洁、核心明确。主色 #F08A24。
|
||||
自成一页:不引 app.js;回首页走相对路径 ../../;体重工具 /yunqi-tizhong/ 同源 + 带身份。 -->
|
||||
<style>
|
||||
:root{--c:#F08A24;--cbg:#FFF3E6;--h:#1F2329;--t:#4E5969;--m:#86909C;--line:#EEF0F3;--soft:#F7F8FA}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--t);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
b,strong{color:var(--h)}
|
||||
.ic{width:21px;height:21px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;background:rgba(255,255,255,0);border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
|
||||
.bar.on{background:#fff;border-bottom-color:var(--line)}
|
||||
.bar .back{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;color:var(--h)}
|
||||
.bar .back .ic{width:22px;height:22px}
|
||||
.bar .t{font-weight:600;font-size:16px;color:var(--h)}
|
||||
|
||||
.wrap{padding:0 20px}
|
||||
|
||||
/* Hero */
|
||||
.hero img{width:100%;height:190px;object-fit:cover;border-radius:20px;background:var(--cbg)}
|
||||
h1{margin-top:20px;font-size:26px;font-weight:800;line-height:1.3;color:var(--h)}
|
||||
.ans{margin-top:14px;padding:14px 16px;border-radius:14px;background:var(--cbg);border-left:4px solid var(--c);font-size:16px;font-weight:700;line-height:1.65;color:var(--h)}
|
||||
|
||||
/* 孕周提示条 */
|
||||
.me{display:none;margin-top:12px;width:100%;align-items:center;gap:8px;padding:10px 14px;border-radius:14px;border:1px solid var(--line);font-size:13.5px;text-align:left;color:var(--t)}
|
||||
.me.on{display:flex}
|
||||
.me .ic{color:var(--c);width:20px;height:20px}
|
||||
.me b{color:var(--c);margin-right:4px}
|
||||
.me span{flex:1;min-width:0}
|
||||
|
||||
/* 记住这 3 点 */
|
||||
.three{margin-top:28px;padding:18px 18px 6px;border-radius:18px;border:1px solid var(--line)}
|
||||
.three h2{font-size:18px;font-weight:700;color:var(--h);margin-bottom:6px}
|
||||
.pt{display:flex;gap:14px;padding:10px 0 12px}
|
||||
.pt+.pt{border-top:1px solid var(--line)}
|
||||
.pt .n{flex:none;width:24px;font-size:26px;font-weight:800;line-height:1.1;color:var(--c);font-family:"DIN Alternate","Helvetica Neue",Arial,sans-serif}
|
||||
.pt b{display:block;font-size:16px;line-height:1.5}
|
||||
.pt small{display:block;font-size:12.5px;color:var(--m);line-height:1.6;margin-top:2px}
|
||||
|
||||
/* 节 */
|
||||
.sec{margin-top:36px}
|
||||
.sec h2{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:700;color:var(--h)}
|
||||
.sec h2 i{font-style:normal;font-size:13px;font-weight:700;color:var(--c);background:var(--cbg);border-radius:99px;width:22px;height:22px;display:grid;place-items:center}
|
||||
.key{margin-top:6px;font-weight:700;color:var(--c)}
|
||||
.items{margin-top:12px;border-radius:18px;border:1px solid var(--line);padding:2px 16px}
|
||||
.it{display:flex;gap:12px;padding:13px 0}
|
||||
.it+.it{border-top:1px solid var(--line)}
|
||||
.it .ib{flex:none;width:36px;height:36px;border-radius:12px;background:var(--cbg);color:var(--c);display:grid;place-items:center}
|
||||
.it p{flex:1;min-width:0;line-height:1.65}
|
||||
.it p b{margin-right:6px}
|
||||
.more{margin-top:10px;font-size:13.5px;color:var(--m);padding-left:2px}
|
||||
.more b{color:var(--t);font-weight:600}
|
||||
.pic{margin-top:14px}
|
||||
.pic img{width:100%;height:120px;object-fit:cover;border-radius:18px}
|
||||
|
||||
/* 阶段表 */
|
||||
.tbl{margin-top:12px;border-radius:18px;border:1px solid var(--line);overflow:hidden}
|
||||
.tr{display:grid;grid-template-columns:76px 70px 1fr;gap:8px;align-items:center;padding:12px 14px;font-size:14px;line-height:1.55}
|
||||
.tr+.tr{border-top:1px solid var(--line)}
|
||||
.tr.hd{background:var(--soft);font-size:12.5px;color:var(--m);padding:8px 14px}
|
||||
.tr .s b{display:block;font-size:15px}
|
||||
.tr .s small{font-size:12px;color:var(--m)}
|
||||
.tr .f{font-weight:700;color:var(--c)}
|
||||
.tr.hl{background:var(--cbg);box-shadow:inset 3px 0 0 var(--c)}
|
||||
|
||||
/* 误区 */
|
||||
.my{display:flex;gap:12px;padding:13px 0}
|
||||
.my+.my{border-top:1px solid var(--line)}
|
||||
.my .x{flex:none;width:22px;height:22px;margin-top:2px;color:#C9CDD4}
|
||||
.my .q{display:block;font-size:14px;color:var(--m);text-decoration:line-through;text-decoration-color:#C9CDD4}
|
||||
.my p{line-height:1.65}
|
||||
|
||||
/* 体重卡 */
|
||||
.wt{margin-top:36px;padding:18px;border-radius:18px;background:var(--soft)}
|
||||
.wt .hd{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:700;color:var(--h)}
|
||||
.wt .hd .ic{color:var(--c)}
|
||||
.wt p{margin-top:6px;font-size:14px}
|
||||
.btn{margin-top:14px;width:100%;height:46px;border-radius:99px;background:var(--c);color:#fff;font-size:15.5px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:6px}
|
||||
.btn .ic{width:18px;height:18px}
|
||||
|
||||
/* 来源 + 免责 */
|
||||
.src{margin-top:32px;border-top:1px solid var(--line);padding-top:6px}
|
||||
.src summary{list-style:none;display:flex;align-items:center;gap:6px;padding:10px 0;font-size:13.5px;color:var(--m);cursor:pointer}
|
||||
.src summary::-webkit-details-marker{display:none}
|
||||
.src summary .ic{width:18px;height:18px}
|
||||
.src summary .ar{margin-left:auto;transition:transform .2s}
|
||||
.src[open] summary .ar{transform:rotate(180deg)}
|
||||
.src ul{padding:0 0 6px 18px;font-size:12.5px;line-height:1.7;color:var(--m)}
|
||||
.src li+li{margin-top:6px}
|
||||
.foot{margin-top:10px;font-size:12px;line-height:1.7;color:var(--m)}
|
||||
|
||||
/* 进场 */
|
||||
.fade{opacity:0;transform:translateY(8px);transition:opacity .45s ease,transform .45s ease}
|
||||
.fade.in{opacity:1;transform:none}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<svg width="0" height="0" style="position:absolute" aria-hidden="true">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-leaf" viewBox="0 0 24 24"><path d="M5 19c0-8 5-13 14-14 0 9-5 14-13 14z"/><path d="M5 19l8-8"/></symbol>
|
||||
<symbol id="i-salt" viewBox="0 0 24 24"><path d="M8 9h8l-1 11H9z"/><path d="M8.5 9l1-4.5h5l1 4.5"/><path d="M11 6.5h.01M13 6.5h.01"/></symbol>
|
||||
<symbol id="i-fish" viewBox="0 0 24 24"><path d="M3 12c3-4.5 8-6 12-3.5L20 6v12l-5-2.5C11 18 6 16.5 3 12z"/><path d="M8 11.5h.01"/></symbol>
|
||||
<symbol id="i-drop" viewBox="0 0 24 24"><path d="M12 3.5c3.5 4.5 6 7.8 6 10.5a6 6 0 0 1-12 0c0-2.7 2.5-6 6-10.5z"/></symbol>
|
||||
<symbol id="i-x" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9 9l6 6M15 9l-6 6"/></symbol>
|
||||
<symbol id="i-scale" viewBox="0 0 24 24"><rect x="3.5" y="3.5" width="17" height="17" rx="4"/><path d="M8 9.5a5.5 5.5 0 0 1 8 0M12 9.5l1.2-1.8"/></symbol>
|
||||
<symbol id="i-cal" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></symbol>
|
||||
<symbol id="i-arrow" viewBox="0 0 24 24"><path d="M5 12h13M13 6.5l5.5 5.5-5.5 5.5"/></symbol>
|
||||
<symbol id="i-book" viewBox="0 0 24 24"><path d="M4 5.5A1.5 1.5 0 0 1 5.5 4H11v16H5.5A1.5 1.5 0 0 1 4 18.5zM20 5.5A1.5 1.5 0 0 0 18.5 4H13v16h5.5a1.5 1.5 0 0 0 1.5-1.5z"/></symbol>
|
||||
<symbol id="i-down" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<main class="wrap">
|
||||
<section class="hero">
|
||||
<img src="img/hero.webp" alt="孕妈坐在餐桌前,桌上有鱼、青菜、鸡蛋和牛奶">
|
||||
<h1>孕期营养<br>影响孩子智商吗?</h1>
|
||||
<div class="ans">会影响大脑发育,但关键是别缺,没有吃了变聪明的食物。</div>
|
||||
<button class="me" id="me" type="button"><svg class="ic"><use href="#i-cal" xlink:href="#i-cal"/></svg><span><b id="meT"></b><em id="meD" style="font-style:normal"></em></span><svg class="ic" style="color:#C9CDD4;width:16px;height:16px"><use href="#i-arrow" xlink:href="#i-arrow"/></svg></button>
|
||||
</section>
|
||||
|
||||
<section class="three fade">
|
||||
<h2>记住这 3 点</h2>
|
||||
<div class="pt"><span class="n">1</span><div><b>叶酸每天 0.4mg</b><small>孕前 3 个月开始,至少吃到孕 3 个月</small></div></div>
|
||||
<div class="pt"><span class="n">2</span><div><b>炒菜用加碘盐</b><small>缺碘会影响宝宝大脑发育</small></div></div>
|
||||
<div class="pt"><span class="n">3</span><div><b>每周 2~3 次鱼</b><small>补 DHA,选刺少、汞低的鱼</small></div></div>
|
||||
</section>
|
||||
|
||||
<section class="sec fade" id="s1">
|
||||
<h2><i>1</i>大脑最需要的 4 种营养</h2>
|
||||
<p class="key">这 4 样别缺,比任何「补脑品」都管用。</p>
|
||||
<div class="items">
|
||||
<div class="it"><span class="ib"><svg class="ic"><use href="#i-leaf" xlink:href="#i-leaf"/></svg></span><p><b>叶酸</b>预防神经管缺陷。多吃绿叶菜,再加每天一片叶酸。</p></div>
|
||||
<div class="it"><span class="ib"><svg class="ic"><use href="#i-salt" xlink:href="#i-salt"/></svg></span><p><b>碘</b>帮宝宝大脑正常发育。用加碘盐,常吃海带、紫菜。</p></div>
|
||||
<div class="it"><span class="ib"><svg class="ic"><use href="#i-fish" xlink:href="#i-fish"/></svg></span><p><b>DHA</b>大脑和视力的原料。主要靠吃鱼,不爱吃鱼再问医生。</p></div>
|
||||
<div class="it"><span class="ib"><svg class="ic"><use href="#i-drop" xlink:href="#i-drop"/></svg></span><p><b>铁</b>缺铁贫血,宝宝供氧受影响。吃红肉、动物血,配蔬果。</p></div>
|
||||
</div>
|
||||
<p class="more"><b>另外:</b>蛋白质、胆碱、维生素 D,靠鸡蛋、奶、晒太阳。</p>
|
||||
<div class="pic"><img src="img/foods.webp" alt="鸡蛋、三文鱼、菠菜、紫菜、红肉、牛奶、豆腐" loading="lazy"></div>
|
||||
</section>
|
||||
|
||||
<section class="sec fade" id="s2">
|
||||
<h2><i>2</i>孕早中晚期各吃什么</h2>
|
||||
<p class="key">孕早期不用多吃,之后每天也只多一点。</p>
|
||||
<div class="tbl">
|
||||
<div class="tr hd"><span>阶段</span><span>重点</span><span>一句话</span></div>
|
||||
<div class="tr" id="stE"><span class="s"><b>孕早期</b><small>1~13 周</small></span><span class="f">叶酸</span><span>吃得下就好,不用加量</span></div>
|
||||
<div class="tr" id="stM"><span class="s"><b>孕中期</b><small>14~27 周</small></span><span class="f">奶、肉蛋</span><span>每天多一杯奶、一份肉蛋</span></div>
|
||||
<div class="tr" id="stL"><span class="s"><b>孕晚期</b><small>28 周起</small></span><span class="f">铁、DHA</span><span>多吃红肉和鱼,管住体重</span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="sec fade" id="s3">
|
||||
<h2><i>3</i>3 个误区</h2>
|
||||
<p class="key">「补脑」食物和贵价补剂,替代不了均衡饮食。</p>
|
||||
<div class="items">
|
||||
<div class="my"><svg class="ic x"><use href="#i-x" xlink:href="#i-x"/></svg><div><span class="q">多吃核桃,宝宝更聪明</span><p>形似大脑不等于补脑,一天一小把。</p></div></div>
|
||||
<div class="my"><svg class="ic x"><use href="#i-x" xlink:href="#i-x"/></svg><div><span class="q">补剂越贵越好</span><p>看成分含量,几种同吃易超量。</p></div></div>
|
||||
<div class="my"><svg class="ic x"><use href="#i-x" xlink:href="#i-x"/></svg><div><span class="q">一人吃,两人补</span><p>孕中晚期每天只多一杯奶、一个蛋的量。</p></div></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="wt fade">
|
||||
<div class="hd"><svg class="ic"><use href="#i-scale" xlink:href="#i-scale"/></svg>体重长得合理,宝宝才长得好</div>
|
||||
<p>孕前偏瘦、正常、偏胖,该长的不一样。每周固定时间称一次。</p>
|
||||
<button class="btn" id="goWeight" type="button">算算我的增重范围<svg class="ic"><use href="#i-arrow" xlink:href="#i-arrow"/></svg></button>
|
||||
</section>
|
||||
|
||||
<details class="src">
|
||||
<summary><svg class="ic"><use href="#i-book" xlink:href="#i-book"/></svg>参考来源<svg class="ic ar"><use href="#i-down" xlink:href="#i-down"/></svg></summary>
|
||||
<ul>
|
||||
<li>《中国居民膳食指南(2022)》孕期妇女膳食指南:全程补充叶酸、选用碘盐、常吃含铁食物,每周 2~3 次鱼,孕中期起适量增加奶和鱼禽蛋肉,维持适宜增重。</li>
|
||||
<li>《中国居民膳食营养素参考摄入量(2023 版)》(中国营养学会):孕期碘、铁、维生素 D、蛋白质、胆碱的推荐量。</li>
|
||||
<li>《围受孕期增补叶酸预防神经管缺陷指南(2017)》:无高危因素者孕前 3 个月起每天增补 0.4mg 叶酸,至孕满 3 个月。</li>
|
||||
<li>《中国孕产妇及婴幼儿补充 DHA 的专家共识》:可通过每周 2~3 次鱼类获得 DHA。</li>
|
||||
<li>WHO recommendations on antenatal care for a positive pregnancy experience(2016):孕期补充铁和叶酸,强调健康饮食与适宜增重。</li>
|
||||
<li>WHO:孕期严重缺碘是可预防的儿童智力损伤的重要原因。</li>
|
||||
</ul>
|
||||
</details>
|
||||
<p class="foot">本页为科普参考,不能代替医生诊断。是否需要补充剂、补多少,请咨询产检医生。</p>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
function hp(n) { var h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || ''); var m = h.match(new RegExp('(?:^|&)' + n + '=([^&]*)')); return m ? decodeURIComponent(m[1]) : ''; }
|
||||
var openid = hp('openid');
|
||||
var sc = $('#scroll');
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
/* 滚动后顶栏变白底 + 细分割线 */
|
||||
var bar = $('#bar');
|
||||
sc.addEventListener('scroll', function () { bar.classList.toggle('on', sc.scrollTop > 8); }, { passive: true });
|
||||
|
||||
function go(id) {
|
||||
var el = document.getElementById(id); if (!el) return;
|
||||
var top = el.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop - 60;
|
||||
sc.scrollTo({ top: top, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
/* 体重管理:同源相对路径,带身份 */
|
||||
$('#goWeight').addEventListener('click', function () { location.href = '/yunqi-tizhong/' + location.search + location.hash; });
|
||||
|
||||
/* 按孕周点亮阶段表对应行 + 一条小提示 */
|
||||
function mark(row, t, d) {
|
||||
var el = document.getElementById(row); if (el) el.classList.add('hl');
|
||||
$('#meT').textContent = t; $('#meD').textContent = d;
|
||||
$('#me').onclick = function () { go('s2'); };
|
||||
$('#me').classList.add('on');
|
||||
}
|
||||
if (openid) {
|
||||
fetch('/api/mp/public/mama-box/pregnancy?openid=' + encodeURIComponent(openid))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (j) {
|
||||
var p = j && j.code === 200 && j.result; if (!p || p.postpartum) return;
|
||||
if (p.week != null && !p.empty) {
|
||||
var w = p.week;
|
||||
if (w < 14) mark('stE', '孕 ' + w + ' 周', '叶酸别断,吃得下就好');
|
||||
else if (w < 28) mark('stM', '孕 ' + w + ' 周', '每天多一杯奶、一份肉蛋');
|
||||
else mark('stL', '孕 ' + w + ' 周', '补铁、吃鱼,管住体重');
|
||||
}
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
/* 进场动画(轻) */
|
||||
if ('IntersectionObserver' in window) {
|
||||
var io = new IntersectionObserver(function (es) { es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { root: sc, threshold: .1 });
|
||||
[].forEach.call(document.querySelectorAll('.fade'), function (el) { io.observe(el); });
|
||||
} else [].forEach.call(document.querySelectorAll('.fade'), function (el) { el.classList.add('in'); });
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
topic/zhichang/img/back.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
topic/zhichang/img/hero.webp
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
topic/zhichang/img/leave.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
topic/zhichang/img/preg.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
topic/zhichang/img/rights.webp
Normal file
|
After Width: | Height: | Size: 28 KiB |
398
topic/zhichang/index.html
Normal file
@@ -0,0 +1,398 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>孕妈产后复工 · 职场维权指南</title>
|
||||
<!-- 孕期专题 · 职场维权(孕期首页「其他妈妈也在搜」第 5 条)。
|
||||
2026-10-31 按《孕期专题页统一设计规范 v2》重做:清新、简洁、核心明确;主色 #5B6CFF。
|
||||
只写全国通用法条(《女职工劳动保护特别规定》《劳动合同法》《妇女权益保障法》《社会保险法》《劳动争议调解仲裁法》),
|
||||
地方差异一律写「以当地规定为准」。自成一页:不引 app.js;返回兜底走相对路径 ../../ 并带回 search + hash。 -->
|
||||
<style>
|
||||
:root{--c:#5B6CFF;--cbg:#EEF0FF;--h:#1F2329;--t:#4E5969;--m:#86909C;--line:#EEF0F3;--sec:#F7F8FA}
|
||||
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%;overflow:hidden;background:#fff;color:var(--t);font:15px/1.75 -apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif}
|
||||
#scroll{position:fixed;inset:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:none;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
|
||||
img{display:block;max-width:100%}
|
||||
button,input{font:inherit;border:0;background:none;color:inherit}
|
||||
button{cursor:pointer}
|
||||
b{color:var(--h)}
|
||||
.ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
|
||||
.hide{position:absolute;width:0;height:0;overflow:hidden}
|
||||
|
||||
/* 顶栏 */
|
||||
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:4px;height:48px;padding:0 8px;padding-top:env(safe-area-inset-top);background:rgba(255,255,255,0);border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
|
||||
.bar.on{background:#fff;border-bottom-color:var(--line)}
|
||||
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--h)}
|
||||
.bar .back .ic{width:22px;height:22px}
|
||||
.bar .t{font-weight:600;font-size:16px;color:var(--h)}
|
||||
|
||||
.wrap{padding:0 20px}
|
||||
/* Hero */
|
||||
.hero img{width:100%;height:190px;object-fit:cover;object-position:center 30%;border-radius:20px;margin-top:4px}
|
||||
h1{margin-top:18px;font-size:26px;font-weight:800;line-height:1.3;color:var(--h)}
|
||||
.ans{margin-top:12px;padding:12px 14px;border-radius:14px;background:var(--cbg);border-left:4px solid var(--c);font-size:16px;font-weight:700;line-height:1.6;color:var(--h)}
|
||||
|
||||
/* 个性化提示条 */
|
||||
.me{display:none;margin-top:12px;align-items:center;gap:8px;padding:9px 12px;border-radius:12px;background:var(--sec);font-size:13px;line-height:1.5;color:var(--t)}
|
||||
.me.on{display:flex}
|
||||
.me .ic{color:var(--c);width:18px;height:18px}
|
||||
.me span{flex:1;min-width:0}
|
||||
.me button{flex:none;font-size:13px;color:var(--c);font-weight:600}
|
||||
|
||||
/* 记住这 3 点 */
|
||||
.key{margin-top:28px}
|
||||
h2{font-size:18px;font-weight:700;line-height:1.4;color:var(--h)}
|
||||
.key ol{list-style:none;margin-top:6px}
|
||||
.key li{display:flex;gap:14px;align-items:flex-start;padding:12px 0;border-bottom:1px solid var(--line)}
|
||||
.key li:last-child{border-bottom:0}
|
||||
.key .no{flex:none;width:26px;font-size:28px;line-height:1.1;font-weight:800;color:var(--c);font-family:Georgia,"Times New Roman",serif}
|
||||
.key b{display:block;font-size:16px;line-height:1.45}
|
||||
.key span{display:block;font-size:13px;color:var(--m);line-height:1.5;margin-top:1px}
|
||||
|
||||
/* 分节 */
|
||||
.sec{margin-top:28px;padding:24px 20px;background:var(--sec);scroll-margin-top:48px}
|
||||
.sec.w{background:#fff}
|
||||
.sec+.sec{margin-top:0}
|
||||
.lead{margin-top:4px;font-size:15px;font-weight:700;color:var(--c);line-height:1.6}
|
||||
|
||||
/* 三阶段卡 */
|
||||
.stg{margin-top:12px;padding:14px 16px;border-radius:18px;background:#fff;border:1px solid var(--line);transition:border-color .3s,box-shadow .3s}
|
||||
.stg.hl{border-color:var(--c);box-shadow:0 0 0 3px rgba(91,108,255,.12)}
|
||||
.stg .hd{display:flex;align-items:center;gap:8px}
|
||||
.stg .hd .ic{color:var(--c);width:22px;height:22px}
|
||||
.stg .hd b{font-size:16px}
|
||||
.stg .hd small{margin-left:auto;font-size:12.5px;color:var(--m)}
|
||||
.stg .hd .now{display:none;margin-left:6px;font-size:11.5px;color:#fff;background:var(--c);border-radius:99px;padding:0 8px;line-height:20px}
|
||||
.stg.hl .hd .now{display:inline-block}
|
||||
.stg ul{list-style:none;margin-top:6px}
|
||||
.stg li{position:relative;padding-left:14px;font-size:14.5px;line-height:1.7}
|
||||
.stg li::before{content:"";position:absolute;left:2px;top:.72em;width:5px;height:5px;border-radius:50%;background:var(--c);opacity:.55}
|
||||
.stg li b{font-weight:600}
|
||||
|
||||
/* 折叠 */
|
||||
details.fold{margin-top:12px;border-radius:14px;background:#fff;border:1px solid var(--line)}
|
||||
details.fold summary{list-style:none;display:flex;align-items:center;gap:8px;padding:11px 14px;font-size:14px;font-weight:600;color:var(--h)}
|
||||
details.fold summary::-webkit-details-marker{display:none}
|
||||
details.fold summary .ic{width:18px;height:18px;color:var(--c)}
|
||||
details.fold summary::after{content:"展开";margin-left:auto;font-size:12.5px;font-weight:400;color:var(--m)}
|
||||
details.fold[open] summary::after{content:"收起"}
|
||||
details.fold .bd{padding:0 14px 12px;font-size:13.5px;line-height:1.7}
|
||||
details.fold .bd p+p{margin-top:6px}
|
||||
|
||||
/* 计算器 */
|
||||
.calc{margin-top:12px;padding:16px;border-radius:18px;background:#fff;border:1px solid var(--line)}
|
||||
.fld+.fld{margin-top:14px}
|
||||
.lb{display:block;font-size:13.5px;font-weight:600;color:var(--h)}
|
||||
.hint{display:block;margin-top:4px;font-size:12.5px;color:var(--m);line-height:1.5}
|
||||
.inp{margin-top:6px;display:block;width:100%;height:44px;padding:0 14px;border-radius:12px;background:var(--sec);border:1px solid var(--line);font-size:15px;color:var(--h);-webkit-appearance:none;appearance:none}
|
||||
.inp:focus{outline:none;border-color:var(--c)}
|
||||
.seg{margin-top:6px;display:flex;gap:4px;padding:3px;border-radius:12px;background:var(--sec)}
|
||||
.seg button{flex:1;min-width:0;height:36px;border-radius:10px;font-size:14px;color:var(--t);white-space:nowrap}
|
||||
.seg button.on{background:#fff;color:var(--c);font-weight:700;box-shadow:0 1px 4px rgba(0,0,0,.08)}
|
||||
.stp{margin-top:6px;display:flex;align-items:center;gap:8px}
|
||||
.stp button{flex:none;width:44px;height:44px;border-radius:12px;border:1px solid var(--c);color:var(--c);font-size:20px;font-weight:600;display:grid;place-items:center}
|
||||
.stp .inp{margin-top:0;flex:1;min-width:0;text-align:center;font-weight:700}
|
||||
.stp em{flex:none;font-style:normal;font-size:14px;color:var(--t)}
|
||||
.res{margin-top:16px;padding:14px;border-radius:14px;background:var(--cbg)}
|
||||
.res .empty{font-size:14px;color:var(--t);text-align:center}
|
||||
.res .tot{display:flex;align-items:baseline;gap:6px;color:var(--c)}
|
||||
.res .tot em{font-style:normal;font-size:36px;line-height:1.1;font-weight:800}
|
||||
.res .tot span{font-size:15px;font-weight:700}
|
||||
.res .tot small{margin-left:auto;font-size:12.5px;color:var(--m)}
|
||||
.res .dt{margin-top:10px;display:grid;grid-template-columns:1fr 1fr;gap:8px}
|
||||
.res .dt div{padding:8px 10px;border-radius:12px;background:#fff;line-height:1.35}
|
||||
.res .dt small{display:block;font-size:12.5px;color:var(--m)}
|
||||
.res .dt b{display:block;margin-top:2px;font-size:15px;white-space:nowrap}
|
||||
.res .note{margin-top:8px;font-size:12.5px;color:var(--m);line-height:1.5}
|
||||
|
||||
/* 维权四步 */
|
||||
.flow{list-style:none;margin-top:16px;display:grid;grid-template-columns:repeat(4,1fr);gap:4px;position:relative}
|
||||
.flow::before{content:"";position:absolute;left:12.5%;right:12.5%;top:15px;height:2px;background:#D5DAFF}
|
||||
.flow li{position:relative;text-align:center}
|
||||
.flow .n{display:grid;place-items:center;width:32px;height:32px;margin:0 auto;border-radius:50%;background:var(--c);color:#fff;font-weight:800;font-size:15px;box-shadow:0 0 0 4px var(--sec)}
|
||||
.flow b{display:block;margin-top:8px;font-size:14px;line-height:1.4}
|
||||
.flow span{display:block;margin-top:3px;font-size:12px;color:var(--m);line-height:1.45}
|
||||
.flow .lim{color:var(--c);font-weight:600}
|
||||
.hot{margin-top:16px;display:flex;gap:8px}
|
||||
.hot a{flex:1;min-width:0;display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:14px;background:#fff;border:1px solid var(--line);text-decoration:none;color:var(--t);font-size:12.5px;line-height:1.35}
|
||||
.hot a .ic{color:var(--c)}
|
||||
.hot a b{display:block;font-size:16px;color:var(--h)}
|
||||
|
||||
/* 页底 */
|
||||
.src{margin:24px 20px 0}
|
||||
.src ul{list-style:none}
|
||||
.src li{padding:6px 0;border-top:1px solid var(--line);font-size:12.5px;line-height:1.6;color:var(--t)}
|
||||
.src li:first-child{border-top:0}
|
||||
.foot{margin:14px 20px 0;font-size:12px;color:var(--m);text-align:center;line-height:1.6}
|
||||
|
||||
.fade{opacity:0;transform:translateY(8px);transition:opacity .4s,transform .4s}
|
||||
.fade.in{opacity:1;transform:none}
|
||||
@media (prefers-reduced-motion:reduce){.fade{opacity:1;transform:none;transition:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol>
|
||||
<symbol id="i-preg" viewBox="0 0 24 24"><circle cx="11" cy="4.5" r="2"/><path d="M10 8.5c-1.5 1.5-2 3.5-2 6V21M11 9.5c3.5 0 6 2 6 4.5s-2 4-5 4h-1M11 21v-3"/></symbol>
|
||||
<symbol id="i-baby" viewBox="0 0 24 24"><circle cx="12" cy="12.5" r="8.5"/><path d="M9.2 11.5h.01M14.8 11.5h.01M9.5 15.2c1.4 1.2 3.6 1.2 5 0M12 4c-1.2 0-1.6 1.2-.8 2"/></symbol>
|
||||
<symbol id="i-bottle" viewBox="0 0 24 24"><path d="M8 10h8v9a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2zM9 10V7.5h6V10M10.5 7.5L11 4h2l.5 3.5M8 14h3M8 17h3"/></symbol>
|
||||
<symbol id="i-cal" viewBox="0 0 24 24"><rect x="3.5" y="5" width="17" height="15.5" rx="3"/><path d="M3.5 10h17M8 3v4M16 3v4"/></symbol>
|
||||
<symbol id="i-phone" viewBox="0 0 24 24"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a1 1 0 0 1-1 1A16 16 0 0 1 4 5a1 1 0 0 1 1-1z"/></symbol>
|
||||
<symbol id="i-plus" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 8v8M8 12h8"/></symbol>
|
||||
<symbol id="i-coin" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M9 8l3 4 3-4M12 12v5M9 13h6M9 15.5h6"/></symbol>
|
||||
<symbol id="i-book" viewBox="0 0 24 24"><path d="M5 19.5v-15A1.5 1.5 0 0 1 6.5 3H19v15H6.5A1.5 1.5 0 0 0 5 19.5 1.5 1.5 0 0 0 6.5 21H19M9 7.5h6"/></symbol>
|
||||
<symbol id="i-pin" viewBox="0 0 24 24"><path d="M12 21s-6.5-5.5-6.5-11a6.5 6.5 0 0 1 13 0c0 5.5-6.5 11-6.5 11z"/><circle cx="12" cy="10" r="2.3"/></symbol>
|
||||
</svg>
|
||||
|
||||
<div id="scroll">
|
||||
<header class="bar" id="bar">
|
||||
<button class="back" id="back" aria-label="返回"><svg class="ic"><use href="#i-back" xlink:href="#i-back"/></svg></button>
|
||||
<span class="t">孕期专题</span>
|
||||
</header>
|
||||
|
||||
<div class="wrap">
|
||||
<section class="hero">
|
||||
<img src="img/hero.webp" alt="职场妈妈抱着宝宝站在办公室窗前">
|
||||
<h1>孕妈产后复工,<br>职场维权指南</h1>
|
||||
<div class="ans">孕期、产期、哺乳期,单位不能因此辞退你、降你工资。</div>
|
||||
<div class="me" id="me"><svg class="ic"><use href="#i-pin" xlink:href="#i-pin"/></svg><span id="meT"></span><button id="meGo">去看</button></div>
|
||||
</section>
|
||||
|
||||
<section class="key">
|
||||
<h2>记住这 3 点</h2>
|
||||
<ol>
|
||||
<li><span class="no">1</span><div><b>产假不少于 98 天</b><span>难产、多胞胎另加,各省还有奖励假</span></div></li>
|
||||
<li><span class="no">2</span><div><b>产检算上班时间</b><span>不扣工资,也不算请假</span></div></li>
|
||||
<li><span class="no">3</span><div><b>每天 1 小时哺乳时间</b><span>宝宝 1 岁内,多 1 个宝宝多 1 小时</span></div></li>
|
||||
</ol>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- 1 三个阶段 -->
|
||||
<section class="sec" id="s1">
|
||||
<h2>三个阶段的保护</h2>
|
||||
<p class="lead">不得降薪、不得辞退,合同到期也要顺延。</p>
|
||||
|
||||
<article class="stg fade" id="stA">
|
||||
<div class="hd"><svg class="ic"><use href="#i-preg" xlink:href="#i-preg"/></svg><b>孕期</b><span class="now">你在这里</span><small>怀孕上班</small></div>
|
||||
<ul>
|
||||
<li>产检时间<b>计入劳动时间</b></li>
|
||||
<li>干不了原岗位,凭医院证明可减量或调岗</li>
|
||||
<li>满 7 个月,<b>不加班、不排夜班</b></li>
|
||||
</ul>
|
||||
</article>
|
||||
<article class="stg fade" id="stB">
|
||||
<div class="hd"><svg class="ic"><use href="#i-baby" xlink:href="#i-baby"/></svg><b>产假</b><span class="now">你在这里</span><small>至少 98 天</small></div>
|
||||
<ul>
|
||||
<li>98 天,其中<b>产前可休 15 天</b></li>
|
||||
<li>难产 +15 天,每多 1 个宝宝 +15 天</li>
|
||||
<li>各省奖励假另加,以当地规定为准</li>
|
||||
</ul>
|
||||
</article>
|
||||
<article class="stg fade" id="stC">
|
||||
<div class="hd"><svg class="ic"><use href="#i-bottle" xlink:href="#i-bottle"/></svg><b>哺乳期</b><span class="now">你在这里</span><small>宝宝 1 岁内</small></div>
|
||||
<ul>
|
||||
<li>每天<b>1 小时哺乳时间</b>,在上班时间内</li>
|
||||
<li>不加班、不排夜班</li>
|
||||
<li>合同到期,<b>顺延到哺乳期结束</b></li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<details class="fold">
|
||||
<summary><svg class="ic"><use href="#i-plus" xlink:href="#i-plus"/></svg>还有这些也受保护</summary>
|
||||
<div class="bd">
|
||||
<p><b>流产假:</b>怀孕未满 4 个月 15 天,满 4 个月 42 天。</p>
|
||||
<p><b>晋升:</b>不得因怀孕、生育、哺乳限制晋职、晋级、评职称。</p>
|
||||
<p><b>调岗降薪:</b>改岗位、薪酬须协商一致并书面确认。</p>
|
||||
<p><b>违法辞退:</b>可要求继续履行合同,或主张经济补偿 2 倍的赔偿金。严重违纪等情形除外。</p>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<!-- 2 产假计算器 -->
|
||||
<section class="sec w" id="s2">
|
||||
<h2>我的产假怎么算</h2>
|
||||
<p class="lead">98 天是底线,加上本省天数才是你能休的。</p>
|
||||
|
||||
<div class="calc fade">
|
||||
<div class="fld">
|
||||
<label class="lb" for="cDue">预产期</label>
|
||||
<input class="inp" id="cDue" type="date">
|
||||
</div>
|
||||
<div class="fld">
|
||||
<span class="lb">是否难产</span>
|
||||
<div class="seg" id="cHard"><button data-v="0" class="on">否</button><button data-v="1">是 +15 天</button></div>
|
||||
</div>
|
||||
<div class="fld">
|
||||
<span class="lb">几胞胎</span>
|
||||
<div class="seg" id="cMulti"><button data-v="1" class="on">单胎</button><button data-v="2">双胞胎</button><button data-v="3">三胞胎</button></div>
|
||||
</div>
|
||||
<div class="fld">
|
||||
<span class="lb">本省可延长天数</span>
|
||||
<div class="stp"><button id="cMinus" aria-label="减少">-</button><input class="inp" id="cLocal" type="number" inputmode="numeric" min="0" max="365" value="0"><em>天</em><button id="cPlus" aria-label="增加">+</button></div>
|
||||
<span class="hint">各省不同,可问单位人事或当地人社;不确定先填 0</span>
|
||||
</div>
|
||||
<div class="res" id="cRes"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 3 维权 -->
|
||||
<section class="sec" id="s3">
|
||||
<h2>被劝退、降薪怎么办</h2>
|
||||
<p class="lead">别签「自愿离职」,先留证据。</p>
|
||||
|
||||
<ol class="flow fade">
|
||||
<li><span class="n">1</span><b>留证据</b><span>聊天、工资条截图备份</span></li>
|
||||
<li><span class="n">2</span><b>书面沟通</b><span>邮件写明诉求</span></li>
|
||||
<li><span class="n">3</span><b>监察投诉</b><span>找当地人社劳动监察</span></li>
|
||||
<li><span class="n">4</span><b>劳动仲裁</b><span class="lim">时效 1 年</span><span>不收费</span></li>
|
||||
</ol>
|
||||
<div class="hot">
|
||||
<a href="tel:12333"><svg class="ic"><use href="#i-phone" xlink:href="#i-phone"/></svg><div><b>12333</b>人社热线</div></a>
|
||||
<a href="tel:12338"><svg class="ic"><use href="#i-phone" xlink:href="#i-phone"/></svg><div><b>12338</b>妇女维权热线</div></a>
|
||||
</div>
|
||||
|
||||
<details class="fold">
|
||||
<summary><svg class="ic"><use href="#i-coin" xlink:href="#i-coin"/></svg>产假期间,钱怎么发?</summary>
|
||||
<div class="bd">
|
||||
<p><b>交了生育保险:</b>由生育保险基金发生育津贴,按单位上年度职工月平均工资计发。</p>
|
||||
<p><b>没交:</b>单位按你产假前的工资发。</p>
|
||||
<p>津贴低于原工资要不要补差,以当地规定为准。</p>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<details class="fold src">
|
||||
<summary><svg class="ic"><use href="#i-book" xlink:href="#i-book"/></svg>参考来源</summary>
|
||||
<div class="bd"><ul>
|
||||
<li>《女职工劳动保护特别规定》第 5~10 条:不得因三期降薪辞退;孕期减量、产检计入劳动时间、7 个月以上不加班不排夜班;98 天产假及难产、多胞胎、流产假;生育津贴;哺乳时间与设施</li>
|
||||
<li>《劳动合同法》第 35、42、45、48、87 条:变更合同须书面协商;三期内不得依第 40、41 条解除;合同期满顺延至三期结束;违法解除继续履行或 2 倍赔偿金</li>
|
||||
<li>《妇女权益保障法》(2022 年修订)第 48 条:不得因怀孕、产假、哺乳降低工资福利,限制晋职、晋级、评职称,辞退或解除合同</li>
|
||||
<li>《社会保险法》第 53~56 条:生育保险待遇含生育医疗费用和生育津贴</li>
|
||||
<li>《劳动争议调解仲裁法》第 27、53 条:仲裁时效 1 年,自知道或应当知道权利被侵害之日起算;仲裁不收费</li>
|
||||
<li>计算器:98 天 + 难产 15 天 + 每多 1 个宝宝 15 天 + 本省天数,按预产期前 15 天起休估算;实际以分娩日期、单位审批及当地规定(含节假日是否顺延、剖宫产是否按难产)为准</li>
|
||||
</ul></div>
|
||||
</details>
|
||||
<p class="foot">本页为法律常识整理,不构成法律意见。</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
function hp(n) { var h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || ''); var m = h.match(new RegExp('(?:^|&)' + n + '=([^&]*)')); return m ? decodeURIComponent(m[1]) : ''; }
|
||||
var openid = hp('openid');
|
||||
var sc = $('#scroll');
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
/* 顶栏:滚动后白底细线 */
|
||||
var bar = $('#bar');
|
||||
sc.addEventListener('scroll', function () { bar.classList.toggle('on', sc.scrollTop > 8); }, { passive: true });
|
||||
|
||||
function go(id) {
|
||||
var el = document.getElementById(id); if (!el) return;
|
||||
var top = el.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop - 60;
|
||||
sc.scrollTo({ top: top, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
/* ---------- 产假计算器 ---------- */
|
||||
function pad(n) { return (n < 10 ? '0' : '') + n; }
|
||||
function iso(d) { return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()); }
|
||||
function parseDay(s) { var m = /^(\d{4})-(\d{1,2})-(\d{1,2})/.exec(s || ''); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; }
|
||||
function addDays(d, n) { return new Date(d.getFullYear(), d.getMonth(), d.getDate() + n); } /* 按日历日加,避开夏令时 */
|
||||
function cn(d) { return d.getFullYear() + '年' + (d.getMonth() + 1) + '月' + d.getDate() + '日'; }
|
||||
function segVal(id) { var b = document.querySelector('#' + id + ' .on'); return b ? +b.dataset.v : 0; }
|
||||
[].forEach.call(document.querySelectorAll('.seg'), function (s) {
|
||||
s.addEventListener('click', function (e) {
|
||||
var b = e.target.closest('button'); if (!b) return;
|
||||
[].forEach.call(s.children, function (x) { x.classList.toggle('on', x === b); });
|
||||
calc();
|
||||
});
|
||||
});
|
||||
var loc = $('#cLocal');
|
||||
function localDays() { var v = parseInt(loc.value, 10); return isNaN(v) || v < 0 ? 0 : Math.min(v, 365); }
|
||||
$('#cMinus').addEventListener('click', function () { loc.value = Math.max(0, localDays() - 1); calc(); });
|
||||
$('#cPlus').addEventListener('click', function () { loc.value = Math.min(365, localDays() + 1); calc(); });
|
||||
loc.addEventListener('input', calc);
|
||||
loc.addEventListener('blur', function () { loc.value = localDays(); calc(); });
|
||||
$('#cDue').addEventListener('input', calc);
|
||||
$('#cDue').addEventListener('change', calc);
|
||||
|
||||
/* 国家 = 98 + 难产 15 + (胎数-1)×15;合计 = 国家 + 本省;
|
||||
起休 = 预产期前 15 天(pre=0 则预产期当天);最后一天 = 起休 + 合计 - 1;返岗 = 起休 + 合计 */
|
||||
function compute(due, hard, multi, local, pre) {
|
||||
if (pre === undefined) pre = 1;
|
||||
var nat = 98 + (hard ? 15 : 0) + (multi - 1) * 15;
|
||||
var total = nat + local;
|
||||
var start = addDays(due, pre ? -15 : 0);
|
||||
return { nat: nat, total: total, start: start, last: addDays(start, total - 1), back: addDays(start, total) };
|
||||
}
|
||||
window.__leaveCalc = compute; /* 自查用 */
|
||||
|
||||
function calc() {
|
||||
var box = $('#cRes'), due = parseDay($('#cDue').value);
|
||||
if (!due) { box.innerHTML = '<div class="empty">填上预产期,马上帮你算</div>'; return; }
|
||||
var r = compute(due, segVal('cHard'), segVal('cMulti') || 1, localDays(), 1);
|
||||
box.innerHTML =
|
||||
'<div class="tot"><em id="rTotal">' + r.total + '</em><span>天产假</span><small>国家规定 ' + r.nat + ' 天</small></div>' +
|
||||
'<div class="dt"><div><small>开始休</small><b id="rStart">' + cn(r.start) + '</b></div>' +
|
||||
'<div><small>返岗日</small><b id="rBack">' + cn(r.back) + '</b></div></div>' +
|
||||
'<p class="note">按预产期前 15 天起休估算,以实际分娩日为准。</p>';
|
||||
}
|
||||
calc();
|
||||
|
||||
/* ---------- 按孕周点亮阶段 + 预填预产期 ---------- */
|
||||
function mark(stage, t, target) {
|
||||
var el = document.getElementById(stage); if (el) el.classList.add('hl');
|
||||
$('#meT').textContent = t;
|
||||
$('#meGo').onclick = function () { go(target || stage); };
|
||||
$('#me').classList.add('on');
|
||||
}
|
||||
if (openid) {
|
||||
var base = '/api/mp/public/mama-box/';
|
||||
fetch(base + 'profile?openid=' + encodeURIComponent(openid))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (j) {
|
||||
var p = j && j.code === 200 && j.result; if (!p || !p.dueDate) return;
|
||||
var d = parseDay(p.dueDate), inp = $('#cDue');
|
||||
if (d && !inp.value) { inp.value = iso(d); calc(); }
|
||||
}).catch(function () {});
|
||||
fetch(base + 'pregnancy?openid=' + encodeURIComponent(openid))
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (j) {
|
||||
var p = j && j.code === 200 && j.result; if (!p) return;
|
||||
/* 先判产后(产后返回体 week 也是 null) */
|
||||
if (p.postpartum) mark('stC', '宝宝出生了,重点看哺乳期的保护');
|
||||
else if (p.week != null && !p.empty) {
|
||||
var w = p.week;
|
||||
if (w >= 28) mark('stA', '孕 ' + w + ' 周,已满 7 个月:不加班,算算产假', 's2');
|
||||
else mark('stA', '孕 ' + w + ' 周,先看孕期的保护');
|
||||
}
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
/* 进场动画(轻) */
|
||||
if ('IntersectionObserver' in window) {
|
||||
var io = new IntersectionObserver(function (es) { es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { root: sc, threshold: .1 });
|
||||
[].forEach.call(document.querySelectorAll('.fade'), function (el) { io.observe(el); });
|
||||
} else [].forEach.call(document.querySelectorAll('.fade'), function (el) { el.classList.add('in'); });
|
||||
|
||||
/* 禁止下拉回弹:固定外壳 + 容器滚动 + 到顶/到底时拦 touchmove */
|
||||
var y0 = 0;
|
||||
sc.addEventListener('touchstart', function (e) { y0 = e.touches[0].clientY; }, { passive: true });
|
||||
sc.addEventListener('touchmove', function (e) {
|
||||
var dy = e.touches[0].clientY - y0;
|
||||
if ((sc.scrollTop <= 0 && dy > 0) || (sc.scrollTop + sc.clientHeight >= sc.scrollHeight - 1 && dy < 0)) e.preventDefault();
|
||||
}, { passive: false });
|
||||
document.addEventListener('touchmove', function (e) { if (!sc.contains(e.target)) e.preventDefault(); }, { passive: false });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||