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('共享失败')