v26110290 百问:序号在上关键词块在下、分类标签图标扁平化;百宝箱百问滚动去掉「转给老公」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-04 02:13:01 +00:00
parent d6da67ea65
commit 265ad98d7c
9 changed files with 62 additions and 32 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110289';
var VER = '26110290';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -5627,6 +5627,22 @@
'脐带绕颈怎么办?': '脐带绕颈', '什么时候开始休产假?': '休产假', '要不要请月嫂?怎么选?': '月嫂',
'宝宝衣物用品要买多少?': '宝宝衣物', '侧切、撕裂能避免吗?': '侧切', '催产怎么做?疼吗?': '催产'
};
const QA_IC = {
全部: '<path d="M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z"/>',
孕周: '<path d="M12 3a9 9 0 110 18 9 9 0 010-18zm-1 4v6l5 3 1-1.6-4-2.4V7z"/>',
身体: '<circle cx="12" cy="5" r="2.6"/><path d="M8.6 9h4.2c3.4 0 5.7 2.4 5.7 5.3 0 2.5-1.9 4.2-4.3 4.2H13V22h-3v-5.5L8 15V10z"/>',
准备: '<path d="M9 3h6v2h3a1 1 0 011 1v15a1 1 0 01-1 1H6a1 1 0 01-1-1V6a1 1 0 011-1h3zM8 11h8v-2H8zm0 4h8v-2H8zm0 4h5v-2H8z"/>',
产检: '<path d="M10 3h4v7h7v4h-7v7h-4v-7H3v-4h7z"/>',
宝宝: '<path d="M12 3a9 9 0 110 18 9 9 0 010-18zM9 10.2a1.2 1.2 0 100 2.4 1.2 1.2 0 000-2.4zm6 0a1.2 1.2 0 100 2.4 1.2 1.2 0 000-2.4zM9 15.2c1.7 1.6 4.3 1.6 6 0l-1-1c-1.1 1-2.9 1-4 0z" fill-rule="evenodd"/>',
生活: '<path d="M12 3l9 8h-2.5v10h-5v-6h-3v6h-5V11H3z"/>',
营养: '<path d="M15 2.5c.3 1.9-.6 3.4-2.2 4.2C12 5.4 12.3 3.4 15 2.5zM12 7.8c1.3-1 2.8-1.4 4.2-1.1 2.6.5 3.8 3.1 3.6 6-.3 4.2-3 8.3-5.4 8.3-.9 0-1.6-.5-2.4-.5s-1.5.5-2.4.5c-2.4 0-5.1-4.1-5.4-8.3-.2-2.9 1-5.5 3.6-6 1.4-.3 2.9.1 4.2 1.1z"/>',
职场: '<path d="M9 4h6a1 1 0 011 1v2h4a1 1 0 011 1v11a1 1 0 01-1 1H4a1 1 0 01-1-1V8a1 1 0 011-1h4V5a1 1 0 011-1zm1 3h4V6h-4z"/>',
花钱: '<path d="M12 3a9 9 0 110 18 9 9 0 010-18zm-2.6 4.5L8.2 8.6 10.6 11H8.5v1.6H11v1.2H8.5v1.6H11V18h2v-2.6h2.5v-1.6H13v-1.2h2.5V11h-2.1l2.4-2.4-1.2-1.1L12 10.1z" fill-rule="evenodd"/>',
心情: '<path d="M12 20.5s-8-4.8-9.5-9.8C1.5 7.2 3.8 4 7.2 4c2 0 3.7 1.1 4.8 2.7C13.1 5.1 14.8 4 16.8 4c3.4 0 5.7 3.2 4.7 6.7-1.5 5-9.5 9.8-9.5 9.8z"/>',
趣味: '<path d="M12 2.8l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 16.8l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/>',
补剂: '<path d="M3.8 13.6l6.4-6.4a4.5 4.5 0 016.4 6.4l-6.4 6.4a4.5 4.5 0 01-6.4-6.4zm7.8-5l-3.5 3.5 4.3 4.3 3.5-3.5a3 3 0 00-4.3-4.3z" fill-rule="evenodd"/>',
专题: '<path d="M6 3h12a1 1 0 011 1v17l-7-4-7 4V4a1 1 0 011-1z"/>'
};
const QA_TC = { 身体: 'c1', 准备: 'c2', 产检: 'c3', 宝宝: 'c4', 生活: 'c5', 营养: 'c6', 职场: 'c2', 花钱: 'c6', 心情: 'c1', 趣味: 'c4', 补剂: 'c3', 专题: 'c5' };
$('#qaTopic').classList.add('hide');
const inBand = x => !!(band && x.st && x.st.indexOf(band) >= 0);
@@ -5641,7 +5657,9 @@
['全部'].concat(cats).forEach(c => {
const b = document.createElement('button');
b.type = 'button'; b.className = 'qa-cat'; b.dataset.cat = c;
b.textContent = c === '__st' ? '⏳ 孕 ' + state.week + ' 周' : c === '全部' ? '✨ 全部' : (QA_EM[c] ? QA_EM[c] + ' ' : '') + c;
/* 11-04 用户:「标签前面的小图标全部扁平化」→ emoji 换成实心单色 SVG(QA_IC),颜色跟分类彩签同色,选中时变白 */
const ik = c === '__st' ? '孕周' : c;
b.innerHTML = (QA_IC[ik] ? '<svg class="qa-ci ' + (QA_TC[c] || 'c0') + '" viewBox="0 0 24 24" aria-hidden="true">' + QA_IC[ik] + '</svg>' : '') + (c === '__st' ? '孕 ' + state.week + ' 周' : c);
b.addEventListener('click', () => qaFilter(c));
cb.appendChild(b);
});
@@ -5650,7 +5668,7 @@
const sec = (t, d) => { const h = document.createElement('div'); h.className = 'qa-sec'; h.innerHTML = '<b>' + t + '</b><small>' + d + '</small>'; L.appendChild(h); };
const snip = a => (a || '').replace(/\s+/g, ' ').trim();
order.forEach((x, i) => {
if (i === 0) sec('🔥 本周热问', '看的人最多的 3 个问题');
if (i === 0) sec('<svg class="qa-fi" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 21c-4 0-6.5-2.7-6.5-6.2 0-3.6 2.9-5.6 3.6-9.3 2.6 1.4 3.6 3.6 3.6 5.4 1-.6 1.6-1.8 1.7-3 2.4 1.9 4.1 4.3 4.1 7 0 3.5-2.5 6.1-6.5 6.1z"/></svg>本周热问', '看的人最多的 3 个问题');
if (i === 3) sec('全部问题', '点开就有答案');
const it = document.createElement('div');
it.className = 'qa-it' + (i < 3 ? ' t3 r' + (i + 1) : '');
@@ -5680,7 +5698,10 @@
const bd = QA_BD(i), g = document.createElement('span');
if (bd) { g.className = 'qa-bd ' + bd[1]; g.textContent = bd[0]; }
const ch = document.createElement('i'); ch.className = 'qa-ch'; ch.textContent = '›';
h.appendChild(no); if (it._kw) h.appendChild(it._kw); h.appendChild(t); if (g.textContent) h.appendChild(g); h.appendChild(ch);
/* 11-04 用户:「序号在上、关键词块在下,右边放标题」→ 有关键词的条目左边是一竖列(序号 + 关键词块) */
if (it._kw) { const col = document.createElement('span'); col.className = 'qa-lc'; col.appendChild(no); col.appendChild(it._kw); h.appendChild(col); }
else 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 个)点了直接进专题页 */