首页5张工具卡按identifier跳已上架应用(带身份), 替换旧beian域名裸跳 (v26090735)

This commit is contained in:
2026-09-08 03:54:32 +08:00
parent e1554e8a03
commit 1d7d1c05c8
2 changed files with 20 additions and 14 deletions

View File

@@ -220,6 +220,7 @@
const apps = items
.filter(a => a.url && !/wx-h5-demo/i.test(a.url)) /* 排除授权示例 */
.sort((x, y) => (x.seq || 0) - (y.seq || 0) || (x.no || 0) - (y.no || 0));
apps.forEach(a => { APP_BY_ID[a.identifier] = a; }); /* 供首页工具卡按 identifier 取 URL */
renderAppGrid(apps);
})
.catch(function () { /* 拉不到就保留弹层原有占位,不影响其余页面 */ });
@@ -483,16 +484,21 @@
跳转用 location.href 走**当前标签页**:这个壳是照着原生 App 做的,
新开标签会在微信 / Safari 里堆出一串返回不去的页面;同页跳转的话,
浏览器返回键就是天然的「返回」。 */
/* 首页五张工具卡 → 已上架应用(identifier 在应用管理维护,后台改 URL 即生效)。
⚠️ 不再裸跳旧 beian*.douba.top 域名:统一走 jumpApp 带身份(openid/unionid)。 */
const MINI_APP_MAP = {
kick: 'taidong', // 数胎动 (1005)
weight: 'yunqitizhong', // 孕期体重管理 (1012)
cal: 'chanjianrili', // 孕检日历 (1009)
curve: 'taiershengzhang', // 生长曲线 (1013)
fweight:'taierguzhong' // 胎儿估重 (1037)
};
const APP_BY_ID = {};
$$('[data-mini]').forEach(b => b.addEventListener('click', () => {
const map = { kick: '数胎动', weight: '孕期体重', cal: '孕检日历', curve: '生长曲线', fweight: '胎儿估重' };
const site = {
fweight: 'https://beian1.douba.top/', /* 胎儿估重 */
weight: 'https://beian2.douba.top/', /* 孕期体重 */
cal: 'https://beian3.douba.top/' /* 孕检日历 */
};
const url = site[b.dataset.mini];
if (url) { haptic(); location.href = url; return; }
toast('打开「' + map[b.dataset.mini] + '」');
const map = { kick: '数胎动', weight: '孕期体重', cal: '孕检日历', curve: '生长曲线', fweight: '胎儿估重' };
const app = APP_BY_ID[MINI_APP_MAP[b.dataset.mini]];
if (app && app.url) { jumpApp(app.url); return; }
toast('「' + map[b.dataset.mini] + '」即将上线');
}));
/* 记一下弹层只保留「全部孕期工具」,不再提供输入框 */