悄悄话每周话题:首页入口/全屏页/说一句弹窗展示本周话题「对宝宝说的话」 (v26100199)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>兜爸心选 · 孕育陪伴</title>
|
||||
<!-- V:26100198 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26100199 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<link rel="stylesheet" href="mama-box.css">
|
||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<!-- 共享助手:授权/跳商城/位置上报(分享卡片同步,见 docs/h5-auth-standard.md 第四节) -->
|
||||
@@ -309,7 +309,7 @@
|
||||
<!-- 2026-10-02 用户:「入口那一小条里要有星空,星星一闪一闪,再划过几个流星,不要太多」 -->
|
||||
<span class="we-sky" aria-hidden="true"><i class="tw" style="left:50%;top:12%;width:6px;height:6px;animation-delay:-1.2s;animation-duration:2.4s"></i><i style="left:60%;top:30%;width:4px;height:4px;animation-delay:-0.3s;animation-duration:2.0s"></i><i class="tw" style="left:73%;top:15%;width:5px;height:5px;animation-delay:-2.4s;animation-duration:2.8s"></i><i class="tw" style="left:93%;top:13%;width:4px;height:4px;animation-delay:-3.1s;animation-duration:2.2s"></i><i class="tw" style="left:21%;top:90%;width:4px;height:4px;animation-delay:-3.7s;animation-duration:2.6s"></i><i class="tw" style="left:45%;top:88%;width:5px;height:5px;animation-delay:-1.6s;animation-duration:3.2s"></i><i style="left:73%;top:80%;width:4px;height:4px;animation-delay:-2.2s;animation-duration:2.6s"></i><i class="tw" style="left:89%;top:88%;width:5px;height:5px;animation-delay:-0.8s;animation-duration:3.0s"></i><b class="we-mt"></b><b class="we-mt m2"></b></span>
|
||||
<span class="we-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="we-txt"><b id="weName">孕妈悄悄话</b><span class="we-roll" id="weRoll"></span></span>
|
||||
<span class="we-txt"><b id="weName">孕妈悄悄话</b><span class="we-topic"><em>本周话题</em><strong id="weTopic"></strong></span><span class="we-roll" id="weRoll"></span></span>
|
||||
<span class="we-go" id="weGo"></span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1813,6 +1813,7 @@
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="wh-m-topic" id="whMTopic" style="display:none"></p>
|
||||
<p class="wh-m-lead" id="whMLead">不显示昵称和头像,只有同孕期的妈妈能看到。她们会给你一个抱抱。</p>
|
||||
<div class="wh-ta-box">
|
||||
<textarea class="wh-ta" id="whTa" maxlength="40" rows="2" placeholder="今天想对谁说点什么?"></textarea>
|
||||
|
||||
39
js/app.js
39
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100198';
|
||||
var VER = '26100199';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -3340,6 +3340,26 @@
|
||||
const oid = () => hashParam('openid');
|
||||
const list = () => (data && data.list) || [];
|
||||
|
||||
/* ---------- 每周话题(2026-10-02 用户:「一周一个主题,要么大家也不知道说什么」)----------
|
||||
一条 = 从 from(北京时间那周的周一)起生效,直到下一条的 from;所以表里永远取「from ≤ 今天」的最后一条,
|
||||
没配新话题时沿用上一周的,不会空着。换话题 = 往表尾追加一条。
|
||||
后端将来若在 /whisper 返回 theme(同结构),以后端为准。
|
||||
presets 只是「不知道说什么?点一句」的示范句,发出去时不在服务端预设库里 → 照常走微信内容安全审核。 */
|
||||
const WH_THEMES = [
|
||||
{ from: '2026-09-28', name: '对宝宝说的话',
|
||||
tip: '把想对 TA 说的话,悄悄放进星空',
|
||||
say: '对宝宝说一句悄悄话', ph: '宝宝,妈妈想对你说……',
|
||||
presets: ['宝宝,妈妈每天都在数着日子等你', '你踢我的时候,是在跟妈妈打招呼吗', '不管你长什么样,妈妈都一样爱你',
|
||||
'慢慢长,不着急,妈妈在这儿等你', '等你出来,带你去看海', '爸爸天天对着肚子讲话,你听到了吗'] },
|
||||
];
|
||||
function theme() {
|
||||
if (data && data.theme && data.theme.name) return data.theme;
|
||||
const d = new Date(Date.now() + 8 * 3600e3).toISOString().slice(0, 10);
|
||||
let t = null;
|
||||
WH_THEMES.forEach(x => { if (x.from <= d) t = x; });
|
||||
return t;
|
||||
}
|
||||
|
||||
/* ---------- 首页入口:一句轮播 ---------- */
|
||||
function roll() {
|
||||
const l = list().filter(x => !x.mine);
|
||||
@@ -3354,10 +3374,13 @@
|
||||
/* 用户:「同孕周悄悄话改成 30 周孕妈悄悄话」—— 周数跟着她自己的孕周走 */
|
||||
const nm = data && data.week ? data.week + '周孕妈悄悄话' : '孕妈悄悄话';
|
||||
$('#weName').textContent = nm;
|
||||
entry.setAttribute('aria-label', '打开' + nm);
|
||||
const th = theme();
|
||||
$('#weTopic').textContent = th ? th.name : '';
|
||||
entry.classList.toggle('has-topic', !!th);
|
||||
entry.setAttribute('aria-label', '打开' + nm + (th ? ',本周话题:' + th.name : ''));
|
||||
$('#weRoll').textContent = l.length ? '“' + l[0].text + '”' : '';
|
||||
ri = 0;
|
||||
$('#weGo').innerHTML = '去看看<i aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M6 3.5L10.5 8 6 12.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></i>';
|
||||
$('#weGo').innerHTML = (th ? '去说一句' : '去看看') + '<i aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M6 3.5L10.5 8 6 12.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></i>';
|
||||
clearInterval(rollT);
|
||||
if (l.length > 1) rollT = setInterval(() => { if (!document.hidden && !page.classList.contains('show')) roll(); }, 4000);
|
||||
}
|
||||
@@ -3645,6 +3668,9 @@
|
||||
$('#whpTag').textContent = data ? '孕 ' + data.week + ' 周 · 前后一周的妈妈' : '';
|
||||
/* 2026-10-02 用户:「每个星星都是孕妈的一句话,类似这个感觉,替换掉今晚多少句悄悄话」→ 标题不再报条数 */
|
||||
$('#wskTitle').innerHTML = '<div class="wsk-t">每一颗星星,<br>都是<b>一位孕妈</b>的一句话</div><p>' + (night ? '今晚' : '今天') + ',她们和你一样在等宝宝来</p>';
|
||||
const th = theme();
|
||||
if (th) $('#wskTitle').insertAdjacentHTML('beforeend', '<div class="wsk-topic"><em>本周话题</em><b>' + esc(th.name) + '</b><span>' + esc(th.tip || '') + '</span></div>');
|
||||
$('#whSay').firstElementChild.textContent = th && th.say ? th.say : '说一句悄悄话';
|
||||
paintDeco();
|
||||
paintSky(l);
|
||||
paintList(l);
|
||||
@@ -3766,7 +3792,12 @@
|
||||
ta.value = '';
|
||||
ta.maxLength = data.maxLen || 40;
|
||||
cnt();
|
||||
$('#whPresets').innerHTML = (data.presets || []).map(t => '<button class="wh-pre" type="button">' + esc(t) + '</button>').join('');
|
||||
const th = theme();
|
||||
$('#whMTitle').textContent = th && th.say ? th.say : '说一句悄悄话';
|
||||
$('#whMTopic').textContent = th ? '本周话题:' + th.name : '';
|
||||
$('#whMTopic').style.display = th ? '' : 'none';
|
||||
ta.placeholder = th && th.ph ? th.ph : '今天想对谁说点什么?';
|
||||
$('#whPresets').innerHTML = ((th && th.presets && th.presets.length) ? th.presets : (data.presets || [])).map(t => '<button class="wh-pre" type="button">' + esc(t) + '</button>').join('');
|
||||
$('#whLeft').textContent = '今天还能说 ' + data.left + ' 句';
|
||||
openModal('modalWhisper');
|
||||
});
|
||||
|
||||
20
mama-box.css
20
mama-box.css
@@ -4204,3 +4204,23 @@ a.skip:focus{left:16px;top:16px}
|
||||
@media (prefers-reduced-motion:reduce){#tabLetter.has-new .t-ico{animation:none}}
|
||||
/* 档案的小脚丫:脚趾圆点在脚掌外面,选中时不反白、跟主体同色 */
|
||||
.tab[data-tab="archive"].is-active .t-svg .td{fill:currentColor}
|
||||
|
||||
/* ================= 悄悄话 · 每周话题(2026-10-02)=================
|
||||
首页入口三行:小字「30周孕妈悄悄话」/ 本周话题(金色小签 + 话题名)/ 一句轮播;右边「去说一句」。
|
||||
全屏页标题下一张话题签;「说一句」弹窗顶上一行话题。话题表在 app.js WH_THEMES。 */
|
||||
.we-topic{display:none;align-items:center;gap:6px;min-width:0}
|
||||
.wh-entry.has-topic .we-topic{display:flex}
|
||||
.we-topic 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}
|
||||
.we-topic strong{font-size:15px;font-weight:900;letter-spacing:.5px;color:#FFE7C7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.wh-entry.has-topic .we-txt{gap:3px}
|
||||
.wh-entry.has-topic .we-roll{font-size:12.5px;font-weight:500;color:rgba(255,244,232,.78)}
|
||||
.wh-entry.has-topic .we-go{color:#FFE2B8;font-weight:700}
|
||||
|
||||
.wsk-topic{display:inline-flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:4px 8px;margin-top:12px;padding:8px 14px;
|
||||
border-radius:14px;background:rgba(255,255,255,.08);box-shadow:inset 0 0 0 1px rgba(255,226,184,.25)}
|
||||
.wsk-topic em{font-style:normal;font-size:11px;font-weight:800;color:#4A2E1E;background:linear-gradient(120deg,#FFE2B8,#FFB98F);padding:1px 7px;border-radius:6px}
|
||||
.wsk-topic b{font-size:16px;font-weight:900;color:#FFE7C7;letter-spacing:1px}
|
||||
.wsk-topic span{flex-basis:100%;font-size:12px;color:rgba(255,255,255,.6);letter-spacing:.5px}
|
||||
|
||||
.wh-m-topic{margin:0 0 6px;font-size:13px;font-weight:800;color:#C2667A}
|
||||
|
||||
Reference in New Issue
Block a user