CI/CD Pipeline / UI Contracts (source-structure gates) (push) Canceled after 0s
CI/CD Pipeline / E2E (live stack) (push) Canceled after 0s
CI/CD Pipeline / Backend Build & Test (push) Canceled after 0s
CI/CD Pipeline / Admin Web Build (push) Canceled after 0s
CI/CD Pipeline / Mini Program Compile Check (push) Canceled after 0s
CI/CD Pipeline / Migration Validation (push) Canceled after 0s
CI/CD Pipeline / Test Shell Guard (Phase 23 Gate) (push) Canceled after 0s
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
// 丹阳公益婚恋服务平台 - 小程序入口
|
|
const stores = require('./stores');
|
|
|
|
App({
|
|
globalData: {
|
|
// 平台配置(静态信息)
|
|
platformName: '丹阳公益婚恋服务平台',
|
|
slogan: '真实相识 · 公益牵线',
|
|
},
|
|
|
|
onLaunch(options) {
|
|
const operatorPath = options && /^pages\/matchmaker-(login|workbench|service-detail)\//.test(options.path || '');
|
|
if (operatorPath || wx.getStorageSync('operatorToken')) {
|
|
stores.appStore.init().catch(() => {});
|
|
// 工作人员使用独立会话,不能被用户端 bootstrap 的登录跳转覆盖。
|
|
if (!operatorPath) wx.reLaunch({ url: '/pages/matchmaker-workbench/matchmaker-workbench' });
|
|
return;
|
|
}
|
|
// 触发 7 个 Store 的冷启动初始化(规范 §131)
|
|
// - 同步从 storage 恢复登录态/用户状态/未读数(避免白屏)
|
|
// - 异步拉取服务端 App 配置(不阻塞)
|
|
// - 若已登录异步刷新 /me/status(不阻塞)
|
|
stores.bootstrap();
|
|
},
|
|
|
|
onError(err) {
|
|
console.error('[App onError]', err);
|
|
},
|
|
|
|
onPageNotFound(res) {
|
|
wx.redirectTo({
|
|
url: '/pages/index/index'
|
|
});
|
|
}
|
|
});
|