fix(core): comprehensive fix for state loss across activity, ticket, workspace, favorites and community

这个提交包含在:
xcbyy
2026-10-13 16:01:19 +08:00
父节点 497fb65359
当前提交 1853e653fb
共有 7 个文件被更改,包括 242 次插入 和 61 次删除

查看文件

@@ -241,7 +241,7 @@
<script setup>
import { ref, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { onLoad, onShow } from '@dcloudio/uni-app';
import SkeletonScreen from '@/components/SkeletonScreen.vue';
import { getCompanionDetail, getExpertReviews, replyOrderReview, submitReport as submitReportApi, checkFavorite, addFavorite as addFavApi, removeFavorite as removeFavApi } from '@/common/api.js';
import { ICONS } from '@/common/icons.js';
@@ -268,10 +268,23 @@ const expert = ref({
});
const selectedServiceId = ref(null);
const isPlayingVoice = ref(false);
let currentExpertTargetId = null;
const refreshFavoriteState = async () => {
if (!currentExpertTargetId) return;
try {
const favStatus = await checkFavorite(currentExpertTargetId);
isFav.value = Boolean(favStatus);
} catch (_) {}
};
onShow(() => {
refreshFavoriteState();
});
const toggleFavorite = async () => {
try {
const targetId = Number(expert.value.id || 101);
const targetId = Number(expert.value.id || currentExpertTargetId || 101);
if (isFav.value) {
await removeFavApi(targetId);
isFav.value = false;
@@ -315,6 +328,7 @@ const handleReplyReview = (rev) => {
onLoad(async (query) => {
const targetId = (query && query.id) ? query.id : '1';
currentExpertTargetId = targetId;
try {
const liveData = await getCompanionDetail(targetId);
if (liveData) {

查看文件

@@ -415,7 +415,7 @@ const expert = ref({
nickname: '认证大神',
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=300'
});
const isReceivingOrders = ref(true);
const isReceivingOrders = ref(uni.getStorageSync('EXPERT_RECEIVING_STATUS') !== '0');
const todayIncome = ref('0.00');
const todayOrdersCount = ref(0);
const waitingVerifyCount = ref(0);
@@ -579,6 +579,7 @@ const activeOrders = ref([
const toggleReceivingStatus = () => {
isReceivingOrders.value = !isReceivingOrders.value;
uni.setStorageSync('EXPERT_RECEIVING_STATUS', isReceivingOrders.value ? '1' : '0');
uni.showToast({
title: isReceivingOrders.value ? '已开启在线接单通道!' : '已打烊停止接单',
icon: 'none'
@@ -677,6 +678,7 @@ onShow(() => {
}, 400);
return;
}
isReceivingOrders.value = uni.getStorageSync('EXPERT_RECEIVING_STATUS') !== '0';
loadWorkspaceOrders();
});