From fc04539b28fdcbbacb248eb3c5f840fcbdf65d35 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Fri, 10 Apr 2026 15:55:40 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B4=A1=E7=8C=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E5=90=8E=E5=AE=9E=E6=97=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/views/RecipeManager.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/RecipeManager.vue b/frontend/src/views/RecipeManager.vue index c3b19ab..328c859 100644 --- a/frontend/src/views/RecipeManager.vue +++ b/frontend/src/views/RecipeManager.vue @@ -1029,6 +1029,16 @@ async function saveAllParsed() { } const sharedCount = ref({ adopted: 0, total: 0 }) + +async function loadContribution() { + try { + const res = await api('/api/me/contribution') + if (res.ok) { + const data = await res.json() + sharedCount.value = { adopted: data.adopted_count || 0, total: data.shared_count || 0 } + } + } catch {} +} const previewRecipeIndex = ref(null) const showBatchMenu = ref(false) const showBatchTagPicker = ref(false) @@ -1065,13 +1075,7 @@ function formatDate(d) { onMounted(async () => { if (auth.isLoggedIn) { await diaryStore.loadDiary() - try { - const res = await api('/api/me/contribution') - if (res.ok) { - const data = await res.json() - sharedCount.value = { adopted: data.adopted_count || 0, total: data.shared_count || 0 } - } - } catch {} + await loadContribution() } if (auth.isAdmin) { try { @@ -1159,6 +1163,7 @@ async function shareDiaryToPublic(diary) { ui.showToast('已提交,等待管理员审核') } await recipeStore.loadRecipes() + await loadContribution() } } catch { ui.showToast('共享失败')