From b570ef509354b68eb747409e1ccce57ff3cda0aa Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Fri, 10 Apr 2026 19:43:23 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AE=A1=E7=90=86=E5=91=98/=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E7=BC=96=E8=BE=91=E5=8F=AF=E7=9B=B4=E6=8E=A5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E5=85=AC=E5=85=B1=E5=BA=93=20+=20=E5=B7=B2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A1=AE=E8=AE=A4?= 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/components/UserMenu.vue | 3 +++ frontend/src/views/RecipeManager.vue | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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('已添加到我的配方')