孕期小知识详情页加「本周每日小知识」(今天在上,倒排到第 1 天,后几天锁着);首页今日小知识大卡也可点进详情页,圆点仍为切换 (v26100132)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26
js/app.js
26
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100131';
|
||||
var VER = '26100132';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -3809,6 +3809,27 @@
|
||||
});
|
||||
box.appendChild(b);
|
||||
}
|
||||
/* 详情页「本周每日小知识」:今天在上,往前倒着排到第 1 天;后面几天只露一行「明天见」 */
|
||||
const list = $('#ptList');
|
||||
list.textContent = '';
|
||||
for (let i = today; i >= 0; i--) {
|
||||
const d = wk.days[i] || {};
|
||||
const it = document.createElement('div');
|
||||
it.className = 'pt-li' + (i === today ? ' is-today' : '');
|
||||
const tag = document.createElement('span');
|
||||
tag.className = 'pt-li-tag';
|
||||
tag.textContent = i === today ? '今天 · 第 ' + (i + 1) + ' 天' : '第 ' + (i + 1) + ' 天';
|
||||
const t = document.createElement('div'); t.className = 'pt-li-t'; t.textContent = d.t || '';
|
||||
const p = document.createElement('div'); p.className = 'pt-li-d'; p.textContent = d.d || '';
|
||||
it.appendChild(tag); it.appendChild(t); it.appendChild(p);
|
||||
list.appendChild(it);
|
||||
}
|
||||
if (today < 6) {
|
||||
const lk = document.createElement('div');
|
||||
lk.className = 'pt-li is-lock';
|
||||
lk.textContent = '第 ' + (today + 2) + (today < 5 ? '–7' : '') + ' 天 · 明天见,每天解锁一条';
|
||||
list.appendChild(lk);
|
||||
}
|
||||
tipSel = -1;
|
||||
showTip(wk, today, today);
|
||||
sec.classList.remove('hide');
|
||||
@@ -3843,6 +3864,9 @@
|
||||
(function () {
|
||||
const ch = $('#ptChips');
|
||||
if (ch) ch.addEventListener('click', e => { const b = e.target.closest('.pt-chip'); if (b) openTips(b.dataset.pt); });
|
||||
/* 首页今日小知识大卡也能点进详情页;底下 7 个圆点仍是切换回看,不跳页 */
|
||||
const td = $('#ptToday');
|
||||
if (td) td.addEventListener('click', e => { if (!e.target.closest('#ptDays')) openTips(); });
|
||||
})();
|
||||
function revealTipsGrid() {
|
||||
const g = $('#ptGrid');
|
||||
|
||||
Reference in New Issue
Block a user