同步小程序与管理端更新,完善抽烟记录和解绑冷静期
This commit is contained in:
@@ -1,17 +1,32 @@
|
||||
Component({
|
||||
data: { visible: true, state: 'loading', message: '' },
|
||||
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._waiting) {
|
||||
this.setData({ visible: false });
|
||||
} else if (state === 'ready') {
|
||||
this._exitTimer = setTimeout(() => { this.setData({ visible: false }); }, Math.max(0, 350 - (Date.now() - this._startedAt)));
|
||||
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._waiting = true;
|
||||
this.setData({ visible: true, state: state, message: message });
|
||||
this.setData({ visible: !!(this._showIntro || this._retrying), intro: !!this._showIntro, state: state, message: message });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user