diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue index f97ae3f..870c5b7 100644 --- a/frontend/src/components/UserMenu.vue +++ b/frontend/src/components/UserMenu.vue @@ -141,6 +141,9 @@ function isReviewable(n) { } async function markAdded(n) { + const { showConfirm: confirm } = await import('../composables/useDialog') + const ok = await confirm('确认已添加该配方?将通知其他编辑者和搜索用户。') + if (!ok) return try { await api(`/api/notifications/${n.id}/added`, { method: 'POST' }) n.is_read = 1 diff --git a/frontend/src/views/RecipeManager.vue b/frontend/src/views/RecipeManager.vue index 000ae57..a265b01 100644 --- a/frontend/src/views/RecipeManager.vue +++ b/frontend/src/views/RecipeManager.vue @@ -996,7 +996,26 @@ async function saveCurrentRecipe() { return } - // New recipe: always save to diary (personal) + // New recipe: admin/senior_editor can choose public or personal + if (auth.canManage) { + const toPublic = await showConfirm('保存到哪里?', { okText: '公共配方库', cancelText: '个人配方' }) + if (toPublic) { + try { + const pubPayload = { + name: formName.value.trim(), + ingredients: cleanIngs.map(i => ({ oil_name: i.oil, drops: i.drops })), + note: formNote.value, + tags: formTags.value, + } + await recipeStore.saveRecipe(pubPayload) + ui.showToast('已添加到公共配方库') + closeOverlay() + } catch (e) { + ui.showToast('保存失败: ' + (e.message || '未知错误')) + } + return + } + } try { await diaryStore.createDiary(diaryPayload) ui.showToast('已添加到我的配方')