From 78e50bc85874607c159de3db1626ed901f76486f Mon Sep 17 00:00:00 2001 From: karlcarlo Date: Sun, 11 Oct 2026 14:32:12 +0000 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E4=B8=80=E4=B8=8B=E5=AE=AB=E6=A0=BC?= =?UTF-8?q?=EF=BC=9A=E6=B2=A1=E5=88=B0=E5=AD=95=E5=91=A8=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E8=87=AA=E5=8A=A8=E6=8E=92=E5=88=B0=E6=9C=80=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E9=94=81=E5=90=8E=E5=9B=9E=E5=8E=9F=E4=BD=8D?= =?UTF-8?q?=20v26101023?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: AI 助手 --- index.html | 2 +- js/app.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index cfe42a4..89af6d3 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index 9075f1b..c727724 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26101022'; + var VER = '26101023'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -378,12 +378,20 @@ } /* 记一下宫格上的小标签「孕16周开放」(图标右上角):没到门槛的灰一点,到了自动去掉;首页工具卡改成直接换替补(swapHomeCards) */ function markStageLocks() { - $$('#appsGrid .app').forEach(b => { + const tiles = $$('#appsGrid .app'); + tiles.forEach(b => { const g = stageGateOf(decodeURIComponent(b.dataset.url || ''), decodeURIComponent(b.dataset.id || '')); const on = stageLocked(g); b.classList.toggle('is-locked', on); if (on) b.dataset.lock = '孕' + g.wk + '周开放'; else delete b.dataset.lock; }); + /* 2026-10-11 用户:没开放的排到后面,不放最前面。能用的保持后台排序(data-ord),没开放的整体挪到末尾; + 孕周到了解锁,就按 data-ord 回到原位。只挪 DOM 顺序,点击走事件委托不受影响。 */ + const grid = $('#appsGrid'); + if (grid && tiles.length) { + tiles.slice().sort((a, b) => (a.classList.contains('is-locked') - b.classList.contains('is-locked')) || (+a.dataset.ord - +b.dataset.ord)) + .forEach(t => grid.appendChild(t)); + } swapHomeCards(); } /* 首页工具卡按孕周自动换(2026-10-11 用户:「孕育工具卡片替换成其他几个能让用户用的,否则首页体验特别差, @@ -455,14 +463,14 @@ function renderAppGrid(apps) { const grid = $('#appsGrid'); if (!grid) return; - grid.innerHTML = apps.map(a => { + grid.innerHTML = apps.map((a, i) => { const ico = a.logo || a.icon || ''; const name = a.name || a.identifier || '应用'; /* 有 logo:白底圆角让图盖满;无 logo:colorTheme/调色板 + 首字彩色块。 ⚠️ colorTheme 目前全是 'blue' 颜色名 —— 有图时别拿它当底色,否则清一色蓝。 */ const bg = ico ? 'background:#fff' : 'background:' + (a.colorTheme || appTileColor(name)); const img = ico ? '' : '' + name.slice(0, 1) + ''; - return ''; + return ''; }).join(''); /* 磁贴点击(事件委托,innerHTML 重建后不用重绑) */ grid.onclick = function (e) {