其他妈妈也在搜:孕4-40周每周18条问答,首页露6条+全部问题页;孕期数据去花哨背景、文字实色 v26103108
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1
assets/data/qa/10.json
Normal file
1
assets/data/qa/10.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/11.json
Normal file
1
assets/data/qa/11.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/12.json
Normal file
1
assets/data/qa/12.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/13.json
Normal file
1
assets/data/qa/13.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/14.json
Normal file
1
assets/data/qa/14.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/15.json
Normal file
1
assets/data/qa/15.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/16.json
Normal file
1
assets/data/qa/16.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/17.json
Normal file
1
assets/data/qa/17.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/18.json
Normal file
1
assets/data/qa/18.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/19.json
Normal file
1
assets/data/qa/19.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/20.json
Normal file
1
assets/data/qa/20.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/21.json
Normal file
1
assets/data/qa/21.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/22.json
Normal file
1
assets/data/qa/22.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/23.json
Normal file
1
assets/data/qa/23.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/24.json
Normal file
1
assets/data/qa/24.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/25.json
Normal file
1
assets/data/qa/25.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/26.json
Normal file
1
assets/data/qa/26.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/27.json
Normal file
1
assets/data/qa/27.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/28.json
Normal file
1
assets/data/qa/28.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/29.json
Normal file
1
assets/data/qa/29.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/30.json
Normal file
1
assets/data/qa/30.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/31.json
Normal file
1
assets/data/qa/31.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/32.json
Normal file
1
assets/data/qa/32.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/33.json
Normal file
1
assets/data/qa/33.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/34.json
Normal file
1
assets/data/qa/34.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/35.json
Normal file
1
assets/data/qa/35.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/36.json
Normal file
1
assets/data/qa/36.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/37.json
Normal file
1
assets/data/qa/37.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/38.json
Normal file
1
assets/data/qa/38.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/39.json
Normal file
1
assets/data/qa/39.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/4.json
Normal file
1
assets/data/qa/4.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/40.json
Normal file
1
assets/data/qa/40.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/5.json
Normal file
1
assets/data/qa/5.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/6.json
Normal file
1
assets/data/qa/6.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/7.json
Normal file
1
assets/data/qa/7.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/8.json
Normal file
1
assets/data/qa/8.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/data/qa/9.json
Normal file
1
assets/data/qa/9.json
Normal file
File diff suppressed because one or more lines are too long
104
index.html
104
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:26103107 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26103108 缓存版本标记:改 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) -->
|
||||
@@ -312,45 +312,33 @@
|
||||
html.night .tg-n{color:#F1E6EE}
|
||||
html.night .tg-s{background:rgba(255,255,255,.1);color:#E9D6E2}
|
||||
/* —— 我的孕期数据:彩色光斑底 + 毛玻璃格 —— */
|
||||
.vt{position:relative;margin-top:18px;padding:14px 12px 12px;border-radius:22px;overflow:hidden;isolation:isolate;
|
||||
background:radial-gradient(120px 110px at 8% 6%,rgba(255,160,130,.55),transparent 70%),
|
||||
radial-gradient(150px 120px at 96% 18%,rgba(196,166,255,.5),transparent 70%),
|
||||
radial-gradient(160px 120px at 20% 100%,rgba(120,214,198,.45),transparent 70%),
|
||||
radial-gradient(150px 120px at 88% 96%,rgba(255,150,190,.45),transparent 70%),
|
||||
linear-gradient(160deg,#FFF4EF,#FBF3FF);
|
||||
border:1px solid rgba(255,255,255,.8);box-shadow:0 10px 26px rgba(214,140,120,.14)}
|
||||
/* 2026-10-31 用户:背景太乱太花 → 整块只留一层很淡的暖色底,格子去掉光晕和毛玻璃,字一律实色 */
|
||||
.vt{position:relative;margin-top:18px;padding:14px 12px 12px;border-radius:22px;background:linear-gradient(180deg,#FFF1EA,#FFF8F4);border:1px solid #F8E3DA}
|
||||
.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:#9C8580}
|
||||
.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:18px;min-width:0;text-align:left;font:inherit;color:inherit;overflow:hidden;
|
||||
background:linear-gradient(145deg,rgba(255,255,255,.72),rgba(255,255,255,.42));
|
||||
-webkit-backdrop-filter:blur(14px) saturate(160%);backdrop-filter:blur(14px) saturate(160%);
|
||||
border:1px solid rgba(255,255,255,.85);box-shadow:0 6px 16px rgba(170,110,120,.10),inset 0 1px 0 rgba(255,255,255,.9)}
|
||||
.vt-it::before{content:"";position:absolute;right:-26px;top:-26px;width:84px;height:84px;border-radius:50%;background:var(--vt-c);opacity:.16;filter:blur(6px);z-index:-1}
|
||||
.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:#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:rgba(255,255,255,.75)}
|
||||
.vt-ic{flex:none;width:26px;height:26px;border-radius:9px;display:grid;place-items:center;color:var(--vt-c);background:#FFF3EE}
|
||||
.vt-ic svg{width:18px;height:18px}
|
||||
.vt-l{font-size:13px;color:#5E4B48;font-weight:700;white-space:nowrap}
|
||||
.vt-u{margin-left:auto;font-size:10.5px;color:#A8938F}
|
||||
.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-it.empty .vt-v b{color:rgba(120,90,90,.25)}
|
||||
.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:rgba(255,255,255,.75);color:var(--vt-c);font-weight:700;white-space:nowrap}
|
||||
.vt-s{flex:none;font-size:11px;line-height:1.4;padding:1px 8px;border-radius:99px;background:#FFF3EE;color:var(--vt-c);font-weight:700;white-space:nowrap}
|
||||
.vt-s:empty{display:none}
|
||||
.vt-it.empty .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:10.5px;color:#9C8885;white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
||||
.vt-d{font-size:11px;color:#6E5A57;white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
||||
.vt-d:empty{display:none}
|
||||
.vt-it.demo .vt-v b{color:rgba(90,60,60,.45)}
|
||||
.vt-it.empty .vt-s.dm{padding:1px 8px;background:#FFF1D6;color:#B8862B}
|
||||
.vt-it.demo .vt-d{color:var(--vt-c);font-weight:700}
|
||||
html.night .vt-it.demo .vt-v b{color:rgba(255,255,255,.4)}
|
||||
html.night .vt-it.empty .vt-s.dm{background:rgba(255,200,100,.16);color:#F0C67A}
|
||||
.vt-k{--vt-c:#E9673F}
|
||||
.vt-w{--vt-c:#E5606A}
|
||||
@@ -358,12 +346,11 @@
|
||||
.vt-g{--vt-c:#22968A}
|
||||
.vt-c{--vt-c:#7A5BC8}
|
||||
.vt-e{--vt-c:#4E74C4}
|
||||
html.night .vt{background:radial-gradient(130px 110px at 8% 6%,rgba(255,140,110,.22),transparent 70%),radial-gradient(150px 120px at 96% 18%,rgba(170,140,255,.22),transparent 70%),radial-gradient(160px 120px at 20% 100%,rgba(90,190,175,.2),transparent 70%),#2A2231;border-color:rgba(255,255,255,.08);box-shadow:none}
|
||||
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}
|
||||
html.night .vt-it.empty .vt-v b{color:rgba(255,255,255,.2)}
|
||||
</style>
|
||||
<!-- 此刻(2026-10-01 需求文档 v1.0 第二节;同日两次改版)。数据 GET /api/mp/public/mama-box/pulse,渲染在 app.js pulseCard()。
|
||||
⚠️ 模拟数据是产品负责人 2026-10-01 拍板的例外(AGENTS.md §4.12),只限这一条。
|
||||
@@ -427,6 +414,7 @@
|
||||
</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}
|
||||
@@ -449,6 +437,9 @@
|
||||
.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}
|
||||
@@ -1330,6 +1321,69 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ================= 其他妈妈也在搜 · 全部问题(2026-10-31)=================
|
||||
首页 #pregTips 只露 6 条,其余在这里:按孕周取 assets/data/qa/<周>.json(孕 4–40 周,每周 18 条问答),
|
||||
分类筛选 + 点开看答案;从首页点某一条进来,自动展开并滚到那一条。渲染在 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">
|
||||
@@ -2148,7 +2202,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=26103107"></script>
|
||||
<script src="js/birth-flow.js?v=26103108"></script>
|
||||
|
||||
<!-- 禁止下拉回弹(2026-10-11 统一规则,与孕期体重同一段):竖向拖动时从手指下往上找还能朝该方向滚的容器,找不到才拦;横滑、双指、可滚列表不受影响 -->
|
||||
<script>
|
||||
|
||||
116
js/app.js
116
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26103107';
|
||||
var VER = '26103108';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -5057,30 +5057,52 @@
|
||||
sec.classList.remove('hide');
|
||||
revealTipsGrid();
|
||||
}
|
||||
/* 2026-10-31 首页「其他妈妈也在搜」:6 条问题,全部有落点(专题页 / 小知识详情页),按孕周每周换 */
|
||||
/* 2026-10-31 首页「其他妈妈也在搜」:问题库 assets/data/qa/<周>.json(孕 4–40 周,每周 18 条问答),
|
||||
首页只露 6 条(孕 12 周起第一条是妊娠纹专题),点任意一条 / 「查看全部」进 #detailQA 看答案和其余问题。
|
||||
问题库没加载到时退回 6 条本周小知识入口(落点 #detailTips),首页不空。 */
|
||||
let QA = null, qaLoading = null;
|
||||
/* 按周拆成小文件 assets/data/qa/<周>.json(每份约 6KB),只拉当前孕周;孕周变了再拉新的一份 */
|
||||
function loadQA() {
|
||||
const w = qaWeek();
|
||||
if (QA && QA[w]) return Promise.resolve(QA);
|
||||
if (!qaLoading || qaLoading.w !== w) {
|
||||
qaLoading = fetch('assets/data/qa/' + w + '.json?v=' + VER).then(r => (r.ok ? r.json() : [])).catch(() => [])
|
||||
.then(a => { QA = QA || {}; QA[w] = Array.isArray(a) ? a : []; return QA; });
|
||||
qaLoading.w = w;
|
||||
}
|
||||
return qaLoading;
|
||||
}
|
||||
const QA_CATS = ['产检', '身体', '饮食', '补剂', '宝宝', '生活', '心情', '准备'];
|
||||
let qaCat = '全部';
|
||||
function qaWeek() { return Math.max(4, Math.min(40, state.week || 0)); }
|
||||
function renderSearch(wk, today, size) {
|
||||
const W = state.week, L = $('#msList');
|
||||
if (!L) return;
|
||||
if (!QA || !QA[qaWeek()]) { loadQA().then(q => { if (q[qaWeek()] && q[qaWeek()].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].map(i => avaImg(pool[(s0 + i * 3) % pool.length])).join('');
|
||||
const q = t => /[??吗呢]$/.test(t) ? t : t + (/怎么办|什么|多少|怎么|几/.test(t) ? '?' : '');
|
||||
const bank = (QA && QA[qaWeek()]) || [];
|
||||
const items = [];
|
||||
if (W >= 12) items.push({ q: '妊娠纹怎么防?现在该抹什么', tag: '专题', cls: 'hot', href: 'topic/wen/' + location.search + location.hash });
|
||||
const d0 = wk.days[today];
|
||||
if (d0 && d0.t) items.push({ q: q(d0.t), tag: '今日', cls: 'new' });
|
||||
items.push({ q: '孕' + W + '周,宝宝长多大了?', tag: '热', cls: 'hot', pt: 'baby' });
|
||||
items.push({ q: '这周身体会有哪些变化?', pt: 'mom' });
|
||||
items.push({ q: '孕' + W + '周吃什么对宝宝好?', pt: 'eat' });
|
||||
items.push({ q: '这周产检和生活要留心什么?', pt: 'care' });
|
||||
const d1 = today > 0 && wk.days[today - 1];
|
||||
if (items.length < 6 && d1 && d1.t) items.push({ q: q(d1.t), tag: '昨天' });
|
||||
if (bank.length) {
|
||||
bank.slice(0, 6 - items.length).forEach((x, i) => items.push({ q: x.q, tag: x.hot ? '热' : '', cls: 'hot', qa: i }));
|
||||
} else {
|
||||
const q = t => /[??吗呢]$/.test(t) ? t : t + (/怎么办|什么|多少|怎么|几/.test(t) ? '?' : '');
|
||||
const d0 = wk.days[today];
|
||||
if (d0 && d0.t) items.push({ q: q(d0.t), tag: '今日', cls: 'new', pt: '' });
|
||||
items.push({ q: '孕' + W + '周,宝宝长多大了?', tag: '热', cls: 'hot', pt: 'baby' });
|
||||
items.push({ q: '这周身体会有哪些变化?', pt: 'mom' });
|
||||
items.push({ q: '孕' + W + '周吃什么对宝宝好?', pt: 'eat' });
|
||||
items.push({ q: '这周产检和生活要留心什么?', pt: 'care' });
|
||||
}
|
||||
L.textContent = '';
|
||||
items.slice(0, 6).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', () => openTips(it.pt)); }
|
||||
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 t = document.createElement('span'); t.className = 'ms-q'; t.textContent = it.q;
|
||||
el.appendChild(no); el.appendChild(t);
|
||||
@@ -5088,7 +5110,75 @@
|
||||
const go = document.createElement('i'); go.className = 'ms-go'; go.textContent = '›'; el.appendChild(go);
|
||||
L.appendChild(el);
|
||||
});
|
||||
const all = $('#msAll');
|
||||
if (all) {
|
||||
const n = bank.length + (W >= 12 ? 1 : 0);
|
||||
all.classList.toggle('hide', !bank.length);
|
||||
all.textContent = '查看全部 ' + n + ' 个问题 ›';
|
||||
}
|
||||
}
|
||||
/* 全部问题页:focus = 从首页点的那条在本周问题库里的下标(展开 + 滚到它);不传 = 从「查看全部」进来 */
|
||||
function openQA(focus) {
|
||||
const W = state.week, bank = (QA && QA[qaWeek()]) || [];
|
||||
if (!bank.length) { openTips(); return; }
|
||||
$('#qaTitle').textContent = '孕 ' + W + ' 周 · 其他妈妈也在搜';
|
||||
$('#qaHeroT').textContent = '孕 ' + W + ' 周,妈妈们最常问的 ' + bank.length + ' 个问题';
|
||||
$('#qaHeroD').textContent = '点开问题看答案,每周按孕周自动更新';
|
||||
const tp = $('#qaTopic');
|
||||
tp.classList.toggle('hide', !(W >= 12));
|
||||
tp.setAttribute('href', 'topic/wen/' + location.search + location.hash);
|
||||
const cats = QA_CATS.filter(c => bank.some(x => x.tag === c));
|
||||
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 < 3 ? ' 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.hot ? ' hot' : ''); g.textContent = x.hot ? '热' : (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 || '';
|
||||
h.addEventListener('click', () => { 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]) {
|
||||
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) {
|
||||
qaCat = 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));
|
||||
const tp = $('#qaTopic'); if (tp) tp.style.display = c === '全部' ? '' : 'none';
|
||||
}
|
||||
(function () {
|
||||
const all = $('#msAll'); if (all) all.addEventListener('click', () => openQA());
|
||||
const tp = $('#qaTips'); if (tp) tp.addEventListener('click', () => openTips());
|
||||
})();
|
||||
/* 首页四个入口 → 详情页,滚到对应那张卡并闪一下 */
|
||||
function openTips(key) {
|
||||
openPanel('detailTips');
|
||||
@@ -5240,7 +5330,7 @@
|
||||
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] : ''));
|
||||
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', () => {
|
||||
|
||||
Reference in New Issue
Block a user