chore: 入库生产基线(2026-10-26 工作树快照)

- 含首页壳/容器页/授权页/分享图/首页配置等此前未入库的在途改动
- 新增未跟踪的 pages/index/mall.vue(第 5 个 tabBar 页,pages.json 已引用)
- 排除本地备份文件(*.bak* / *.origin-bak)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-26 17:07:49 +08:00
parent 91f1ee849c
commit b45a190a59
14 changed files with 4116 additions and 2446 deletions

32
App.vue
View File

@@ -19,6 +19,8 @@
isLogin: false,
userInfo: {},
globalData: false,
appShowAt: 0, // 本次前台化时刻(首页壳据此区分热启动恢复 / 切 tab)
restoreArmed: false, // 冷启动是否允许首页壳恢复「上次进入的 H5 应用」(见 onLaunch)
windowHeight: uni.getWindowInfo().windowHeight + 'px',
sysHeight:uni.getWindowInfo().statusBarHeight,
},
@@ -39,6 +41,18 @@
}
},
onShow(options) {
/* 记录本次「小程序回到前台」的时刻(2026-09-22):首页壳 pages/index/index
靠它区分两种 onShow ——
· 热启动恢复(点胶囊关闭后再进):页面栈与 web-view 都还在,
用户就停在离开时那个 H5 应用里 → **绝不能重载 web-view**;
· 从其它 tab 切回首页:App.onShow **不会**触发 → 维持原行为(重载回兜爸心选首页)。
判据是时间窗:页面 onShow 紧跟 App.onShow 触发(毫秒级),切 tab 不在窗内。 */
try { this.globalData.appShowAt = Date.now(); } catch (e) {}
/* 诊断日志(过滤关键字 enter-app):
· onShow 触发 = 小程序回到前台(热启动恢复或冷启动都会走),
首页壳据此判断要不要重载 web-view;切 tab 不会打这条。 */
console.log('[enter-app] App.onShow(前台化)appShowAt=' + this.globalData.appShowAt +
'(首页壳 onShow 将据此识别热启动)');
const queryData = uni.getEnterOptionsSync(); // uni-app版本 3.5.1+ 支持
if (queryData.query.spid) {
this.$Cache.set('spread', queryData.query.spid);
@@ -70,6 +84,24 @@
// #endif
},
onLaunch(option) {
/* 冷启动入口判定(2026-09-22):**只有「落在首页/引导页且没有显式落地 url」才允许
首页壳恢复上次应用**。否则(扫码进容器页 / 分享落地 / 朋友圈 / 商品页…)用户是冲着
某个页面来的;若此时在小程序内点左上角「小房子」回首页,恢复逻辑又会把他送回刚才那个
应用 —— 形成「点了小房子却回不了首页」的循环(用户实测:扫码→小房子→被送回应用→
多了个返回箭头→再点返回才到家)。
⚠️ 只在 onLaunch 置位(热启动/切 tab 不置),首页壳 onLoad 时一次性消费。
⚠️ 用 path 判据而不是时间窗:引导页可能停很久(看开屏广告),时间窗会误判。 */
try {
const _opt = option || {};
const _path = _opt.path || '';
const _q = _opt.query || {};
const _plainHome = (!_path || _path === 'pages/index/index' || _path === 'pages/guide/index') && !_q.url;
this.globalData.restoreArmed = _plainHome;
console.log('[enter-app] App.onLaunch(冷启动)path=' + _path +
' query=' + JSON.stringify(_q) +
' scene=' + (_opt.scene || '') +
' → restoreArmed=' + _plainHome + '(false=显式落地,首页壳不会恢复上次应用)');
} catch (e) {}
uni.hideTabBar()
//#ifdef APP
plus.screen.lockOrientation("portrait-primary");