chore: 抢单端UI回退前备份当前完整工作区

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-29 17:59:23 +08:00
parent 6e2f7bc39f
commit e8fb32c1fe
53 changed files with 3410 additions and 1065 deletions

View File

@@ -50,6 +50,7 @@ Component({
lifetimes: {
attached() {
this.refresh();
this._restoreBadgeFromCache();
this._badgeListener = (data) => {
if (data.badgeText !== undefined) {
this.setData({ badgeText: data.badgeText });
@@ -68,20 +69,48 @@ Component({
pageLifetimes: {
show() {
this.refresh();
const globalBadge = app.globalData.messageManager?.tabBarBadgeText || '';
if (this.data.badgeText !== globalBadge) {
this.setData({ badgeText: globalBadge });
}
this._restoreBadgeFromCache();
this._syncUnreadWithDebounce();
},
},
methods: {
_restoreBadgeFromCache() {
const mm = app.globalData.messageManager || {};
let badgeText = mm.tabBarBadgeText || '';
if (!badgeText) {
try {
badgeText = wx.getStorageSync('tabBarMessageBadge') || '';
} catch (e) {}
}
if (!badgeText && mm.unreadTotal > 0) {
badgeText = mm.unreadTotal > 99 ? '99+' : String(mm.unreadTotal);
}
if (!badgeText) {
try {
const saved = wx.getStorageSync('messageUnreadTotal');
if (saved > 0) badgeText = saved > 99 ? '99+' : String(saved);
} catch (e) {}
}
if (badgeText && badgeText !== this.data.badgeText) {
this.setData({ badgeText });
}
if (app.restoreTabBarBadge) app.restoreTabBarBadge();
},
_syncUnreadWithDebounce() {
if (this._syncTimer) clearTimeout(this._syncTimer);
this._syncTimer = setTimeout(() => {
if (app && app.loadConversations) app.loadConversations();
}, 300);
if (app.globalData.goEasyConnection) {
app.globalData.goEasyConnection.autoReconnect = true;
}
if (app.startImWhenReady) {
app.startImWhenReady();
} else {
if (app.ensureConnection) app.ensureConnection();
if (app.loadConversations) app.loadConversations();
}
}, 200);
},
refresh() {