同步小程序与管理端更新,完善抽烟记录和解绑冷静期

This commit is contained in:
2026-10-09 22:15:51 +08:00
parent a68a4ef411
commit b10fc3c4ac
149 changed files with 3794 additions and 589 deletions
+23
View File
@@ -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 || '';