更新最新代码

This commit is contained in:
CodeBuddy
2026-10-26 17:32:47 +08:00
commit 0f5dc01674
315 changed files with 42640 additions and 0 deletions
@@ -0,0 +1,56 @@
Component({
data: { visible: false, intro: false, state: 'loading', message: '' },
lifetimes: {
attached: function() {
this._startedAt = Date.now();
try { this._showIntro = !wx.getStorageSync('launchIntroSeen'); } catch (e) { this._showIntro = false; }
if (this._showIntro) {
this.setData({ visible: true, intro: true });
// 设备首次展示即记住,跳转页面或再次启动都不会重复展示。
try { wx.setStorageSync('launchIntroSeen', true); } catch (e) {}
}
this._unobserve = getApp().observeAuth((state, message) => {
clearTimeout(this._exitTimer);
if (state === 'ready') {
this._retrying = false;
if (this._showIntro) {
this._exitTimer = setTimeout(() => {
this._showIntro = false;
this.setData({ visible: false, intro: false });
}, Math.max(0, 350 - (Date.now() - this._startedAt)));
} else {
this.setData({ visible: false, intro: false });
}
} else if (state === 'error') {
this._showIntro = false;
this._retrying = true;
this.setData({ visible: true, intro: false, state: state, message: message });
} else {
this.setData({ visible: !!(this._showIntro || this._retrying), intro: !!this._showIntro, state: state, message: message });
}
});
},
detached: function() {
clearTimeout(this._exitTimer);
if (this._unobserve) this._unobserve();
}
},
methods: {
preventMove: function() {},
retry: async function() {
try {
await getApp().silentLogin();
// 重新加载失败的页面,保留分享链接、相册 id 等原始入口参数。
var pages = getCurrentPages();
var page = pages[pages.length - 1];
if (!page) return;
var query = Object.keys(page.options || {}).map(function(key) {
return encodeURIComponent(key) + '=' + encodeURIComponent(page.options[key]);
}).join('&');
wx.reLaunch({ url: '/' + page.route + (query ? '?' + query : '') });
} catch (error) {
// App 已发布失败状态,保留重试画面。
}
}
}
});