退出登录加确认框;未授权时「我的」页提示孕期资料已保存 v26101008
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
14
index.html
14
index.html
@@ -7,7 +7,7 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>兜爸心选 · 孕育陪伴</title>
|
<title>兜爸心选 · 孕育陪伴</title>
|
||||||
<!-- V:26101007 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
<!-- V:26101008 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||||
<link rel="stylesheet" href="mama-box.css">
|
<link rel="stylesheet" href="mama-box.css">
|
||||||
<link rel="stylesheet" href="night.css">
|
<link rel="stylesheet" href="night.css">
|
||||||
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
||||||
@@ -929,6 +929,8 @@
|
|||||||
谁要是把那行加回来,会把连续记录天数冲掉,而且是静默的。 -->
|
谁要是把那行加回来,会把连续记录天数冲掉,而且是静默的。 -->
|
||||||
<span class="me-tag hide" id="meTag"></span>
|
<span class="me-tag hide" id="meTag"></span>
|
||||||
<p id="meRecordLine">已连续记录 <b>42</b> 天</p>
|
<p id="meRecordLine">已连续记录 <b>42</b> 天</p>
|
||||||
|
<!-- 2026-10-10 用户:未授权时说明「数据还在」,避免误以为记录丢了。用 div 不用 p:别占「第一个 <p>」 -->
|
||||||
|
<div class="me-saved" id="meSaved" style="display:none">孕期资料已保存在本微信</div>
|
||||||
</div>
|
</div>
|
||||||
<i class="me-chev" aria-hidden="true">›</i>
|
<i class="me-chev" aria-hidden="true">›</i>
|
||||||
</div>
|
</div>
|
||||||
@@ -1931,6 +1933,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- 2026-10-10 用户:退出登录前二次确认,写清只清授权信息、孕育数据保留 -->
|
||||||
|
<section class="modal bx-prize lg-modal" id="modalLogout" data-autofocus="off" role="dialog" aria-modal="true" aria-labelledby="lgT">
|
||||||
|
<h3 id="lgT">确定退出登录?</h3>
|
||||||
|
<p>退出后不再显示你的昵称、头像和手机号。孕期资料和各项记录仍保存在这个微信上,重新授权就能继续使用。</p>
|
||||||
|
<div class="modal-foot">
|
||||||
|
<button class="dl-btn ghost" data-modal="close">再想想</button>
|
||||||
|
<button class="dl-btn main" id="lgOk">退出登录</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="modal pf-modal" id="modalProfile" data-autofocus="off" role="dialog" aria-modal="true" aria-labelledby="modalProfileTitle">
|
<section class="modal pf-modal" id="modalProfile" data-autofocus="off" role="dialog" aria-modal="true" aria-labelledby="modalProfileTitle">
|
||||||
<div class="modal-head">
|
<div class="modal-head">
|
||||||
<h3 id="modalProfileTitle">我的资料</h3>
|
<h3 id="modalProfileTitle">我的资料</h3>
|
||||||
|
|||||||
10
js/app.js
10
js/app.js
@@ -3,7 +3,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||||
var VER = '26101007';
|
var VER = '26101008';
|
||||||
const $ = (s, c) => (c || document).querySelector(s);
|
const $ = (s, c) => (c || document).querySelector(s);
|
||||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||||
|
|
||||||
@@ -3240,6 +3240,7 @@
|
|||||||
}
|
}
|
||||||
/* 授权入口:未授权时显示(引导先授权);退出按钮:已授权时显示 */
|
/* 授权入口:未授权时显示(引导先授权);退出按钮:已授权时显示 */
|
||||||
var _box = $('#meAuthBox'); if (_box) _box.style.display = _authorized ? 'none' : '';
|
var _box = $('#meAuthBox'); if (_box) _box.style.display = _authorized ? 'none' : '';
|
||||||
|
var _sv = $('#meSaved'); if (_sv) _sv.style.display = _authorized ? 'none' : '';
|
||||||
['#meLogoutCard', '#pfLogout'].forEach(function (sel) { var _lx = $(sel); if (_lx) _lx.style.display = _authorized ? '' : 'none'; });
|
['#meLogoutCard', '#pfLogout'].forEach(function (sel) { var _lx = $(sel); if (_lx) _lx.style.display = _authorized ? '' : 'none'; });
|
||||||
if (!p.userName || !_authorized) {
|
if (!p.userName || !_authorized) {
|
||||||
var _ai2 = $('#meAvatarImg'), _aw2 = $('#meAvatar');
|
var _ai2 = $('#meAvatarImg'), _aw2 = $('#meAvatar');
|
||||||
@@ -5437,10 +5438,14 @@
|
|||||||
⚠️ stopPropagation:me-card 整卡是 data-modal="modalProfile",不阻止冒泡
|
⚠️ stopPropagation:me-card 整卡是 data-modal="modalProfile",不阻止冒泡
|
||||||
会顺带打开资料弹窗。 */
|
会顺带打开资料弹窗。 */
|
||||||
/* 2026-10-10 用户:「我的」页和「我的资料」弹窗里都要有「退出登录」→ 两个按钮共用 doLogout */
|
/* 2026-10-10 用户:「我的」页和「我的资料」弹窗里都要有「退出登录」→ 两个按钮共用 doLogout */
|
||||||
|
/* 2026-10-10 用户:退出前弹确认框(#modalLogout),确认后才真正调接口 */
|
||||||
function doLogout(e) {
|
function doLogout(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
haptic();
|
openModal('modalLogout');
|
||||||
|
}
|
||||||
|
function confirmLogout() {
|
||||||
|
closeModal();
|
||||||
var openid = hashParam('openid');
|
var openid = hashParam('openid');
|
||||||
if (!openid) { toast('未获得身份,无法退出'); return; }
|
if (!openid) { toast('未获得身份,无法退出'); return; }
|
||||||
fetch('/api/mp/public/auth/logout?openid=' + encodeURIComponent(openid), { method: 'POST' })
|
fetch('/api/mp/public/auth/logout?openid=' + encodeURIComponent(openid), { method: 'POST' })
|
||||||
@@ -5456,6 +5461,7 @@
|
|||||||
.catch(function () { toast('退出失败,请检查网络'); });
|
.catch(function () { toast('退出失败,请检查网络'); });
|
||||||
}
|
}
|
||||||
['#meLogoutCard', '#pfLogout'].forEach(function (sel) { var b = $(sel); if (b) b.addEventListener('click', doLogout); });
|
['#meLogoutCard', '#pfLogout'].forEach(function (sel) { var b = $(sel); if (b) b.addEventListener('click', doLogout); });
|
||||||
|
var lgOk = $('#lgOk'); if (lgOk) lgOk.addEventListener('click', confirmLogout);
|
||||||
|
|
||||||
/* 从商城/后台切回小程序首页时,webview 会再次可见 —— 把 H5 重置回「首页」屏。
|
/* 从商城/后台切回小程序首页时,webview 会再次可见 —— 把 H5 重置回「首页」屏。
|
||||||
⚠️ 若不处理:切到商城再点「首页」tab,仍是同一个 webview 实例,
|
⚠️ 若不处理:切到商城再点「首页」tab,仍是同一个 webview 实例,
|
||||||
|
|||||||
@@ -4737,3 +4737,8 @@ a.skip:focus{left:16px;top:16px}
|
|||||||
/* 2026-10-10 方案A:未授权时「我的资料」妈妈栏的授权提示 */
|
/* 2026-10-10 方案A:未授权时「我的资料」妈妈栏的授权提示 */
|
||||||
.pf-unauth{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;margin-top:8px;padding:14px;border-radius:14px;background:#FFF6F1;font-size:14px;color:var(--ink-2);text-align:left}
|
.pf-unauth{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;margin-top:8px;padding:14px;border-radius:14px;background:#FFF6F1;font-size:14px;color:var(--ink-2);text-align:left}
|
||||||
.pf-unauth b{flex:none;font-size:13px;font-weight:700;color:var(--brand)}
|
.pf-unauth b{flex:none;font-size:13px;font-weight:700;color:var(--brand)}
|
||||||
|
/* 2026-10-10 未授权提示行 + 退出确认框 */
|
||||||
|
.me-saved{margin-top:4px;font-size:12px;color:var(--ink-2)}
|
||||||
|
.me-v2 .me-saved{color:rgba(255,255,255,.88)}
|
||||||
|
.lg-modal h3{margin-top:4px}
|
||||||
|
.lg-modal p{line-height:1.6}
|
||||||
|
|||||||
Reference in New Issue
Block a user