fix(core): comprehensive fix for state loss across activity, ticket, workspace, favorites and community
这个提交包含在:
@@ -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) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户