v26110259 预览:此刻改为「孕期百宝箱」三入口(趣味小测试 / 孕期百问 / 孕期计算器)进列表页;新增计算器列表页 topic/jisuan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BIN
assets/img/kit/ceshi.webp
Normal file
BIN
assets/img/kit/ceshi.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -367,8 +367,8 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
|||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toast"></div>
|
<div class="toast" id="toast"></div>
|
||||||
|
|
||||||
<script src="meta.js?v=26110258"></script>
|
<script src="meta.js?v=26110259"></script>
|
||||||
<script src="tests.js?v=26110258"></script>
|
<script src="tests.js?v=26110259"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|||||||
@@ -666,10 +666,10 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
|||||||
<div id="sheet" role="dialog" aria-modal="true"><i class="sg"></i><div class="sbd" id="sbd"></div></div>
|
<div id="sheet" role="dialog" aria-modal="true"><i class="sg"></i><div class="sbd" id="sbd"></div></div>
|
||||||
<div class="toast" id="toast"></div>
|
<div class="toast" id="toast"></div>
|
||||||
|
|
||||||
<script src="topics.js?v=26110258"></script>
|
<script src="topics.js?v=26110259"></script>
|
||||||
<script src="data.js?v=26110258"></script>
|
<script src="data.js?v=26110259"></script>
|
||||||
<script src="feed.js?v=26110258"></script>
|
<script src="feed.js?v=26110259"></script>
|
||||||
<script src="ceshi/meta.js?v=26110258"></script>
|
<script src="ceshi/meta.js?v=26110259"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -735,7 +735,7 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
|
|||||||
var CMD = null, CMERR = false;
|
var CMD = null, CMERR = false;
|
||||||
/* 头像编码:数字 = av/NNNN.webp(旧代码头像);'av:c012' = av/c012.webp(卡通/可爱卡通);'/…' = 站内绝对路径(内置头像库 /_bridge/avatars/);其余 = assets/img/mom/xxx.jpg */
|
/* 头像编码:数字 = av/NNNN.webp(旧代码头像);'av:c012' = av/c012.webp(卡通/可爱卡通);'/…' = 站内绝对路径(内置头像库 /_bridge/avatars/);其余 = assets/img/mom/xxx.jpg */
|
||||||
var avP = function (a) { return typeof a === 'number' ? 'av/' + ('000' + a).slice(-4) + '.webp' : a.indexOf('av:') === 0 ? 'av/' + a.slice(3) + '.webp' : a.charAt(0) === '/' ? a : '../assets/img/mom/' + a + '.jpg'; };
|
var avP = function (a) { return typeof a === 'number' ? 'av/' + ('000' + a).slice(-4) + '.webp' : a.indexOf('av:') === 0 ? 'av/' + a.slice(3) + '.webp' : a.charAt(0) === '/' ? a : '../assets/img/mom/' + a + '.jpg'; };
|
||||||
fetch('cm.json?v=26110258').then(function (r) { return r.json(); }).then(function (j) {
|
fetch('cm.json?v=26110259').then(function (r) { return r.json(); }).then(function (j) {
|
||||||
CMD = j; if (openId && NBY[openId]) { renderComments(NBY[openId]); syncBar(NBY[openId]); }
|
CMD = j; if (openId && NBY[openId]) { renderComments(NBY[openId]); syncBar(NBY[openId]); }
|
||||||
}).catch(function () { CMERR = true; if (openId && NBY[openId]) renderComments(NBY[openId]); });
|
}).catch(function () { CMERR = true; if (openId && NBY[openId]) renderComments(NBY[openId]); });
|
||||||
function commentsOf(n) {
|
function commentsOf(n) {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ main{padding:6px 16px 0}
|
|||||||
</div>
|
</div>
|
||||||
<div class="wb"><button type="button" id="write"><svg class="ic" viewBox="0 0 24 24"><path d="M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>写新的故事</button></div>
|
<div class="wb"><button type="button" id="write"><svg class="ic" viewBox="0 0 24 24"><path d="M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>写新的故事</button></div>
|
||||||
|
|
||||||
<script src="../topics.js?v=26110258"></script>
|
<script src="../topics.js?v=26110259"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|||||||
16
index.html
16
index.html
@@ -7,7 +7,7 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>兜爸心选 · 孕育陪伴</title>
|
<title>兜爸心选 · 孕育陪伴</title>
|
||||||
<!-- V:26110258 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
<!-- V:26110259 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||||
<link rel="stylesheet" href="mama-box.css">
|
<link rel="stylesheet" href="mama-box.css">
|
||||||
<link rel="stylesheet" href="night.css">
|
<link rel="stylesheet" href="night.css">
|
||||||
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
||||||
@@ -527,8 +527,8 @@
|
|||||||
<span class="we-go" id="weGo"></span>
|
<span class="we-go" id="weGo"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- 11-03 测一测 · 科普 · 计算器(替代上面的「此刻」,js/kit.js;?kit=0 看回此刻) -->
|
<!-- 11-03 孕期百宝箱:趣味小测试 · 孕期百问 · 孕期计算器(替代上面的「此刻」,js/kit.js;?kit=0 看回此刻) -->
|
||||||
<div class="kit hide" id="kit" role="region" aria-label="测一测、科普、计算器"></div>
|
<div class="kit hide" id="kit" role="region" aria-label="孕期百宝箱"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- 孕妈广场(2026-11-01 第一版,占位内容)。用户原话:「在这个模块下边加一个广场,放一些话题,有跟家庭里的,也有宝妈经验的……
|
<!-- 孕妈广场(2026-11-01 第一版,占位内容)。用户原话:「在这个模块下边加一个广场,放一些话题,有跟家庭里的,也有宝妈经验的……
|
||||||
@@ -2521,16 +2521,16 @@
|
|||||||
<script src="/_bridge/avatar-picker.js?v=26101105"></script>
|
<script src="/_bridge/avatar-picker.js?v=26101105"></script>
|
||||||
<script src="/_bridge/hand-icons.js?v=26101202"></script>
|
<script src="/_bridge/hand-icons.js?v=26101202"></script>
|
||||||
<script src="js/zodiac-art.js"></script>
|
<script src="js/zodiac-art.js"></script>
|
||||||
<script src="guangchang/topics.js?v=26110258"></script>
|
<script src="guangchang/topics.js?v=26110259"></script>
|
||||||
<script src="js/app.js"></script>
|
<script src="js/app.js"></script>
|
||||||
<script src="js/kit.js?v=26110258"></script>
|
<script src="js/kit.js?v=26110259"></script>
|
||||||
<script>
|
<script>
|
||||||
/* 11-02 首页「孕妈广场」效果稿:地址带 ?gcv=1~6 时,把 #gcHome 换成 demo/gch/vN.css + vN.js 的版式并滚到这一块。
|
/* 11-02 首页「孕妈广场」效果稿:地址带 ?gcv=1~6 时,把 #gcHome 换成 demo/gch/vN.css + vN.js 的版式并滚到这一块。
|
||||||
11-02 用户:「用第一版,放到预览页面上」;后改定彩色卡 → 不带参数也默认用 V6 合并版(广场卡堆 + 其他妈妈也在搜 + 测一测第 4 版彩色卡),不滚动、不显示效果稿角标 */
|
11-02 用户:「用第一版,放到预览页面上」;后改定彩色卡 → 不带参数也默认用 V6 合并版(广场卡堆 + 其他妈妈也在搜 + 测一测第 4 版彩色卡),不滚动、不显示效果稿角标 */
|
||||||
(function () {
|
(function () {
|
||||||
var m = location.search.match(/[?&]gcv=([1-6])(?:&|$)/);
|
var m = location.search.match(/[?&]gcv=([1-6])(?:&|$)/);
|
||||||
if (!m) window.__gcDefault = 1;
|
if (!m) window.__gcDefault = 1;
|
||||||
var n = m ? m[1] : '6', l = document.createElement('link'), s = document.createElement('script'), q = m ? Date.now() : 'v=26110258';
|
var n = m ? m[1] : '6', l = document.createElement('link'), s = document.createElement('script'), q = m ? Date.now() : 'v=26110259';
|
||||||
var dir = n === '4' || n === '6' ? 'js/gch/' : 'demo/gch/'; /* 11-03 上正式:定稿 V6(含它套的 V4)并进 js/gch/,其余效果稿仍在 demo/ */
|
var dir = n === '4' || n === '6' ? 'js/gch/' : 'demo/gch/'; /* 11-03 上正式:定稿 V6(含它套的 V4)并进 js/gch/,其余效果稿仍在 demo/ */
|
||||||
l.rel = 'stylesheet'; l.href = dir + 'v' + n + '.css?' + q;
|
l.rel = 'stylesheet'; l.href = dir + 'v' + n + '.css?' + q;
|
||||||
s.src = dir + 'v' + n + '.js?' + q;
|
s.src = dir + 'v' + n + '.js?' + q;
|
||||||
@@ -2539,7 +2539,7 @@
|
|||||||
/* 11-02 品牌露出(用户定 4 处都要):默认加载,?brand=0 可关掉对比;11-03 已并进 js/gch/ */
|
/* 11-02 品牌露出(用户定 4 处都要):默认加载,?brand=0 可关掉对比;11-03 已并进 js/gch/ */
|
||||||
if (!/[?&]brand=0/.test(location.search)) {
|
if (!/[?&]brand=0/.test(location.search)) {
|
||||||
var bl = document.createElement('link'), bs = document.createElement('script');
|
var bl = document.createElement('link'), bs = document.createElement('script');
|
||||||
bl.rel = 'stylesheet'; bl.href = 'js/gch/brand.css?v=26110258'; bs.src = 'js/gch/brand.js?v=26110258';
|
bl.rel = 'stylesheet'; bl.href = 'js/gch/brand.css?v=26110259'; bs.src = 'js/gch/brand.js?v=26110259';
|
||||||
document.head.appendChild(bl); document.body.appendChild(bs);
|
document.head.appendChild(bl); document.body.appendChild(bs);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -2550,7 +2550,7 @@
|
|||||||
<script src="js/hero-fx.js"></script>
|
<script src="js/hero-fx.js"></script>
|
||||||
<!-- 2026-10-05 首页头图:宝宝时不时动一动小手小脚(独立文件,删掉这一行即下线) -->
|
<!-- 2026-10-05 首页头图:宝宝时不时动一动小手小脚(独立文件,删掉这一行即下线) -->
|
||||||
<script src="js/baby-limbs.js?v=26101201"></script>
|
<script src="js/baby-limbs.js?v=26101201"></script>
|
||||||
<script src="js/coach.js?v=26110258"></script>
|
<script src="js/coach.js?v=26110259"></script>
|
||||||
<script src="js/birth-flow.js?v=26110201"></script>
|
<script src="js/birth-flow.js?v=26110201"></script>
|
||||||
|
|
||||||
<!-- 禁止下拉回弹(2026-10-11 统一规则,与孕期体重同一段):竖向拖动时从手指下往上找还能朝该方向滚的容器,找不到才拦;横滑、双指、可滚列表不受影响 -->
|
<!-- 禁止下拉回弹(2026-10-11 统一规则,与孕期体重同一段):竖向拖动时从手指下往上找还能朝该方向滚的容器,找不到才拦;横滑、双指、可滚列表不受影响 -->
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||||
var VER = '26110258';
|
var VER = '26110259';
|
||||||
const $ = (s, c) => (c || document).querySelector(s);
|
const $ = (s, c) => (c || document).querySelector(s);
|
||||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||||
|
|
||||||
@@ -5650,6 +5650,8 @@
|
|||||||
}
|
}
|
||||||
(function () {
|
(function () {
|
||||||
const all = $('#msAll'); if (all) all.addEventListener('click', () => loadQA().then(() => openQA())); /* 11-02 合并版里原模块可能没渲染过,先确保问题库到手 */
|
const all = $('#msAll'); if (all) all.addEventListener('click', () => loadQA().then(() => openQA())); /* 11-02 合并版里原模块可能没渲染过,先确保问题库到手 */
|
||||||
|
/* 11-03 首页「孕期百问」入口(js/kit.js)打开同一个全部问题页,标题换成「孕期百问」 */
|
||||||
|
window.__mbOpenQA = t => loadQA().then(() => { openQA(); if (t) $('#qaTitle').textContent = t; });
|
||||||
const tp = $('#qaTips'); if (tp) tp.addEventListener('click', () => openTips());
|
const tp = $('#qaTips'); if (tp) tp.addEventListener('click', () => openTips());
|
||||||
})();
|
})();
|
||||||
/* 首页四个入口 → 详情页,滚到对应那张卡并闪一下 */
|
/* 首页四个入口 → 详情页,滚到对应那张卡并闪一下 */
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
const STEPS = [
|
const STEPS = [
|
||||||
{ sel: '.hero-pane', t: '这是你的孕周', d: '孕几周、离见面还有几天、宝宝现在有多大,每天打开都会更新。' },
|
{ sel: '.hero-pane', t: '这是你的孕周', d: '孕几周、离见面还有几天、宝宝现在有多大,每天打开都会更新。' },
|
||||||
{ sel: '.tool-dock', t: '常用孕育工具', d: '数胎动、孕检日历、体重这些常用工具都在这里,点卡片直接进。' },
|
{ sel: '.tool-dock', t: '常用孕育工具', d: '数胎动、孕检日历、体重这些常用工具都在这里,点卡片直接进。' },
|
||||||
/* 11-03「此刻」换成测一测 · 科普 · 计算器(js/kit.js);?kit=0 时 #kit 不显示,自动跳过 */
|
/* 11-03「此刻」换成孕期百宝箱(测试 / 百问 / 计算器)(js/kit.js);?kit=0 时 #kit 不显示,自动跳过 */
|
||||||
{ sel: '#kit', t: '测一测 · 科普 · 计算器', d: '按你的孕周,每天推荐一个小测试、一篇科普和实用计算器。' },
|
{ sel: '#kit', t: '孕期百宝箱', d: '趣味小测试、孕期百问、孕期计算器,都在这里。' },
|
||||||
{ sel: '.tab-fab', t: '记一下', d: '想记点什么、找更多工具,点中间这颗按钮。' },
|
{ sel: '.tab-fab', t: '记一下', d: '想记点什么、找更多工具,点中间这颗按钮。' },
|
||||||
{ sel: '.tabbar [data-tab="me"]', t: '我的', d: '孕期档案、头像、兜豆和兑换记录都在这里。' }
|
{ sel: '.tabbar [data-tab="me"]', t: '我的', d: '孕期档案、头像、兜豆和兑换记录都在这里。' }
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -236,5 +236,5 @@
|
|||||||
}
|
}
|
||||||
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
|
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
|
||||||
if (window.GC_FEED) init();
|
if (window.GC_FEED) init();
|
||||||
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110258'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110259'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
(function () {
|
(function () {
|
||||||
var sec = document.getElementById('gcHome');
|
var sec = document.getElementById('gcHome');
|
||||||
if (!sec) return;
|
if (!sec) return;
|
||||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110258';
|
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110259';
|
||||||
document.head.appendChild(l);
|
document.head.appendChild(l);
|
||||||
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110258';
|
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110259';
|
||||||
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
|
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
|
||||||
document.body.appendChild(s);
|
document.body.appendChild(s);
|
||||||
|
|
||||||
|
|||||||
56
js/kit.css
56
js/kit.css
@@ -1,40 +1,24 @@
|
|||||||
/* 11-03 测一测 · 科普 · 计算器(替代「此刻」,见 js/kit.js) */
|
/* 11-03 孕期百宝箱:趣味小测试 · 孕期百问 · 孕期计算器(替代「此刻」,见 js/kit.js) */
|
||||||
html.has-kit #pulse{display:none!important}
|
html.has-kit #pulse{display:none!important}
|
||||||
.kit{margin:16px 0 0;padding:14px 0 2px;border-top:1px dashed rgba(220,160,140,.45)}
|
.kit{margin:16px 0 0;padding:14px 0 2px;border-top:1px dashed rgba(220,160,140,.45)}
|
||||||
.kit.hide{display:none}
|
.kit.hide{display:none}
|
||||||
.kit-hd{display:flex;align-items:center;justify-content:space-between;margin:0 0 10px}
|
.kit-hd{display:flex;align-items:baseline;gap:8px;margin:0 0 11px}
|
||||||
.kit-hd b{font-size:16px;font-weight:900;color:#2A1E1E;letter-spacing:.3px}
|
.kit-hd b{font-size:17px;font-weight:900;color:#2A1E1E;letter-spacing:.3px}
|
||||||
.kit-hd b em{font-style:normal;color:#F4593C}
|
.kit-hd span{font-size:12px;color:#A3958D;letter-spacing:.3px}
|
||||||
.kit-sw{display:inline-flex;align-items:center;gap:3px;height:26px;padding:0 10px;border:0;border-radius:99px;background:#FFF1EA;color:#D9583B;font:inherit;font-size:12px;font-weight:700;cursor:pointer}
|
.kit-g{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
|
||||||
.kit-sw svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
|
.kit-e{position:relative;display:flex;flex-direction:column;align-items:flex-start;min-width:0;padding:10px 10px 11px;border:0;border-radius:18px;text-align:left;font-family:inherit;cursor:pointer;overflow:hidden;
|
||||||
.kit-sw:active svg{transform:rotate(180deg);transition:transform .3s}
|
background:linear-gradient(165deg,var(--b1),var(--b2));box-shadow:inset 0 0 0 1px rgba(255,255,255,.75);transition:transform .14s}
|
||||||
.kit-g{display:grid;grid-template-columns:1fr 1.18fr;gap:10px}
|
.kit-e:active{transform:scale(.96)}
|
||||||
.kit-g.flip>*{animation:kitIn .42s cubic-bezier(.3,1.3,.5,1) both}
|
.kit-e img{width:58px;height:58px;margin:0 0 6px -2px;border-radius:16px;object-fit:cover;mix-blend-mode:multiply}
|
||||||
.kit-g.flip>.kit-col{animation-delay:.06s}
|
.kit-e b{font-size:14.5px;font-weight:900;color:#2A1E1E;white-space:nowrap;letter-spacing:.2px}
|
||||||
@keyframes kitIn{from{opacity:0;transform:translateY(8px) scale(.97)}}
|
.kit-e span{margin-top:3px;min-height:32px;font-size:11px;line-height:1.45;color:#7C6E68;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
||||||
.kit-k{display:inline-block;height:18px;padding:0 7px;border-radius:6px;font-size:10.5px;font-weight:800;line-height:18px;letter-spacing:.5px;color:#fff}
|
.kit-e em{margin-top:8px;display:inline-flex;align-items:center;gap:2px;height:22px;padding:0 8px;border-radius:99px;background:var(--c);color:#fff;font-style:normal;font-size:11px;font-weight:800;white-space:nowrap}
|
||||||
.kit-qz{position:relative;display:flex;flex-direction:column;align-items:flex-start;min-height:178px;padding:12px 12px 12px;border-radius:18px;overflow:hidden;text-decoration:none;
|
.kit-e em i{font-style:normal;font-size:13px;line-height:1}
|
||||||
background:linear-gradient(160deg,#F1ECFF,#E4DBFF);box-shadow:inset 0 0 0 1px rgba(255,255,255,.7)}
|
.kit-e.e-qz{--b1:#F3EEFF;--b2:#E6DDFD;--c:#7C5CFC}
|
||||||
.kit-qz .kit-k{background:#7C5CFC}
|
.kit-e.e-qa{--b1:#EAF8F3;--b2:#D8F0EA;--c:#2E9B78}
|
||||||
.kit-qt{position:relative;z-index:1;margin-top:8px;font-size:14.5px;font-weight:900;line-height:1.35;color:#2A1E1E;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
|
.kit-e.e-js{--b1:#FFF3EA;--b2:#FDE8D4;--c:#F07A2E}
|
||||||
.kit-qz small{position:relative;z-index:1;margin-top:5px;font-size:11px;font-weight:700;color:#7C5CFC}
|
|
||||||
.kit-go{position:relative;z-index:1;margin-top:auto;height:26px;padding:0 11px;border-radius:99px;display:inline-flex;align-items:center;background:#7C5CFC;color:#fff;font-size:12px;font-weight:800;box-shadow:0 4px 10px -4px rgba(124,92,252,.7)}
|
|
||||||
.kit-go::after{content:"›";margin-left:3px;font-size:14px}
|
|
||||||
.kit-qz img{position:absolute;right:-10px;bottom:-8px;width:84px;height:84px;object-fit:cover;border-radius:50%;opacity:.95;box-shadow:0 0 0 4px rgba(255,255,255,.55)}
|
|
||||||
.kit-col{display:flex;flex-direction:column;gap:10px;min-width:0}
|
|
||||||
.kit-r{flex:1;display:flex;align-items:center;gap:9px;min-height:84px;padding:10px 10px 10px 8px;border-radius:16px;text-decoration:none;min-width:0}
|
|
||||||
.kit-r.kp{background:linear-gradient(150deg,#E6F6F0,#D8F0EA)}
|
|
||||||
.kit-r.js{background:linear-gradient(150deg,#FFF1E6,#FDE8D4)}
|
|
||||||
.kit-r img{flex:none;width:52px;height:52px;border-radius:14px;object-fit:cover}
|
|
||||||
.kit-rt{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
|
|
||||||
.kit-r.kp .kit-k{background:#2E9B78}
|
|
||||||
.kit-r.js .kit-k{background:#F07A2E}
|
|
||||||
.kit-rt b{margin-top:4px;font-size:13px;font-weight:800;line-height:1.35;color:#2A1E1E;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
||||||
.kit-rt small{margin-top:2px;font-size:10.5px;font-weight:700;color:#A3958D}
|
|
||||||
.kit a:active{transform:scale(.97);transition:transform .12s}
|
|
||||||
html.night .kit{border-color:rgba(255,255,255,.1)}
|
html.night .kit{border-color:rgba(255,255,255,.1)}
|
||||||
html.night .kit-hd b,html.night .kit-qt,html.night .kit-rt b{color:#F1E6EE}
|
html.night .kit-hd b,html.night .kit-e b{color:#F1E6EE}
|
||||||
html.night .kit-qz{background:linear-gradient(160deg,#3A3150,#2F2842)}
|
html.night .kit-e span{color:#B9A9B2}
|
||||||
html.night .kit-r.kp{background:linear-gradient(150deg,#22392F,#1E332B)}
|
html.night .kit-e{background:rgba(255,255,255,.06);box-shadow:none}
|
||||||
html.night .kit-r.js{background:linear-gradient(150deg,#3E2E22,#36281E)}
|
html.night .kit-e img{mix-blend-mode:normal}
|
||||||
html.night .kit-sw{background:rgba(255,255,255,.08);color:#F2A08A}
|
|
||||||
|
|||||||
110
js/kit.js
110
js/kit.js
@@ -1,90 +1,46 @@
|
|||||||
/* 11-03 用户:「把此刻那个板块改成测一测、科普、还有计算器,你看一下怎么设计替代此刻的模块」(先在预览改)
|
/* 11-03 用户:「把此刻那个板块改成测一测、科普、还有计算器」(先在预览改)
|
||||||
→ 位置不变(「我的孕期工具」卡底部,原 #pulse 处),版式:左边一张大的「测一测」+ 右边上下两条「科普」「计算器」,内容按孕周换:
|
二改(同日):「不是进去测一个,而是进去之后是列表页……名字改改,要不大家也不知道测一测是啥」
|
||||||
· 测一测:广场测一测 30 个里挑孕期能测的,按孕周段分池,每天轮换一个(北京日期);
|
→ 位置不变(「我的孕期工具」卡底部,原 #pulse 处),叫「孕期百宝箱」,一排三个入口,各进各的列表页:
|
||||||
· 科普:问题库 hot.json 按孕周段(同「其他孕妈也在搜」qaPick),跳过下面列表已经露出的前 6 条和测试 / 计算器题;
|
· 趣味小测试 → 孕妈广场「测一测」列表(guangchang/?c=ceshi,30 个测试)
|
||||||
· 计算器:生娃计算器(topic/huafei)、产假天数计算器(topic/zhichang),孕 29 周起产假排前面。
|
· 孕期百问 → 首页全部问题页(app.js openQA,标题换成「孕期百问」,按孕周排)
|
||||||
右上「换一换」三格一起换下一组。人数同首页口径:测一测 = 测一测页的 gcTested;科普 / 计算器 = 「此刻」总人数 × heat(模拟数,AGENTS.md 12b)。
|
· 孕期计算器 → topic/jisuan/(新做的列表页:生娃花费、产假天数、胎儿体重、孕期增重)
|
||||||
原「此刻」#pulse 只是藏起来(kit.css),JS 照跑(别的地方要用它的总人数);地址带 ?kit=0 可看回旧版对比。 */
|
原「此刻」#pulse 只是藏起来(kit.css),JS 照跑(别的地方要用它的总人数);地址带 ?kit=0 可看回旧版对比。 */
|
||||||
(function () {
|
(function () {
|
||||||
if (/[?&]kit=0(?:&|$)/.test(location.search)) return;
|
if (/[?&]kit=0(?:&|$)/.test(location.search)) return;
|
||||||
var box = document.getElementById('kit');
|
var box = document.getElementById('kit');
|
||||||
if (!box) return;
|
if (!box) return;
|
||||||
var V = '26110258';
|
var V = '26110259';
|
||||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/kit.css?v=' + V; document.head.appendChild(l);
|
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/kit.css?v=' + V; document.head.appendChild(l);
|
||||||
document.documentElement.classList.add('has-kit');
|
document.documentElement.classList.add('has-kit');
|
||||||
|
|
||||||
function esc(t) { return String(t == null ? '' : t).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
function cleanQ(extra) {
|
||||||
function href(h) { return h + location.search + location.hash; }
|
var q = new URLSearchParams(location.search);
|
||||||
function testURL(id) { var q = new URLSearchParams(location.search); q.set('id', id); return 'guangchang/ceshi/?' + q.toString() + location.hash; }
|
['t', 'n', 'c', 'id', 'mine', 'write', 'fav', 'kit'].forEach(function (k) { q.delete(k); });
|
||||||
function wan(n) { return n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : String(Math.round(n)); }
|
if (extra) Object.keys(extra).forEach(function (k) { q.set(k, extra[k]); });
|
||||||
function total() { var p = window.__mbPulse; return (p && p.total && +p.total.value) || 1510000; }
|
var s = q.toString(); return (s ? '?' + s : '') + location.hash;
|
||||||
var day = Math.floor((Date.now() + 288e5) / 864e5), shift = 0;
|
}
|
||||||
|
var E = [
|
||||||
/* 测一测:按孕周段分池(段同 qaBand:1 ≤8 / 2 ≤13 / 3 ≤20 / 4 ≤28 / 5 ≤36 / 6 37+;0 = 没孕周 / 产后) */
|
{ k: 'qz', n: '趣味小测试', d: '1 分钟出结果,测测你是哪种孕妈', c: '30 个测试', img: 'ceshi' },
|
||||||
var QZ_POOL = {
|
{ k: 'qa', n: '孕期百问', d: '孕妈最常问的问题,一次看明白', c: '100 个问题', img: 'kepu' },
|
||||||
0: ['t11', 't14', 't13', 't16', 't18', 't23', 't03', 't22'],
|
{ k: 'js', n: '孕期计算器', d: '花多少钱、休几天产假,算一算', c: '4 个计算器', img: 'jisuan' }
|
||||||
1: ['t17', 't01', 't25', 't24', 't02', 't11'],
|
|
||||||
2: ['t17', 't01', 't25', 't24', 't02', 't11'],
|
|
||||||
3: ['t24', 't25', 't01', 't17', 't21', 't02'],
|
|
||||||
4: ['t24', 't21', 't25', 't01', 't02', 't17'],
|
|
||||||
5: ['t05', 't21', 't02', 't24', 't03', 't25'],
|
|
||||||
6: ['t05', 't03', 't02', 't06', 't21', 't25']
|
|
||||||
};
|
|
||||||
var CALC = [
|
|
||||||
{ t: '生娃要花多少钱?一键算清', s: '产检 · 分娩 · 月子 · 第一年', h: 'topic/huafei/', heat: .118 },
|
|
||||||
{ t: '产假能休多少天?算一算', s: '按地区和生产情况算', h: 'topic/zhichang/', heat: .062 }
|
|
||||||
];
|
];
|
||||||
var QA = null;
|
box.innerHTML = '<div class="kit-hd"><b>孕期百宝箱</b><span>测一测 · 查一查 · 算一算</span></div><div class="kit-g">' +
|
||||||
fetch('assets/data/qa/hot.json?v=' + V).then(function (r) { return r.ok ? r.json() : []; }).catch(function () { return []; })
|
E.map(function (x) {
|
||||||
.then(function (a) { QA = Array.isArray(a) ? a : []; render(); });
|
return '<button type="button" class="kit-e e-' + x.k + '" data-k="' + x.k + '"><img src="assets/img/kit/' + x.img + '.webp" alt="" decoding="async">' +
|
||||||
if (!window.GC_TESTS_META) {
|
'<b>' + x.n + '</b><span>' + x.d + '</span><em>' + x.c + '<i aria-hidden="true">›</i></em></button>';
|
||||||
var s = document.createElement('script'); s.src = 'guangchang/ceshi/meta.js?v=' + V; s.onload = s.onerror = render; document.body.appendChild(s);
|
}).join('') + '</div>';
|
||||||
}
|
|
||||||
|
|
||||||
function band() {
|
|
||||||
var p = window.__mbPreg || {};
|
|
||||||
if (p.postpartum || !p.week) return 0;
|
|
||||||
return window.__mbQaBand ? window.__mbQaBand(p.week) : 0;
|
|
||||||
}
|
|
||||||
function pickQz(b) {
|
|
||||||
var meta = window.GC_TESTS_META || [], pool = (QZ_POOL[b] || QZ_POOL[0]).map(function (id) { return meta.filter(function (x) { return x.id === id; })[0]; }).filter(Boolean);
|
|
||||||
return pool.length ? pool[(day + shift) % pool.length] : null;
|
|
||||||
}
|
|
||||||
function pickKp(b) {
|
|
||||||
if (!QA || !QA.length) return null;
|
|
||||||
var w = (window.__mbPreg || {}).week, skip = ['topic/huafei/', 'topic/ceshi/', 'topic/duiyou/', 'topic/zhichang/'];
|
|
||||||
var shown = window.__mbQaPick ? window.__mbQaPick(QA, b ? w : 0, 6) : [];
|
|
||||||
var all = window.__mbQaPick ? window.__mbQaPick(QA, b ? w : 0, 30) : QA;
|
|
||||||
var l = all.filter(function (x) { return x.href && skip.indexOf(x.href) < 0 && shown.indexOf(x) < 0; });
|
|
||||||
return l.length ? l[shift % l.length] : null;
|
|
||||||
}
|
|
||||||
function render() {
|
|
||||||
var b = band(), qz = pickQz(b), kp = pickKp(b);
|
|
||||||
var cl = b >= 5 ? [CALC[1], CALC[0]] : CALC, ca = cl[shift % cl.length];
|
|
||||||
var p = window.__mbPreg || {}, wk = p.week && !p.postpartum ? '孕 ' + p.week + ' 周' : '';
|
|
||||||
var h = '<div class="kit-hd"><b>' + (wk ? '<em>' + wk + '</em> · ' : '') + '今天看点什么</b>' +
|
|
||||||
'<button type="button" class="kit-sw" aria-label="换一组"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12a8 8 0 0113.7-5.6L20 8.5M20 4v4.5h-4.5M20 12a8 8 0 01-13.7 5.6L4 15.5M4 20v-4.5h4.5"/></svg>换一换</button></div>';
|
|
||||||
h += '<div class="kit-g">';
|
|
||||||
if (qz) {
|
|
||||||
var n = window.gcTestedText ? window.gcTestedText(qz.id) : '';
|
|
||||||
h += '<a class="kit-qz" href="' + esc(testURL(qz.id)) + '"><span class="kit-k">测一测</span><b class="kit-qt">' + esc(qz.title) + '</b>' +
|
|
||||||
'<small>' + esc(n || (qz.n + ' 道题')) + '</small><span class="kit-go">去测一测</span>' +
|
|
||||||
'<img src="guangchang/ceshi/img/' + qz.id + '_s.webp" alt="" loading="lazy" decoding="async"></a>';
|
|
||||||
}
|
|
||||||
h += '<div class="kit-col">';
|
|
||||||
if (kp) h += '<a class="kit-r kp" href="' + esc(href(kp.href)) + '"><img src="assets/img/kit/kepu.webp" alt="" loading="lazy"><span class="kit-rt"><span class="kit-k">科普</span><b>' + esc(kp.q) + '</b>' +
|
|
||||||
'<small>' + wan(total() * (+kp.heat || .03)) + '人看过</small></span></a>';
|
|
||||||
h += '<a class="kit-r js" href="' + esc(href(ca.h)) + '"><img src="assets/img/kit/jisuan.webp" alt="" loading="lazy"><span class="kit-rt"><span class="kit-k">计算器</span><b>' + esc(ca.t) + '</b>' +
|
|
||||||
'<small>' + wan(total() * ca.heat) + '人算过</small></span></a>';
|
|
||||||
h += '</div></div>';
|
|
||||||
box.innerHTML = h;
|
|
||||||
box.classList.remove('hide');
|
box.classList.remove('hide');
|
||||||
}
|
/* 个数跟着真实数据走(测试表 / 问题库加载到了就换真数) */
|
||||||
|
function setCnt(k, t) { var e = box.querySelector('.e-' + k + ' em'); if (e) e.firstChild.nodeValue = t; }
|
||||||
|
if (window.GC_TESTS_META) setCnt('qz', window.GC_TESTS_META.length + ' 个测试');
|
||||||
|
fetch('assets/data/qa/hot.json?v=' + V).then(function (r) { return r.ok ? r.json() : []; }).then(function (a) { if (a && a.length) setCnt('qa', a.length + ' 个问题'); }).catch(function () {});
|
||||||
|
|
||||||
box.addEventListener('click', function (e) {
|
box.addEventListener('click', function (e) {
|
||||||
if (!e.target.closest('.kit-sw')) return;
|
var b = e.target.closest('.kit-e'); if (!b) return;
|
||||||
shift++; render();
|
try { navigator.vibrate && navigator.vibrate(8); } catch (x) {}
|
||||||
var g = box.querySelector('.kit-g'); if (g) { g.classList.remove('flip'); void g.offsetWidth; g.classList.add('flip'); }
|
var k = b.dataset.k;
|
||||||
|
if (k === 'qz') location.href = 'guangchang/' + cleanQ({ c: 'ceshi' });
|
||||||
|
else if (k === 'js') location.href = 'topic/jisuan/' + cleanQ();
|
||||||
|
else if (window.__mbOpenQA) window.__mbOpenQA('孕期百问');
|
||||||
});
|
});
|
||||||
window.addEventListener('mb-preg', render);
|
|
||||||
render();
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
function getJSON(u) { return fetch(u, { cache: 'no-cache' }).then(function (r) { if (!r.ok) throw r.status; return r.json(); }); }
|
function getJSON(u) { return fetch(u, { cache: 'no-cache' }).then(function (r) { if (!r.ok) throw r.status; return r.json(); }); }
|
||||||
|
|
||||||
function related(box) {
|
function related(box) {
|
||||||
getJSON('../_shared/idx.json?v=26110258').then(function (idx) {
|
getJSON('../_shared/idx.json?v=26110259').then(function (idx) {
|
||||||
var me = null; idx.forEach(function (x) { if (x[0] === SLUG) me = x; });
|
var me = null; idx.forEach(function (x) { if (x[0] === SLUG) me = x; });
|
||||||
var tag = me ? me[2] : '', h = 0; for (var i = 0; i < SLUG.length; i++) h = (h * 31 + SLUG.charCodeAt(i)) >>> 0;
|
var tag = me ? me[2] : '', h = 0; for (var i = 0; i < SLUG.length; i++) h = (h * 31 + SLUG.charCodeAt(i)) >>> 0;
|
||||||
var rest = idx.filter(function (x) { return x[0] !== SLUG; });
|
var rest = idx.filter(function (x) { return x[0] !== SLUG; });
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
}
|
}
|
||||||
fetch(API + '/comments?kind=topic&target=' + encodeURIComponent(SLUG) + (OID ? '&openid=' + encodeURIComponent(OID) : ''))
|
fetch(API + '/comments?kind=topic&target=' + encodeURIComponent(SLUG) + (OID ? '&openid=' + encodeURIComponent(OID) : ''))
|
||||||
.then(function (r) { return r.json(); }).then(function (j) { if (j && j.code === 200) { RC = j.result; paint(); } }).catch(function () {});
|
.then(function (r) { return r.json(); }).then(function (j) { if (j && j.code === 200) { RC = j.result; paint(); } }).catch(function () {});
|
||||||
getJSON('../_shared/cm/' + SLUG + '.json?v=26110258').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); });
|
getJSON('../_shared/cm/' + SLUG + '.json?v=26110259').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
function extras(el) {
|
function extras(el) {
|
||||||
|
|||||||
116
topic/jisuan/index.html
Normal file
116
topic/jisuan/index.html
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<!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>
|
||||||
|
<!-- 11-03 首页「测一测 · 科普 · 计算器」模块(js/kit.js)里「孕期计算器」入口的列表页。
|
||||||
|
用户:「这几个模块不是进去测一个,而是进去之后是列表页」。测试 / 科普已有列表(广场测一测、全部问题),计算器原来没有,这页补上。
|
||||||
|
条目:专题页里带计算器的(生娃花费 topic/huafei、产假天数 topic/zhichang)+ 会算数的孕期工具(胎儿估重、孕期体重管理)。
|
||||||
|
跳转一律同源相对路径,带回 search + hash(openid);胎儿估重孕 15 周前提示(同首页 STAGE_GATE)。自成一页,不引 app.js。 -->
|
||||||
|
<style>
|
||||||
|
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
|
||||||
|
html,body{height:100%;overflow:hidden;background:#FFF8F3;color:#4E5969;font:15px/1.6 -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))}
|
||||||
|
button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||||
|
.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);transition:background .2s}
|
||||||
|
.bar.on{background:#FFF8F3;box-shadow:0 1px 0 #F3E6DC}
|
||||||
|
.bar .back{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:#1F2329}
|
||||||
|
.bar .back svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
|
||||||
|
.bar .t{font-weight:700;font-size:16px;color:#1F2329;opacity:0;transition:opacity .2s}
|
||||||
|
.bar.on .t{opacity:1}
|
||||||
|
.hero{position:relative;margin-top:-48px;padding:64px 20px 22px;background:linear-gradient(165deg,#FFE6D4 0%,#FFF8F3 78%);overflow:hidden}
|
||||||
|
.hero img{position:absolute;right:6px;top:44px;width:132px;height:132px;border-radius:30px;mix-blend-mode:multiply}
|
||||||
|
.hero small{display:inline-block;padding:2px 9px;border-radius:99px;background:#F07A2E;color:#fff;font-size:11.5px;font-weight:800;letter-spacing:.5px}
|
||||||
|
.hero h1{margin-top:10px;font-size:28px;font-weight:900;color:#1F2329;line-height:1.25}
|
||||||
|
.hero p{margin-top:6px;max-width:60%;font-size:13.5px;color:#7A6A60}
|
||||||
|
.list{display:flex;flex-direction:column;gap:12px;padding:6px 16px 0}
|
||||||
|
.it{position:relative;display:flex;align-items:center;gap:13px;padding:15px 14px;border-radius:20px;background:#fff;text-decoration:none;box-shadow:0 6px 18px -10px rgba(160,90,50,.28);transition:transform .14s}
|
||||||
|
.it:active{transform:scale(.98)}
|
||||||
|
.ic{flex:none;width:54px;height:54px;border-radius:16px;display:grid;place-items:center;background:var(--bg)}
|
||||||
|
.ic svg{width:28px;height:28px;fill:none;stroke:var(--c);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
|
||||||
|
.ic img{width:38px;height:38px;object-fit:contain}
|
||||||
|
.tx{flex:1;min-width:0}
|
||||||
|
.tx b{display:flex;align-items:center;gap:6px;font-size:16px;font-weight:800;color:#1F2329}
|
||||||
|
.tx b i{font-style:normal;font-size:10.5px;font-weight:800;padding:1px 6px;border-radius:6px;background:var(--bg);color:var(--c)}
|
||||||
|
.tx p{margin-top:2px;font-size:12.5px;color:#7A6A60;line-height:1.5}
|
||||||
|
.tx small{display:block;margin-top:4px;font-size:11.5px;font-weight:700;color:var(--c)}
|
||||||
|
.go{flex:none;height:30px;padding:0 13px;border-radius:99px;display:inline-flex;align-items:center;background:var(--c);color:#fff;font-size:13px;font-weight:800}
|
||||||
|
.it.lk{opacity:.6}
|
||||||
|
.it.lk .go{background:#C9BDB6}
|
||||||
|
.more{margin:22px 16px 0;padding:14px;border-radius:16px;background:rgba(240,122,46,.07);text-align:center;font-size:12.5px;color:#A08878}
|
||||||
|
.toast{position:fixed;left:50%;bottom:calc(40px + env(safe-area-inset-bottom));z-index:50;transform:translate(-50%,10px);max-width:80%;padding:10px 16px;border-radius:12px;background:rgba(31,35,41,.86);color:#fff;font-size:13.5px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}
|
||||||
|
.toast.on{opacity:1;transform:translate(-50%,0)}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="scroll">
|
||||||
|
<header class="bar" id="bar">
|
||||||
|
<button class="back" id="back" aria-label="返回"><svg viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></svg></button>
|
||||||
|
<span class="t">孕期计算器</span>
|
||||||
|
</header>
|
||||||
|
<section class="hero">
|
||||||
|
<img src="../../assets/img/kit/jisuan.webp" alt="">
|
||||||
|
<small>算一算</small>
|
||||||
|
<h1>孕期计算器</h1>
|
||||||
|
<p>花多少钱、休几天产假、宝宝多重,算明白心里才有底</p>
|
||||||
|
</section>
|
||||||
|
<div class="list" id="list"></div>
|
||||||
|
<div class="more">更多计算器陆续上线中</div>
|
||||||
|
</div>
|
||||||
|
<div class="toast" id="toast"></div>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
var $ = function (s) { return document.querySelector(s); };
|
||||||
|
function href(u) { return u + (location.search || '') + (location.hash || ''); }
|
||||||
|
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
||||||
|
/* 人数口径同首页:「此刻」总人数(默认 151 万)× 固定比例,模拟数(AGENTS.md 12b) */
|
||||||
|
var TOT = 1510000;
|
||||||
|
function wan(n) { return n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : String(Math.round(n)); }
|
||||||
|
var week = 0;
|
||||||
|
try { var g = JSON.parse(localStorage.getItem('mmbox.gcwk.v1') || 'null'); week = g && !g.pp ? +g.w || 0 : 0; } catch (e) {}
|
||||||
|
var SV = {
|
||||||
|
money: '<svg viewBox="0 0 24 24"><rect x="5" y="3" width="14" height="18" rx="3"/><path d="M8.5 7h7M8.5 11h1M12 11h1M15.5 11h0M8.5 14.5h1M12 14.5h1M8.5 18h1M12 18h1M15.5 14.5v3.5"/></svg>',
|
||||||
|
cal: '<svg viewBox="0 0 24 24"><rect x="3.5" y="5" width="17" height="15.5" rx="3"/><path d="M8 3v4M16 3v4M3.5 10h17M8 14h3M8 17h6"/></svg>'
|
||||||
|
};
|
||||||
|
var L = [
|
||||||
|
{ n: '生娃花费计算器', tag: '最多人用', d: '产检、分娩、月子、宝宝第一年,一共要花多少钱', u: '../huafei/', heat: .118, c: '#F07A2E', bg: '#FFF0E4', ic: SV.money },
|
||||||
|
{ n: '产假天数计算器', d: '能休几天、哪天开始休、哪天回去上班', u: '../zhichang/', heat: .062, c: '#5B6CFF', bg: '#EEF0FF', ic: SV.cal },
|
||||||
|
{ n: '胎儿体重估算', d: '填 B 超上的几个数,估宝宝现在多重', u: '/taier-guzhong/', heat: .071, c: '#2E9B78', bg: '#E6F6F0', img: '/upload/picture/715333a69fb67d8812ab093f342fa00f.png', gate: 15 },
|
||||||
|
{ n: '孕期增重计算', d: '按孕前身高体重,算你整个孕期该长多少斤', u: '/yunqi-tizhong/', heat: .083, c: '#E25C7A', bg: '#FFECEF', img: '/upload/picture/a6d7e61edee2ff0395cf00587a7c4036.svg' }
|
||||||
|
];
|
||||||
|
$('#list').innerHTML = L.map(function (x, i) {
|
||||||
|
var lk = x.gate && week && week < x.gate;
|
||||||
|
return '<a class="it' + (lk ? ' lk' : '') + '" data-i="' + i + '" href="' + esc(href(x.u)) + '" style="--c:' + x.c + ';--bg:' + x.bg + '">' +
|
||||||
|
'<span class="ic">' + (x.img ? '<img src="' + esc(x.img) + '" alt="">' : x.ic) + '</span>' +
|
||||||
|
'<span class="tx"><b>' + esc(x.n) + (x.tag ? '<i>' + esc(x.tag) + '</i>' : '') + (lk ? '<i>孕' + x.gate + '周开放</i>' : '') + '</b><p>' + esc(x.d) + '</p><small>' + wan(TOT * x.heat) + '人算过</small></span>' +
|
||||||
|
'<span class="go">去算</span></a>';
|
||||||
|
}).join('');
|
||||||
|
var tt = 0;
|
||||||
|
function toast(t) { var e = $('#toast'); e.textContent = t; e.classList.add('on'); clearTimeout(tt); tt = setTimeout(function () { e.classList.remove('on'); }, 2200); }
|
||||||
|
$('#list').addEventListener('click', function (e) {
|
||||||
|
var a = e.target.closest('.it'); if (!a || !a.classList.contains('lk')) return;
|
||||||
|
e.preventDefault();
|
||||||
|
var x = L[+a.dataset.i]; toast(x.n + '孕 ' + x.gate + ' 周以后开放,你现在孕 ' + week + ' 周,还用不到哦');
|
||||||
|
});
|
||||||
|
/* 返回:从首页点进来就 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 sc = $('#scroll'), bar = $('#bar');
|
||||||
|
sc.addEventListener('scroll', function () { bar.classList.toggle('on', sc.scrollTop > 40); }, { 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>
|
||||||
Reference in New Issue
Block a user