chore: 抢单端UI回退前备份当前完整工作区
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
35
app.js
35
app.js
@@ -7,6 +7,7 @@ import { setClubId, getConfiguredClubId, buildClubHeaders, getClubId } from './u
|
||||
import { CLUB_ID, WX_APP_ID } from './config/club-config';
|
||||
import { applyMiniappAssetsFromConfig, warmupPindaoConfig } from './utils/miniapp-icons.js';
|
||||
import { refreshDashouMembership } from './utils/dashou-profile.js';
|
||||
const { getDefaultAvatarUrl, resolveAvatarFromStorage } = require('./utils/avatar.js');
|
||||
|
||||
// 三端固定首页
|
||||
const roleDefaultPage = PRIMARY_DEFAULT_PAGES;
|
||||
@@ -163,11 +164,21 @@ App({
|
||||
debugMode: false,
|
||||
currentUser: null,
|
||||
currentRole: 'normal',
|
||||
primaryRole: 'normal'
|
||||
},
|
||||
primaryRole: 'normal',
|
||||
/** 客服浮钮:full | mini,onLaunch 重置为 full */
|
||||
kefuFloatMode: 'full',
|
||||
/** 本次启动内隐藏客服浮钮(不持久化,杀进程后恢复) */
|
||||
kefuFloatSessionHidden: false,
|
||||
kefuFloatY: null,
|
||||
/** 从「我的」跳抢单页时高亮指定单 */
|
||||
_acceptOrderHighlight: '',
|
||||
},
|
||||
|
||||
// 核心启动流程
|
||||
async onLaunch() {
|
||||
this.globalData.kefuFloatMode = 'full';
|
||||
this.globalData.kefuFloatSessionHidden = false;
|
||||
try { wx.removeStorageSync('kefuFloatPermanentHidden'); } catch (e) {}
|
||||
setClubId(getConfiguredClubId(), this);
|
||||
this.globalData.clubId = CLUB_ID;
|
||||
// ① 隐藏返回首页按钮
|
||||
@@ -258,8 +269,13 @@ App({
|
||||
async onShow() {
|
||||
if (!wx.getStorageSync('token')) return;
|
||||
await ensurePhoneAuth({ redirect: true });
|
||||
if (this.globalData.chatEnabled && typeof this.ensureConnection === 'function') {
|
||||
if (this.globalData.chatEnabled && typeof this.startImWhenReady === 'function') {
|
||||
this.startImWhenReady();
|
||||
} else if (this.globalData.chatEnabled && typeof this.ensureConnection === 'function') {
|
||||
this.globalData.goEasyConnection.autoReconnect = true;
|
||||
if (typeof this.restoreTabBarBadge === 'function') {
|
||||
this.restoreTabBarBadge();
|
||||
}
|
||||
this.ensureConnection();
|
||||
if (typeof this.syncConnectionStatus === 'function') {
|
||||
setTimeout(() => this.syncConnectionStatus(), 800);
|
||||
@@ -386,6 +402,13 @@ App({
|
||||
} catch (e) {
|
||||
console.warn('miniapp assets apply failed', e);
|
||||
}
|
||||
|
||||
if (this.emitEvent) {
|
||||
this.emitEvent('configApplied', {
|
||||
ossImageUrl: this.globalData.ossImageUrl,
|
||||
morentouxiang: this.globalData.morentouxiang,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 仅在有效 appkey 时初始化
|
||||
@@ -422,10 +445,12 @@ App({
|
||||
initCurrentUser() {
|
||||
const uid = wx.getStorageSync('uid');
|
||||
if (uid) {
|
||||
const def = getDefaultAvatarUrl(this);
|
||||
const avatar = resolveAvatarFromStorage(this) || def;
|
||||
this.globalData.currentUser = {
|
||||
id: uid,
|
||||
name: '用户' + uid.substring(0, 6),
|
||||
avatar: this.globalData.ossImageUrl + this.globalData.morentouxiang
|
||||
name: wx.getStorageSync('nicheng') || ('用户' + uid.substring(0, 6)),
|
||||
avatar: avatar || def,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user