v26110286 孕期百问前10条加关键词方块(分类同色系),试看效果

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-04 01:56:37 +00:00
parent a6e9ddaf5d
commit 95a4255904
9 changed files with 47 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110285';
var VER = '26110286';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -5611,6 +5611,11 @@
$('#qaHeroD').innerHTML = '<span class="qa-avs">' + [0, 1, 2, 3, 4].map(i => avaImg(AVA_TOP[(s0 + i * 2) % AVA_TOP.length])).join('') + '</span>' + wan(tot * 0.62) + ' 孕妈在这找答案';
const QA_BD = i => i < 1 ? ['爆', 'bao'] : i < 7 ? ['热', 're'] : i < 10 ? ['新', 'xin'] : null;
const QA_EM = { 身体: '🤰', 准备: '📋', 产检: '🩺', 宝宝: '👶', 生活: '🏠', 营养: '🥗', 职场: '💼', 花钱: '💰', 心情: '💗', 趣味: '🎈', 补剂: '💊', 专题: '📌' };
const QA_KW = {
'生娃计算器,到底要花多少钱?': '生娃花费', '大排畸什么时候做?能看出什么?': '大排畸', '糖耐怎么做?没过怎么办?': '糖耐',
'四维彩超有必要做吗?': '四维彩超', '胎动多少算正常?怎么数?': '数胎动', '妊娠期糖尿病要紧吗?怎么控糖?': '孕期控糖',
'肚子发紧是宫缩吗?': '宫缩', 'B 超说宝宝偏大或偏小,怎么办?': '胎儿大小', '孕期腿抽筋怎么办?': '抽筋', '糖耐前一天怎么吃?': '糖耐饮食'
};
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);
@@ -5642,6 +5647,14 @@
if (inBand(x)) it.dataset.st = '1';
const h = document.createElement('button'); h.type = 'button'; h.className = 'qa-q';
const no = document.createElement('i'); no.className = 'qa-no'; no.textContent = i < 9 ? '0' + (i + 1) : i + 1;
/* 11-04 用户:「全是字,从标题里提炼 2~4 个核心字做成前面的小图标,扫一眼就知道讲啥」→ 先做孕 26 周前 10 条看效果(QA_KW),
有关键词的条目把序号换成关键词方块(底色 / 字色跟分类彩签同色系),前 3 条右上角带名次小圆点;没配关键词的照旧显示序号 */
const kw = QA_KW[x.q];
if (kw) {
it.classList.add('kw');
no.className = 'qa-kw ' + (QA_TC[x.tag] || 'c5') + ' n' + kw.length;
no.innerHTML = '<span>' + (kw.length === 4 ? kw.slice(0, 2) + '<br>' + kw.slice(2) : kw) + '</span>' + (i < 3 ? '<b class="qa-rk r' + (i + 1) + '">' + (i + 1) + '</b>' : '');
}
const t = document.createElement('span'); t.className = 'qa-m';
const tq = document.createElement('span'); tq.className = 'qa-tx'; tq.textContent = x.q; t.appendChild(tq);
const mt = document.createElement('span'); mt.className = 'qa-mt';

View File

@@ -231,5 +231,5 @@
}
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
if (window.GC_FEED) init();
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110285'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110286'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
})();

View File

@@ -6,9 +6,9 @@
(function () {
var sec = document.getElementById('gcHome');
if (!sec) return;
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110285';
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110286';
document.head.appendChild(l);
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110285';
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110286';
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
document.body.appendChild(s);

View File

@@ -9,7 +9,7 @@
if (/[?&]kit=0(?:&|$)/.test(location.search)) return;
var box = document.getElementById('kit'), sec = document.getElementById('kitHome');
if (!box || !sec) return;
var V = '26110285';
var V = '26110286';
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');