我的页改版(蜜桃珊瑚头部 + 兜豆兑换商城主卡 + 服务宫格);首页新增兜豆兑换商城入口
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
30
js/app.js
30
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26100135';
|
||||
var VER = '26100136';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -1063,6 +1063,12 @@
|
||||
const p = $('.seg-panel[data-panel="data"]');
|
||||
if (p) p.classList.toggle('is-empty', !!on);
|
||||
}
|
||||
/* 「我的」页头部名字下面那枚小标签:孕周 / 宝宝月龄;未完善时隐藏 */
|
||||
function setMeTag(t) {
|
||||
const el = $('#meTag'); if (!el) return;
|
||||
el.textContent = t || '';
|
||||
el.classList.toggle('hide', !t);
|
||||
}
|
||||
function syncPregnancy() {
|
||||
/* 孕期小知识:只认真实孕周(自己判显隐,见 renderTips) */
|
||||
renderTips();
|
||||
@@ -1083,6 +1089,7 @@
|
||||
/* ① 我的 · 孕期卡 */
|
||||
const pcT = $('#pcTitle'), pcS = $('#pcSub'), pcB = $('#pcBar'), pcR = $('#pcRing');
|
||||
if (pcT) pcT.textContent = ageTxt;
|
||||
setMeTag(ageTxt);
|
||||
if (pcS) pcS.textContent = '记录宝宝的成长时光';
|
||||
if (pcB) pcB.style.setProperty('--p', '100%');
|
||||
if (pcR) {
|
||||
@@ -1135,6 +1142,7 @@
|
||||
fpRender();
|
||||
/* ① 我的 · 孕期卡 → 引导 */
|
||||
$('#pcTitle').textContent = '待完善孕期信息';
|
||||
setMeTag('');
|
||||
$('#pcSub').textContent = '填好预产期,开启孕期陪伴';
|
||||
$('#pcBar').style.setProperty('--p', '0%');
|
||||
const rg = $('#pcRing');
|
||||
@@ -1206,6 +1214,7 @@
|
||||
|
||||
/* ① 我的 · 孕期卡 */
|
||||
$('#pcTitle').textContent = weekTxt;
|
||||
setMeTag(weekTxt);
|
||||
$('#pcSub').textContent = (dueTxt ? dueTxt + ' · ' : '') + '还有 ' + left + ' 天';
|
||||
$('#pcBar').style.setProperty('--p', pct + '%');
|
||||
/* 卡片左上角那个图标是一圈进度环,和这条进度条同源(同一个 pct),
|
||||
@@ -4134,6 +4143,25 @@
|
||||
toast('请在微信小程序中打开商城');
|
||||
}
|
||||
}
|
||||
/* ---------- 兜豆兑换商城入口(2026-10-01) ----------
|
||||
两个入口:「我的」页金色主卡 #meExchCard、首页婴儿房下面那条 #homeExch。
|
||||
链接优先取应用后台(APP_BY_ID,identifier 按候选名逐个找),走 jumpApp()
|
||||
—— 与其它 H5 应用同一条路(带 openid/unionid)。后台还没配、兜底地址也空时提示,
|
||||
不静默。⚠️ EXCH_FALLBACK_URL 待兑换商城侧给出正式地址后填上。 */
|
||||
const EXCH_IDS = ['duihuan', 'exchange', 'doudou', 'duihuanshangcheng'];
|
||||
const EXCH_FALLBACK_URL = '';
|
||||
function openExchange() {
|
||||
haptic();
|
||||
let app = null;
|
||||
for (const id of EXCH_IDS) { if (APP_BY_ID[id]) { app = APP_BY_ID[id]; break; } }
|
||||
const url = (app && app.url) || EXCH_FALLBACK_URL;
|
||||
if (!url) { toast('兜豆兑换商城即将开放,先攒着兜豆吧'); return; }
|
||||
jumpApp(url, (app && app.identifier) || 'duihuan');
|
||||
}
|
||||
$$('#meExchCard, #homeExch').forEach(function (b) {
|
||||
b.addEventListener('click', openExchange);
|
||||
});
|
||||
|
||||
/* 商城入口:「我的」页服务卡与首页商城主卡。
|
||||
⚠️ 2026-09-19:底 tab #tabMall 已经改回「宝宝来信」(见下面的 #tabLetter 绑定),
|
||||
不再走 goMall —— 所以这里只留两颗真正的商城入口。 */
|
||||
|
||||
Reference in New Issue
Block a user