fix(theme): 修复门票页导航栏主题脱节与个人中心双身份卡片流光动画,加固活动参与人画像与大神隐私
这个提交包含在:
@@ -251,7 +251,7 @@ import AppTabBar from '@/components/CustomTabBar.vue';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { isExpertCertified } from '@/common/role.js';
|
||||
import { claimOrder, getOrdersPool, getExpertStats, updateCompanionProfile, getUserProfile, getActivities, normalizeUserId } from '@/common/api.js';
|
||||
import { claimOrder, getOrdersPool, getExpertStats, updateCompanionProfile, getUserProfile, getActivities, getMyExpertProfile, normalizeUserId } from '@/common/api.js';
|
||||
import { getUserLocation } from '@/common/location.js';
|
||||
import { startHeartbeat, stopHeartbeat } from '@/common/expert-heartbeat.js';
|
||||
import { getNavBarInfo } from '@/common/nav.js';
|
||||
@@ -363,6 +363,15 @@ const loadHallData = async () => {
|
||||
}
|
||||
}).catch(() => {}),
|
||||
|
||||
getMyExpertProfile().then((profile) => {
|
||||
if (profile && profile.status) {
|
||||
isOnline.value = profile.status === '接单中';
|
||||
uni.setStorageSync('EXPERT_RECEIVING_STATUS', isOnline.value ? '1' : '0');
|
||||
if (isOnline.value) startHeartbeat();
|
||||
else stopHeartbeat();
|
||||
}
|
||||
}).catch(() => {}),
|
||||
|
||||
getOrdersPool(myCoords).then((pool) => {
|
||||
if (Array.isArray(pool)) {
|
||||
orders.value = pool.map(p => {
|
||||
@@ -475,26 +484,37 @@ const filteredOrders = computed(() => {
|
||||
});
|
||||
|
||||
const toggleOnlineStatus = async () => {
|
||||
isOnline.value = !isOnline.value;
|
||||
uni.setStorageSync('EXPERT_RECEIVING_STATUS', isOnline.value ? '1' : '0');
|
||||
const eid = Number(expert.value.id) || normalizeUserId();
|
||||
if (!eid) {
|
||||
uni.showToast({ title: '请先登录后再操作', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const next = !isOnline.value;
|
||||
isOnline.value = next;
|
||||
uni.setStorageSync('EXPERT_RECEIVING_STATUS', next ? '1' : '0');
|
||||
try {
|
||||
await updateCompanionProfile(eid, {
|
||||
status: isOnline.value ? '接单中' : '休息中'
|
||||
status: next ? '接单中' : '休息中'
|
||||
});
|
||||
} catch (_) {}
|
||||
if (isOnline.value) {
|
||||
} catch (err) {
|
||||
// 服务端失败必须回滚本地状态,避免界面显示在线但实际不接单
|
||||
isOnline.value = !next;
|
||||
uni.setStorageSync('EXPERT_RECEIVING_STATUS', !next ? '1' : '0');
|
||||
stopHeartbeat();
|
||||
uni.showToast({
|
||||
title: (err && err.message) || '接单状态切换失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (next) {
|
||||
startHeartbeat();
|
||||
} else {
|
||||
stopHeartbeat();
|
||||
}
|
||||
uni.showToast({
|
||||
title: isOnline.value ? '已开启在线接单' : '已设置为打烊休息',
|
||||
icon: isOnline.value ? 'success' : 'none',
|
||||
title: next ? '已开启在线接单' : '已设置为打烊休息',
|
||||
icon: next ? 'success' : 'none',
|
||||
duration: 1500
|
||||
});
|
||||
};
|
||||
|
||||
@@ -562,6 +562,13 @@ const loadExpertProfile = async () => {
|
||||
voiceIntroUrl: profile.voiceIntroUrl || '',
|
||||
voiceDuration: Number(profile.voiceDuration) || 0
|
||||
};
|
||||
// 以服务端接单状态为准,避免本地缓存显示在线但实际已休息
|
||||
if (profile.status) {
|
||||
isReceivingOrders.value = profile.status === '接单中';
|
||||
uni.setStorageSync('EXPERT_RECEIVING_STATUS', isReceivingOrders.value ? '1' : '0');
|
||||
if (isReceivingOrders.value) startHeartbeat();
|
||||
else stopHeartbeat();
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户