悄悄话入口挪进孕妈广场(首页模块底部 + 广场页祈福树下),?wh=1 直开星空页;v26110607

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 01:37:55 +00:00
parent 2fbb76c60b
commit f3072e5617
7 changed files with 115 additions and 35 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<!-- 11-04 UGC 总开关关着时本页不展示,直接回首页(js/ugc.js) -->
<script src="../js/login-gate.js?v=26110605"></script>
<script src="../js/login-gate.js?v=26110607"></script>
<script src="../js/ugc.js?v=26110464" data-guard></script>
<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">
@@ -66,6 +66,31 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:poin
.qf{position:relative;display:block;width:calc(100% - 24px);height:148px;margin:2px 12px 0;border-radius:20px;overflow:hidden;text-align:left;
background:radial-gradient(120% 140% at 82% 100%,#3B3A86 0%,#252A63 38%,#161B3F 75%);box-shadow:0 12px 26px -14px rgba(30,30,90,.7)}
.qf:active{transform:scale(.985)}
/* 11-07 孕妈悄悄话条(祈福树横幅下面):和首页广场模块底部那条同款夜空细条;点了回首页直接打开星空页(首页 ?wh=1) */
.whs{position:relative;display:flex;align-items:center;gap:10px;width:calc(100% - 24px);margin:10px 12px 0;padding:10px 12px 10px 10px;border:0;border-radius:16px;overflow:hidden;text-align:left;font:inherit;color:#fff;
background:linear-gradient(100deg,#2A2550 0%,#3E2F5E 60%,#53365F 100%);box-shadow:0 6px 16px -8px rgba(52,36,92,.55)}
.whs:active{transform:scale(.985)}
.whs-sky{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.whs-sky i{position:absolute;width:5px;height:5px;margin:-2.5px 0 0 -2.5px;opacity:.85;filter:drop-shadow(0 0 1.5px rgba(255,255,255,.6));
background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 .5C10.9 7.4 12.6 9.1 19.5 10 12.6 10.9 10.9 12.6 10 19.5 9.1 12.6 7.4 10.9.5 10 7.4 9.1 9.1 7.4 10 .5Z' fill='%23FFFFFF'/%3E%3C/svg%3E") center/contain no-repeat;animation:whsTw 2.6s ease-in-out infinite}
@keyframes whsTw{0%,100%{opacity:.9;transform:scale(1)}50%{opacity:.2;transform:scale(.55)}}
.whs-mt{position:absolute;top:-4px;left:62%;width:96px;height:2px;border-radius:2px;opacity:0;transform-origin:0 50%;
background:linear-gradient(90deg,#fff,rgba(255,255,255,.75) 30%,rgba(255,255,255,0));box-shadow:0 0 8px 1px rgba(255,255,255,.8);animation:whsMt 7s linear infinite 1.5s}
.whs-mt.m2{left:92%;width:70px;animation-duration:11s;animation-delay:5.2s}
@keyframes whsMt{0%{opacity:0;transform:translate(0,0) rotate(-24deg)}1.5%{opacity:1}9%{opacity:0;transform:translate(-150px,68px) rotate(-24deg)}100%{opacity:0;transform:translate(-150px,68px) rotate(-24deg)}}
@media (prefers-reduced-motion:reduce){.whs-sky i,.whs-mt{animation:none}}
.whs-ico,.whs-tx,.whs-go{position:relative;z-index:1}
.whs-ico{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:rgba(255,255,255,.12);color:#FFD9A8}
.whs-ico svg{width:18px;height:18px}
.whs-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.whs-tx small{font-size:11px;font-weight:600;letter-spacing:1px;color:rgba(255,255,255,.6)}
.whs-tp{display:flex;align-items:center;gap:6px;min-width:0}
.whs-tp em{flex:none;font-style:normal;font-size:10px;font-weight:800;letter-spacing:.5px;color:#4A2E1E;background:linear-gradient(120deg,#FFE2B8,#FFB98F);padding:1px 6px;border-radius:5px;line-height:15px}
.whs-tp b{font-size:15px;font-weight:900;letter-spacing:.5px;color:#FFE7C7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.whs-rl{font-size:12.5px;font-weight:500;color:rgba(255,244,232,.78);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:opacity .26s,transform .26s}
.whs-rl.out{opacity:0;transform:translateY(5px)}
.whs-go{flex:none;display:flex;align-items:center;gap:2px;font-size:12px;font-weight:700;color:#FFE2B8}
.whs-go .ic{width:13px;height:13px}
.qf-st{position:absolute;inset:0;pointer-events:none;opacity:.9;
background-image:radial-gradient(1.4px 1.4px at 12% 20%,#fff,transparent),radial-gradient(1px 1px at 28% 70%,#fff,transparent),radial-gradient(1.2px 1.2px at 46% 14%,#FFE9B0,transparent),
radial-gradient(1px 1px at 54% 82%,#fff,transparent),radial-gradient(1.5px 1.5px at 62% 30%,#fff,transparent),radial-gradient(1px 1px at 8% 88%,#FFE9B0,transparent),radial-gradient(1.2px 1.2px at 40% 46%,#fff,transparent);
@@ -931,6 +956,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
<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>
<script src="../js/wh-themes.js?v=26110607"></script> <!-- 11-07 悄悄话每周话题(与首页共用) -->
<script src="topics.js?v=26110487"></script>
<script src="data.js?v=26110487"></script>
<script src="feed.js?v=26110487"></script>
@@ -1172,7 +1198,49 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
'<span class="qf-fly" aria-hidden="true"><i>福</i><i>安</i><i>福</i><i>康</i></span>' +
'<span class="qf-tx"><small><i></i>宝宝祈福树</small><b><i>#</i>为宝宝挂一张福牌<i>#</i></b><em>集齐五福,愿宝宝平平安安</em>' +
'<span class="qf-go">去祈福<svg class="ic"><use href="#i-right"/></svg></span></span></button>';
} /* 11-07 用户:「悄悄话算孕期广场的话题性质」→ 祈福树横幅下面放一条悄悄话夜空细条(同首页广场模块底部那条)。
数据同首页:GET /whisper?openid=&week=(孕周取首页写的 mmbox.gcwk.v1);拉不到 / 没孕周 / 已退出登录 → 不显示,不造内容。
星空全屏页只在首页有 → 点了回首页带 ?wh=1,首页数据回来自动打开。 */
var WHD = null, whRi = 0, whT = null;
function whHTML() {
if (!WHD) return '';
var th = (WHD.theme && WHD.theme.name) ? WHD.theme : (window.MB_WH_THEME ? window.MB_WH_THEME() : null);
var l = (WHD.list || []).filter(function (x) { return !x.mine; });
var nm = WHD.week ? WHD.week + '周孕妈悄悄话' : '孕妈悄悄话';
var sky = [[50,12,6,-1.2,2.4],[60,30,4,-.3,2],[73,15,5,-2.4,2.8],[93,13,4,-3.1,2.2],[21,90,4,-3.7,2.6],[45,88,5,-1.6,3.2],[73,80,4,-2.2,2.6],[89,88,5,-.8,3]]
.map(function (k) { return '<i style="left:' + k[0] + '%;top:' + k[1] + '%;width:' + k[2] + 'px;height:' + k[2] + 'px;animation-delay:' + k[3] + 's;animation-duration:' + k[4] + 's"></i>'; }).join('');
return '<button type="button" class="whs" id="whsGo" aria-label="打开' + esc(nm) + (th ? ',本周话题:' + esc(th.name) : '') + '">' +
'<span class="whs-sky" aria-hidden="true">' + sky + '<b class="whs-mt"></b><b class="whs-mt m2"></b></span>' +
'<span class="whs-ico" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 18.5V7.8A2.8 2.8 0 017.8 5h8.4A2.8 2.8 0 0119 7.8v5.4a2.8 2.8 0 01-2.8 2.8H9.2z" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"/><path d="M9 10.5h6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg></span>' +
'<span class="whs-tx"><small>' + esc(nm) + '</small>' +
(th ? '<span class="whs-tp"><em>本周话题</em><b>' + esc(th.name) + '</b></span>' : '') +
'<span class="whs-rl" id="whsRl">' + (l.length ? '“' + esc(l[0].text) + '”' : '') + '</span></span>' +
'<span class="whs-go">' + (th ? '去说一句' : '去看看') + '<svg class="ic"><use href="#i-right"/></svg></span></button>';
}
function whRoll() {
clearInterval(whT); whRi = 0;
var l = WHD ? (WHD.list || []).filter(function (x) { return !x.mine; }) : [];
if (l.length < 2) return;
whT = setInterval(function () {
var el = document.getElementById('whsRl'); if (!el || document.hidden) return;
whRi = (whRi + 1) % l.length; el.classList.add('out');
setTimeout(function () { el.textContent = '“' + l[whRi].text + '”'; el.classList.remove('out'); }, 260);
}, 4000);
}
function whFill() {
var slot = document.getElementById('whSlot'); if (!slot) return;
slot.innerHTML = whHTML(); whRoll();
}
(function whFetch() {
var g = null; try { g = JSON.parse(localStorage.getItem('mmbox.gcwk.v1') || 'null'); } catch (e) {}
var w = g && !g.pp && g.w ? +g.w : 0;
if (w < 4 || (window.mbGate && window.mbGate.out)) return;
fetch('/api/mp/public/mama-box/whisper?openid=' + encodeURIComponent(OPENID || '') + '&week=' + w)
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (j) { var r = j && j.code === 200 && j.result; if (r && r.show && (r.list || []).length) { WHD = r; whFill(); } })
.catch(function () {});
})();
/* 分类小 banner:家庭婚姻 / 职场 / 经验 点了 = 参与本类最热话题(投稿规则弹层);测一测 点了 = 进最热的那个测试 */
var CBN = {
family: ['家庭婚姻', '孕期的家,也需要用心经营', '和老公、婆婆、爸妈的那些事', '我也来聊聊'],
@@ -1581,7 +1649,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
/* 11-05 用户:「职场那些标签和上面的话题整合到一个里面,感觉有点乱」→ 选方案 A:「全部」下去掉「热门话题」整块,
标签作为唯一入口(末尾加「全部话题 ›」);选中标签时标签下露出这一类的 2~3 个热门话题(用户同意);投稿奖励一行挪到「大家在聊」上面。
话题本身不变:投稿选话题、帖子卡上的 #话题#、话题详情页照旧。分类视图(catF)仍是原来的热门话题列表。 */
el.innerHTML = qifuHTML() +
el.innerHTML = qifuHTML() + '<div id="whSlot">' + whHTML() + '</div>' +
'<div class="rww"><button type="button" class="rwl" data-rule="1"><svg class="ic"><use href="#i-gift"/></svg><span>投稿被选中得 ' + REWARD + '</span><b>怎么参与 ›</b></button></div>';
fh.className = 'shtg';
fh.innerHTML = '<div class="sh"><h2>大家在聊</h2><small>孕妈们的分享</small></div>' +
@@ -1817,6 +1885,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
$('#more').addEventListener('click', function (e) { if (e.target.closest('[data-t]')) { haptic(); selectTopic(''); } });
$('#head').addEventListener('click', function (e) {
if (e.target.closest('#qfBanner')) { goQifu(); return; }
if (e.target.closest('#whsGo')) { haptic(); var q = new URLSearchParams(location.search); ['t', 'n', 'c'].forEach(function (k) { q.delete(k); }); q.set('wh', '1'); location.href = '../?' + q + location.hash; return; }
var cb = e.target.closest('.cbn[data-test], .csv-i[data-test]'); if (cb) { haptic(); location.href = ceshiURL(cb.dataset.test, true); return; }
var dc = e.target.closest('#csvGo'); if (dc) { csdRoll(dc); return; }
var j = e.target.closest('[data-join]'); if (j) { haptic(); openRule(j.dataset.join); return; }