diff --git a/guangchang/ceshi/index.html b/guangchang/ceshi/index.html index f688c90..c28194c 100644 --- a/guangchang/ceshi/index.html +++ b/guangchang/ceshi/index.html @@ -367,8 +367,8 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
- - + + - - - + + + + + - + - + - + diff --git a/js/app.js b/js/app.js index f929c78..dcd0c18 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26110265'; + var VER = '26110266'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -5509,6 +5509,10 @@ return out.slice(0, n); } window.__mbQaPick = qaPick; window.__mbQaBand = qaBand; + /* 11-03 用户:「孕期百问观看人数有点少」→ 单条「N 人看过」= 总人数 × heat × 3.6(约 12 万~64 万,仍低于百宝箱入口「孕期百问 93.6 万人看过」)。模拟数,AGENTS.md 12b,12-31 复核 */ + const QA_K = 3.6; + const qaViews = h => ((window.__mbPulse && window.__mbPulse.total && +window.__mbPulse.total.value) || 1510000) * (+h || 0) * QA_K; + window.__mbQaViews = qaViews; const MS_FIRE = ''; const MS_FIRE_W = ''; function msHeat() { @@ -5579,14 +5583,17 @@ ⚠️ band 必须在用它的标题之前声明(11-02 曾写反 → const 暂时性死区报错,「查看全部」点了没反应) */ const band = (state.postpartum || state.pregEmpty) ? 0 : qaBand(state.week); $('#qaTitle').textContent = '其他孕妈也在搜'; - $('#qaHeroW').textContent = band ? '孕 ' + state.week + ' 周' : '大家都在问'; - $('#qaHeroT').textContent = '妈妈们最常问的问题'; - $('#qaHeroD').textContent = bank.length + ' 个问题 · 点开看答案'; - /* 11-02 用户二改:不要「正在看」和热度条,每条只显示「N 人看过」(= 「此刻」总人数 × heat,同首页;模拟数,AGENTS.md 12b); - 前 10 名像微博热搜挂小标:第 1 爆、2~7 热、8~10 新,其余不挂(11-03 用户:不要「沸」,用「热」) */ + /* 11-03 用户:「孕期百问列表太素、看的人少,做得有设计感一点」→ + Banner 加头像叠 + 「N 万孕妈在这找答案」;前 3 条做成「本周热问」大卡(渐变名次 + 答案摘要);其余为卡片行:问题 + 分类彩签 + 火苗人数 + 一行答案摘要 */ const tot = (window.__mbPulse && window.__mbPulse.total && +window.__mbPulse.total.value) || 1510000; - const QA_BD = i => i < 1 ? ['爆', 'bao'] : i < 7 ? ['热', 're'] : i < 10 ? ['新', 'xin'] : null; const wan = n => n >= 1e4 ? (Math.round(n / 1e3) / 10) + '万' : String(Math.round(n)); + $('#qaHeroW').textContent = band ? '孕 ' + state.week + ' 周' : '大家都在问'; + $('#qaHeroT').textContent = '孕妈最常问的问题'; + const s0 = ((state.week || 1) * 5) % AVA_TOP.length; + $('#qaHeroD').innerHTML = '' + [0, 1, 2, 3, 4].map(i => avaImg(AVA_TOP[(s0 + i * 2) % AVA_TOP.length])).join('') + '' + wan(tot * 0.62) + ' 孕妈在这找答案'; + const QA_BD = i => i < 1 ? ['爆', 'bao'] : i < 7 ? ['热', 're'] : i < 10 ? ['新', 'xin'] : null; + const QA_EM = { 身体: '🤰', 准备: '📋', 产检: '🩺', 宝宝: '👶', 生活: '🏠', 营养: '🥗', 职场: '💼', 花钱: '💰', 心情: '💗', 趣味: '🎈', 补剂: '💊', 专题: '📌' }; + 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); const order = bank.filter(x => x.href === QA_FIXED) @@ -5600,28 +5607,32 @@ ['全部'].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; - const sm = document.createElement('small'); sm.textContent = c === '全部' ? bank.length : c === '__st' ? bank.filter(inBand).length : bank.filter(x => x.tag === c).length; - b.appendChild(sm); + b.textContent = c === '__st' ? '⏳ 孕 ' + state.week + ' 周' : c === '全部' ? '✨ 全部' : (QA_EM[c] ? QA_EM[c] + ' ' : '') + c; b.addEventListener('click', () => qaFilter(c)); cb.appendChild(b); }); const L = $('#qaList'); L.textContent = ''; + const sec = (t, d) => { const h = document.createElement('div'); h.className = 'qa-sec'; h.innerHTML = '' + t + '' + d + ''; L.appendChild(h); }; + const snip = a => (a || '').replace(/\s+/g, ' ').trim(); order.forEach((x, i) => { + if (i === 0) sec('🔥 本周热问', '看的人最多的 3 个问题'); + if (i === 3) sec('全部问题', '点开就有答案'); const it = document.createElement('div'); - it.className = 'qa-it' + (i < 6 ? ' top' : ''); + it.className = 'qa-it' + (i < 3 ? ' t3 r' + (i + 1) : ''); it.dataset.cat = x.tag || ''; 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 + 1; + const no = document.createElement('i'); no.className = 'qa-no'; no.textContent = i < 9 ? '0' + (i + 1) : i + 1; 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); - if (+x.heat) { - const st = document.createElement('span'); st.className = 'qa-st'; - st.textContent = wan(tot * +x.heat) + ' 人看过'; - t.appendChild(st); - } + const mt = document.createElement('span'); mt.className = 'qa-mt'; + if (x.tag) mt.insertAdjacentHTML('beforeend', '' + x.tag + ''); + if (+x.heat) mt.insertAdjacentHTML('beforeend', '' + MS_FIRE + '' + wan(qaViews(x.heat)) + '人看过'); + t.appendChild(mt); + const sn = snip(x.a); + if (sn) { const p = document.createElement('span'); p.className = 'qa-sn'; p.textContent = sn; t.appendChild(p); } + else if (x.href) { const p = document.createElement('span'); p.className = 'qa-sn go'; p.textContent = '点开看专题,一次讲清楚 ›'; t.appendChild(p); } 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 = '›'; @@ -5638,8 +5649,9 @@ const body = $('#detailQA .detail-body'); body.scrollTop = 0; const fi = focus != null ? order.indexOf(bank[focus]) : -1; - if (fi >= 0 && L.children[fi] && !bank[focus].href) { - const c = L.children[fi]; + const its = L.querySelectorAll('.qa-it'); + if (fi >= 0 && its[fi] && !bank[focus].href) { + const c = its[fi]; c.classList.add('open'); setTimeout(() => { body.scrollTo({ top: Math.max(0, c.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop - 12), behavior: 'smooth' }); @@ -5650,6 +5662,7 @@ 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 === '__st' ? it.dataset.st !== '1' : c !== '全部' && it.dataset.cat !== c)); + const L = $('#qaList'); if (L) L.classList.toggle('flt', c !== '全部'); /* 筛选时不分「本周热问 / 全部问题」两段 */ } (function () { const all = $('#msAll'); if (all) all.addEventListener('click', () => loadQA().then(() => openQA())); /* 11-02 合并版里原模块可能没渲染过,先确保问题库到手 */ diff --git a/js/gch/v4.js b/js/gch/v4.js index 2de03ae..3ae9ea8 100644 --- a/js/gch/v4.js +++ b/js/gch/v4.js @@ -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=26110265'; fs.onload = fs.onerror = init; document.body.appendChild(fs); } + else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110266'; fs.onload = fs.onerror = init; document.body.appendChild(fs); } })(); diff --git a/js/gch/v6.js b/js/gch/v6.js index d976975..a9c1dfb 100644 --- a/js/gch/v6.js +++ b/js/gch/v6.js @@ -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=26110265'; + var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110266'; document.head.appendChild(l); - var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110265'; + var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110266'; s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */ document.body.appendChild(s); diff --git a/js/kit.js b/js/kit.js index 0be831e..af5a080 100644 --- a/js/kit.js +++ b/js/kit.js @@ -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 = '26110265'; + var V = '26110266'; 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'); @@ -78,7 +78,7 @@ var skip = ['topic/huafei/', 'topic/ceshi/', 'topic/duiyou/', 'topic/zhichang/']; var all = window.__mbQaPick ? window.__mbQaPick(QA, wk, 40) : QA; all.filter(function (x) { return x.href && skip.indexOf(x.href) < 0; }).slice(0, 2).forEach(function (x) { - out.qa.push({ q: x.q, href: x.href + location.search + location.hash, n: total() * (+x.heat || .03), u: '人看过' }); + out.qa.push({ q: x.q, href: x.href + location.search + location.hash, n: window.__mbQaViews ? window.__mbQaViews(+x.heat || .03) : total() * (+x.heat || .03), u: '人看过' /* 11-03 同百问列表页口径 */ }); }); } var cl = CALC.filter(function (x) { return !(x.gate && wk && wk < x.gate); }); diff --git a/topic/_shared/tools.js b/topic/_shared/tools.js index 8ae0bff..ea063f0 100644 --- a/topic/_shared/tools.js +++ b/topic/_shared/tools.js @@ -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 related(box) { - getJSON('../_shared/idx.json?v=26110265').then(function (idx) { + getJSON('../_shared/idx.json?v=26110266').then(function (idx) { 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 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) : '')) .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=26110265').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); }); + getJSON('../_shared/cm/' + SLUG + '.json?v=26110266').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); }); } function extras(el) {