记一下弹窗加厚:日期孕周 + 今天进度卡 + 先记这件 + 宫格已用打勾 (v26100166)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
55
js/app.js
55
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100165';
|
||||
var VER = '26100166';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -541,7 +541,9 @@
|
||||
nav 排到 .sheet 前面之后那条规则永远不再命中,圆钮会直接不转 —— 而且
|
||||
这种「动画没了」的回归 jsdom 根本量不到,只能靠这段注释和下面那条断言钉住。
|
||||
⚠️ 别图省事删掉这两行改回兄弟选择器,除非你把 nav 也挪回文件末尾。 */
|
||||
let sheetPaint = null; // 「记一下」今天卡 + 先记这件(定义在今日脚印那段,依赖 _fpData / todoLine)
|
||||
function openSheet() {
|
||||
if (sheetPaint) try { sheetPaint(); } catch (e) { /* 只是装饰层,出错不挡弹窗 */ }
|
||||
scrim.classList.add('show');
|
||||
sheet.classList.add('show');
|
||||
phoneEl.classList.add('sheet-open');
|
||||
@@ -4414,6 +4416,57 @@
|
||||
if (sub) sub.textContent = n ? '完成任意一件,今天的第一只小脚丫就会印上来' : '去上面的工具记一笔,今天的第一只小脚丫就会印上来';
|
||||
}
|
||||
|
||||
/* 「记一下」弹窗上半部分(2026-10-02 用户:「有点单薄」)。数据只认 _fpData(今日脚印接口),
|
||||
used = 今天用过的工具,unused = 还没用的;拿不到就把两块藏起来,退回原来的「标题 + 宫格」。 */
|
||||
sheetPaint = function () {
|
||||
const n = new Date(Date.now() + 8 * 3600e3); // 北京时间
|
||||
const wd = '日一二三四五六'[n.getUTCDay()];
|
||||
const wk = state.week ? '孕 ' + state.week + ' 周' + (state.day ? ' +' + state.day + ' 天' : '') + ' · ' : '';
|
||||
$('#skSub').textContent = wk + (n.getUTCMonth() + 1) + '月' + n.getUTCDate() + '日 周' + wd;
|
||||
const r = _fpMode === 'rows' || _fpMode === 'guide' ? (_fpData || {}) : null;
|
||||
const today = $('#skToday'), next = $('#skNext');
|
||||
today.classList.toggle('hide', !r);
|
||||
next.classList.add('hide');
|
||||
$$('#appsGrid .app').forEach(b => b.classList.remove('is-done'));
|
||||
if (!r) return;
|
||||
const used = (r.used || []).filter(u => u.appName), unused = r.unused || [];
|
||||
const total = used.length + unused.length;
|
||||
const nm = state.babyName || '宝宝';
|
||||
$('#skNum').textContent = used.length;
|
||||
$('#skArc').style.strokeDasharray = (total ? used.length / total * 113.1 : 0).toFixed(1) + ' 113.1';
|
||||
$('#skLine').textContent = used.length ? '今天已经记了 ' + used.length + ' 项' : '今天还没有记录';
|
||||
const done = $('#skDone');
|
||||
done.textContent = '';
|
||||
if (used.length) {
|
||||
used.slice(0, 4).forEach(u => { const c = document.createElement('i'); c.textContent = u.appName; done.appendChild(c); });
|
||||
if (used.length > 4) done.append('等 ' + used.length + ' 项');
|
||||
} else done.textContent = '记下一笔,就是' + nm + '今天的第一只小脚丫';
|
||||
/* 宫格里今天用过的工具打个小勾 */
|
||||
const usedIds = new Set(used.map(u => u.identifier).filter(Boolean));
|
||||
$$('#appsGrid .app').forEach(b => { if (usedIds.has(decodeURIComponent(b.dataset.id || ''))) b.classList.add('is-done'); });
|
||||
/* 先记这件:前 2 个还没用的 */
|
||||
const box = $('#skCards');
|
||||
box.innerHTML = '';
|
||||
unused.slice(0, 2).forEach((u, i) => {
|
||||
const ident = u.identifier || '', app = ident ? APP_BY_ID[ident] : null;
|
||||
const href = u.url || (app && app.url) || '';
|
||||
const name = u.appName || (app && app.name) || '';
|
||||
if (!href || !name) return;
|
||||
const [t, d] = todoLine(name);
|
||||
const logo = (app && (app.logo || app.icon)) || '';
|
||||
const c = document.createElement('button');
|
||||
c.type = 'button';
|
||||
c.className = 'sk-card ripple c' + i;
|
||||
c.innerHTML = (logo ? '<img alt="" loading="lazy">' : '<span class="sk-l"></span>') + '<b></b><em></em><span class="sk-go">去记 ›</span>';
|
||||
if (logo) c.querySelector('img').src = logo; else c.querySelector('.sk-l').textContent = name.slice(0, 1);
|
||||
c.querySelector('b').textContent = t;
|
||||
c.querySelector('em').textContent = d;
|
||||
c.addEventListener('click', () => jumpApp(href, (app && app.identifier) || ident));
|
||||
box.appendChild(c);
|
||||
});
|
||||
next.classList.toggle('hide', !box.childElementCount);
|
||||
};
|
||||
|
||||
/* 加载中的中性占位(不是假数据):与 index.html 里那条首屏占位同构 */
|
||||
function pendingFootprintStep() {
|
||||
const d = document.createElement('div'); d.className = 'step';
|
||||
|
||||
Reference in New Issue
Block a user