退出登录加确认框;未授权时「我的」页提示孕期资料已保存 v26101008
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
10
js/app.js
10
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26101007';
|
||||
var VER = '26101008';
|
||||
const $ = (s, c) => (c || document).querySelector(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 _sv = $('#meSaved'); if (_sv) _sv.style.display = _authorized ? 'none' : '';
|
||||
['#meLogoutCard', '#pfLogout'].forEach(function (sel) { var _lx = $(sel); if (_lx) _lx.style.display = _authorized ? '' : 'none'; });
|
||||
if (!p.userName || !_authorized) {
|
||||
var _ai2 = $('#meAvatarImg'), _aw2 = $('#meAvatar');
|
||||
@@ -5437,10 +5438,14 @@
|
||||
⚠️ stopPropagation:me-card 整卡是 data-modal="modalProfile",不阻止冒泡
|
||||
会顺带打开资料弹窗。 */
|
||||
/* 2026-10-10 用户:「我的」页和「我的资料」弹窗里都要有「退出登录」→ 两个按钮共用 doLogout */
|
||||
/* 2026-10-10 用户:退出前弹确认框(#modalLogout),确认后才真正调接口 */
|
||||
function doLogout(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
haptic();
|
||||
openModal('modalLogout');
|
||||
}
|
||||
function confirmLogout() {
|
||||
closeModal();
|
||||
var openid = hashParam('openid');
|
||||
if (!openid) { toast('未获得身份,无法退出'); return; }
|
||||
fetch('/api/mp/public/auth/logout?openid=' + encodeURIComponent(openid), { method: 'POST' })
|
||||
@@ -5456,6 +5461,7 @@
|
||||
.catch(function () { toast('退出失败,请检查网络'); });
|
||||
}
|
||||
['#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 重置回「首页」屏。
|
||||
⚠️ 若不处理:切到商城再点「首页」tab,仍是同一个 webview 实例,
|
||||
|
||||
Reference in New Issue
Block a user