首页广场入口条下移拉开间距;广场和专题评论+回复里生成真人照头像占 62% 以上;专题相关推荐去图改紧凑文字行,评论框改为底部浮条(v26110238)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-02 15:08:15 +00:00
parent 65a814a216
commit db93c22e15
106 changed files with 142 additions and 132 deletions

View File

@@ -32,14 +32,17 @@
var css2 = '.tt-wrap{padding:16px 14px 14px;border-radius:22px;background:var(--tt-bg,#F7F8FA);border:0}.tt-wrap .tt-it{border-color:transparent;box-shadow:0 4px 14px -10px rgba(31,35,41,.25)}' +
'.tt-h b{display:flex;align-items:center;gap:6px}.tt-h b::before{content:"";width:4px;height:16px;border-radius:4px;background:var(--tt-c,#18A058)}' +
'.tx-sec{margin:26px 0 8px}.tx-sec>.tt-h{margin-bottom:12px}' +
'.tr-list{display:flex;flex-direction:column;gap:10px}.tr-it{display:flex;align-items:center;gap:12px;padding:10px;border-radius:16px;background:#fff;border:1px solid #EEF0F3;text-decoration:none;-webkit-tap-highlight-color:transparent}' +
'.tr-it:active{transform:scale(.98)}.tr-it img{flex:0 0 64px;width:64px;height:64px;border-radius:12px;object-fit:cover;background:#F2F3F5}' +
'.tr-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}.tr-tx b{font-size:15px;font-weight:700;line-height:1.45;color:#1F2329;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}' +
'.tr-tx span{font-size:12px;color:#86909C;display:flex;gap:8px;align-items:center}.tr-tx em{font-style:normal;font-size:11px;font-weight:600;padding:1px 7px;border-radius:99px;background:var(--tt-bg,#F2F3F5);color:var(--tt-c,#18A058)}.tr-go{color:#C9CDD4;font-size:18px}' +
'.tc-in{display:flex;gap:8px;align-items:flex-end;margin-bottom:6px;padding:8px 8px 8px 14px;border-radius:18px;background:#F7F8FA}' +
'.tc-in textarea{flex:1;min-width:0;border:0;background:transparent;resize:none;font-size:14px;line-height:1.6;font-family:inherit;color:#1F2329;height:24px;max-height:96px;outline:0;padding:4px 0}' +
'.tc-in button{flex:0 0 auto;height:32px;padding:0 14px;border:0;border-radius:99px;background:var(--tt-c,#18A058);color:#fff;font-size:13px;font-weight:700}.tc-in button:disabled{opacity:.35}' +
'.tc-it{display:flex;gap:10px;padding:14px 0;border-bottom:1px solid #F2F3F5}.tc-it:last-child{border-bottom:0}.tc-av{flex:0 0 34px;width:34px;height:34px;border-radius:50%;object-fit:cover;background:#F2F3F5}' +
/* 11-03 用户:相关推荐不要图、别占太大 → 紧凑文字行:标题 + 分类 · N 人看过 */
'.tr-list{border-radius:16px;background:#fff;border:1px solid #EEF0F3;padding:0 12px}.tr-it{display:flex;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid #F2F3F5;text-decoration:none;-webkit-tap-highlight-color:transparent}.tr-it:last-child{border-bottom:0}' +
'.tr-it:active{opacity:.6}' +
'.tr-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}.tr-tx b{font-size:14.5px;font-weight:600;line-height:1.45;color:#1F2329;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}' +
'.tr-tx span{font-size:12px;color:#86909C;display:flex;gap:6px;align-items:center}.tr-tx em{font-style:normal;font-size:11px;font-weight:600;color:var(--tt-c,#18A058)}.tr-tx em::after{content:"·";margin-left:6px;color:#C9CDD4;font-weight:400}.tr-go{color:#C9CDD4;font-size:18px}' +
/* 11-03 用户:评论输入框别放在评论区最上面,浮在页面底部 */
'.tc-in{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;gap:8px;align-items:flex-end;padding:8px 12px calc(8px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);border-top:1px solid #F0F1F3;box-shadow:0 -6px 18px -14px rgba(31,35,41,.3)}' +
'.tc-in label{flex:1;min-width:0;display:flex;padding:6px 14px;border-radius:20px;background:#F2F3F5}' +
'.tc-in textarea{flex:1;min-width:0;border:0;background:transparent;resize:none;font-size:14px;line-height:1.6;font-family:inherit;color:#1F2329;height:24px;max-height:96px;outline:0;padding:0}' +
'.tc-in button{flex:0 0 auto;height:36px;padding:0 16px;border:0;border-radius:99px;background:var(--tt-c,#18A058);color:#fff;font-size:13.5px;font-weight:700}.tc-in button:disabled{opacity:.35}' +
'.tc-it{display:flex;gap:10px;padding:14px 0;border-bottom:1px solid #F2F3F5}.tc-it:last-child{border-bottom:0}.tc-av{flex:0 0 34px;width:34px;height:34px;border-radius:50%;object-fit:cover;background:#F2F3F5}' +
'.tc-me{display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:800;color:#fff;background:var(--tt-c,#18A058)}' +
'.tc-b{flex:1;min-width:0}.tc-n{display:flex;align-items:center;gap:6px;font-size:13px;color:#86909C;line-height:1.4}.tc-n b{font-weight:600;color:#4E5969}.tc-n i{font-style:normal;font-size:11px;padding:0 6px;border-radius:99px;background:#F2F3F5}' +
'.tc-t{margin-top:4px;font-size:14.5px;line-height:1.7;color:#1F2329;word-break:break-word}' +
@@ -59,7 +62,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=26110237').then(function (idx) {
getJSON('../_shared/idx.json?v=26110238').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; });
@@ -69,8 +72,7 @@
for (var k = 0; k < top.length && pick.length < 3; k++) pick.push(top[(h + k) % top.length]);
rest.sort(function (a, b) { return b[3] - a[3]; }).forEach(function (x) { if (pick.length < 3 && pick.indexOf(x) < 0) pick.push(x); });
box.innerHTML = '<div class="tt-h"><b>相关推荐</b><span>其他妈妈也在看</span></div><div class="tr-list">' + pick.map(function (x) {
return '<a class="tr-it" href="' + esc(href('../' + x[0] + '/')) + '"><img src="../' + esc(x[0]) + '/img/hero.webp" alt="" loading="lazy">' +
'<span class="tr-tx"><b>' + esc(x[1]) + '</b><span>' + (x[2] ? '<em>' + esc(x[2]) + '</em>' : '') + wan(Math.round(1510000 * x[3])) + ' 人看过</span></span><span class="tr-go">›</span></a>';
return '<a class="tr-it" href="' + esc(href('../' + x[0] + '/')) + '"><span class="tr-tx"><b>' + esc(x[1]) + '</b><span>' + (x[2] ? '<em>' + esc(x[2]) + '</em>' : '') + wan(Math.round(1510000 * x[3])) + ' 人看过</span></span><span class="tr-go">›</span></a>';
}).join('') + '</div>';
}).catch(function () { box.remove(); });
}
@@ -89,22 +91,30 @@
function paint() {
var my = mine().slice().reverse(), n = L.length + my.length, show = open ? L : L.slice(0, 5);
box.innerHTML = '<div class="tt-h"><b>大家怎么说</b><span>' + n + ' 条评论</span></div>' +
'<div class="tc-in"><textarea rows="1" maxlength="200" placeholder="说说你的情况,和其他妈妈聊聊…"></textarea><button type="button" disabled>发布</button></div>' +
'<div class="tc-list">' + my.map(function (c, i) { return item({ me: 1, t: c.t, s: c.s }, 'me' + c.ts); }).join('') +
show.map(function (c, i) { return item(c, SLUG + '#' + i); }).join('') + '</div>' +
(!open && L.length > 5 ? '<button type="button" class="tc-more">展开全部 ' + n + ' 条评论</button>' : '');
var ta = box.querySelector('textarea'), bt = box.querySelector('.tc-in button');
ta.addEventListener('input', function () { bt.disabled = !ta.value.trim(); ta.style.height = '24px'; ta.style.height = Math.min(96, ta.scrollHeight) + 'px'; });
bt.addEventListener('click', function () {
var v = ta.value.trim(); if (!v) return;
(st.m.cm[SLUG] = mine()).push({ t: v.slice(0, 200), ts: Date.now(), s: myStage() }); saveMe(st); paint();
});
var mo = box.querySelector('.tc-more'); if (mo) mo.addEventListener('click', function () { open = true; paint(); });
[].forEach.call(box.querySelectorAll('.tc-lk'), function (b) {
b.addEventListener('click', function () { var k = b.dataset.k; if (st.m.lk[k]) delete st.m.lk[k]; else st.m.lk[k] = 1; saveMe(st); paint(); });
});
}
getJSON('../_shared/cm/' + SLUG + '.json?v=26110237').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); });
/* 底部浮条:整页常驻,发完滚到评论区看到自己那条 */
var bar = document.createElement('div'); bar.className = 'tc-in';
bar.innerHTML = '<label><textarea rows="1" maxlength="200" placeholder="说说你的情况,和其他妈妈聊聊…"></textarea></label><button type="button" disabled>发布</button>';
bar.style.setProperty('--tt-c', box.style.getPropertyValue('--tt-c'));
document.body.appendChild(bar);
var sc = box.parentNode; while (sc && sc !== document.body && !/(auto|scroll)/.test(getComputedStyle(sc).overflowY)) sc = sc.parentNode;
sc = sc || document.body; sc.style.paddingBottom = (parseFloat(getComputedStyle(sc).paddingBottom) || 0) + 64 + 'px';
var ta = bar.querySelector('textarea'), bt = bar.querySelector('button');
ta.addEventListener('input', function () { bt.disabled = !ta.value.trim(); ta.style.height = '24px'; ta.style.height = Math.min(96, ta.scrollHeight) + 'px'; });
bt.addEventListener('click', function () {
var v = ta.value.trim(); if (!v) return;
(st.m.cm[SLUG] = mine()).push({ t: v.slice(0, 200), ts: Date.now(), s: myStage() }); saveMe(st);
ta.value = ''; ta.style.height = '24px'; bt.disabled = true; ta.blur(); paint();
box.scrollIntoView({ block: 'start', behavior: 'smooth' });
});
getJSON('../_shared/cm/' + SLUG + '.json?v=26110238').then(function (d) { L = d.c || []; paint(); }).catch(function () { paint(); });
}
function extras(el) {