From b07b97bf1ef26df51bdc333018881dcb631af5b9 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Wed, 8 Apr 2026 19:44:15 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=98=E4=B8=BA=E6=88=91=E7=9A=84?= =?UTF-8?q?=E6=94=B9=E5=86=99=E5=85=A5=20recipes=20=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E5=9C=A8=E3=80=8C=E6=88=91=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E3=80=8D=E5=92=8C=E3=80=8C=E7=AE=A1=E7=90=86=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E3=80=8D=E4=B8=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 saveToDiary() 调用 POST /api/diary,数据写入 user_diary 表, 只在「我的配方日记」(/mydiary) 中可见。 改为调用 recipesStore.saveRecipe(),写入 recipes 表并以当前用户为 owner, GET /api/recipes 会返回该用户自己创建的配方, RecipeSearch 的「我的配方」预览和 RecipeManager 的配方列表均可显示。 Co-Authored-By: YoYo --- frontend/src/components/RecipeDetailOverlay.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/RecipeDetailOverlay.vue b/frontend/src/components/RecipeDetailOverlay.vue index 512b2b7..f7d6a44 100644 --- a/frontend/src/components/RecipeDetailOverlay.vue +++ b/frontend/src/components/RecipeDetailOverlay.vue @@ -580,13 +580,13 @@ async function saveToDiary() { const name = await showPrompt('保存为我的配方,名称:', recipe.value.name) if (!name) return try { - await api.post('/api/diary', { + await recipesStore.saveRecipe({ name, - source_recipe_id: recipe.value._id || null, - ingredients: recipe.value.ingredients.map(i => ({ oil: i.oil, drops: i.drops })), note: recipe.value.note || '', + ingredients: recipe.value.ingredients.map(i => ({ oil_name: i.oil, drops: i.drops })), + tags: recipe.value.tags || [], }) - ui.showToast('已保存到「我的配方日记」') + ui.showToast('已保存到「我的配方」') } catch (e) { ui.showToast('保存失败: ' + (e?.message || '未知错误')) }