同步小程序与管理端更新,完善抽烟记录和解绑冷静期
This commit is contained in:
@@ -23,6 +23,29 @@ App({
|
||||
});
|
||||
},
|
||||
|
||||
onRelationChanged: function() {
|
||||
if (this._relationRedirect) return;
|
||||
wx.removeStorageSync('petHasPet');
|
||||
this._relationRedirect = true;
|
||||
setTimeout(() => { this._relationRedirect=false; wx.reLaunch({url:'/pages/index/index'}); }, 0);
|
||||
},
|
||||
onShow: function() {
|
||||
const sync = async () => {
|
||||
if (this._relationSync || this.globalData.authState !== 'ready') return;
|
||||
this._relationSync = true;
|
||||
const before = String(wx.getStorageSync('coupleId') || '');
|
||||
try {
|
||||
await api.checkAuth();
|
||||
if (before !== String(wx.getStorageSync('coupleId') || '')) {
|
||||
this.onRelationChanged();
|
||||
}
|
||||
} catch(e) {} finally { this._relationSync = false; }
|
||||
};
|
||||
sync();
|
||||
if (!this._relationTimer) this._relationTimer = setInterval(sync, 30000);
|
||||
},
|
||||
onHide: function() { if(this._relationTimer) clearInterval(this._relationTimer); this._relationTimer=null; },
|
||||
|
||||
setAuthState: function(state, message) {
|
||||
this.globalData.authState = state;
|
||||
this.globalData.authMessage = message || '';
|
||||
|
||||
Reference in New Issue
Block a user