From 81ec5987b34bdc7d41b36c641453bf3ae487757f Mon Sep 17 00:00:00 2001 From: YoYo Date: Tue, 7 Apr 2026 21:58:17 +0000 Subject: [PATCH 01/23] =?UTF-8?q?feat:=20=E9=85=8D=E6=96=B9=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E5=8A=A0=E5=85=A5=E4=B8=8A=E4=BC=A0=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RecipeDetailOverlay: 未上传二维码/背景图时,卡片上方显示提示横幅,下方出现「上传我的二维码」按钮,点击跳转到 MyDiary 品牌设置页并记录来源配方 - MyDiary: 新增二维码图片上传区域(直接上传图片文件,存为 base64 → PUT /api/brand qr_code 字段);上传成功后若有待返回配方则自动跳回配方卡片;修复 loadBrandSettings 字段名与后端不一致的问题 - RecipeSearch: 支持 ?openRecipe= 查询参数,页面挂载时自动打开指定配方卡片,实现从 MyDiary 上传后无缝返回 Co-Authored-By: Claude Sonnet 4.6 --- .../src/components/RecipeDetailOverlay.vue | 62 +++++++++++++++ frontend/src/views/MyDiary.vue | 75 +++++++++++++++---- frontend/src/views/RecipeSearch.vue | 26 ++++++- 3 files changed, 148 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/RecipeDetailOverlay.vue b/frontend/src/components/RecipeDetailOverlay.vue index d2a6027..4ed0c72 100644 --- a/frontend/src/components/RecipeDetailOverlay.vue +++ b/frontend/src/components/RecipeDetailOverlay.vue @@ -36,6 +36,12 @@ >English + +
+ + 上传你的专属二维码,生成属于自己的配方卡片 +
+
@@ -126,6 +132,11 @@ class="action-btn" @click="showTranslationEditor = true" >✏️ 修改翻译 +
@@ -342,6 +353,7 @@ From 0c191531568008b042d911f21fa7b093968285c1 Mon Sep 17 00:00:00 2001 From: YoYo Date: Wed, 8 Apr 2026 20:27:03 +0000 Subject: [PATCH 20/23] =?UTF-8?q?fix:=20=E5=A2=9E=E5=BC=BA=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E6=88=91=E7=9A=84=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=92=8C=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=A9=BA=E5=90=8D=E7=A7=B0=E9=9D=99=E9=BB=98=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 区分「取消」(null) 和「清空名称后确认」(空字符串) 两种情况 前者静默返回,后者提示「请输入配方名称」 - 添加 console.log/error 方便在浏览器控制台定位问题 - 成功 toast 改为「已保存!可在「配方查询 → 我的配方」查看」提示去向 - 错误 toast 延长至 3s,并显示 status code - saveRecipe:loadRecipes 失败不再抛出,保证保存成功后不误报失败 Co-Authored-By: Claude Sonnet 4.6 --- .../src/components/RecipeDetailOverlay.vue | 21 +++++++++++++------ frontend/src/stores/recipes.js | 7 ++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/RecipeDetailOverlay.vue b/frontend/src/components/RecipeDetailOverlay.vue index da08c3d..02c8d27 100644 --- a/frontend/src/components/RecipeDetailOverlay.vue +++ b/frontend/src/components/RecipeDetailOverlay.vue @@ -672,17 +672,26 @@ async function saveToDiary() { return } const name = await showPrompt('保存为我的配方,名称:', recipe.value.name) - if (!name) return + // null = user cancelled (clicked 取消) + if (name === null) return + // empty string = user cleared the name field + if (!name.trim()) { + ui.showToast('请输入配方名称') + return + } try { - await recipesStore.saveRecipe({ - name, + const payload = { + name: name.trim(), note: recipe.value.note || '', ingredients: recipe.value.ingredients.map(i => ({ oil_name: i.oil, drops: i.drops })), tags: recipe.value.tags || [], - }) - ui.showToast('已保存到「我的配方」') + } + console.log('[saveToDiary] saving recipe:', payload) + await recipesStore.saveRecipe(payload) + ui.showToast('已保存!可在「配方查询 → 我的配方」查看') } catch (e) { - ui.showToast('保存失败: ' + (e?.message || '未知错误')) + console.error('[saveToDiary] failed:', e) + ui.showToast('保存失败:' + (e?.message || e?.status || '未知错误'), 3000) } } diff --git a/frontend/src/stores/recipes.js b/frontend/src/stores/recipes.js index a4ce180..c8f8291 100644 --- a/frontend/src/stores/recipes.js +++ b/frontend/src/stores/recipes.js @@ -53,7 +53,12 @@ export const useRecipesStore = defineStore('recipes', () => { return data } else { const data = await api.post('/api/recipes', recipe) - await loadRecipes() + // Refresh list; if refresh fails, still return success (recipe was saved) + try { + await loadRecipes() + } catch (e) { + console.warn('[saveRecipe] loadRecipes failed after save:', e) + } return data } } From 2983036388042c4dae3bed7416f6119ea55da9f5 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Wed, 8 Apr 2026 20:44:57 +0000 Subject: [PATCH 21/23] =?UTF-8?q?feat:=20=E5=8C=BA=E5=88=86=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E6=96=B9(diary)=E5=92=8C=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=85=8D=E6=96=B9=E5=BA=93(recipes)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 配方查询页: - 我的配方 → /api/diary (user_diary表),左绿色边框区分 - 收藏配方 → 收藏的公共配方 - 公共配方库 → /api/recipes (recipes表),所有公共配方 - 搜索同时过滤个人和公共配方 管理配方页: - 我的配方 → diary store,支持搜索/标签过滤 - 公共配方库 → 所有公共配方,所有用户可见 - 管理员创建的公共配方不再误归为"我的配方" Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/views/RecipeManager.vue | 71 ++++++++++------ frontend/src/views/RecipeSearch.vue | 123 ++++++++++++++++++++++----- 2 files changed, 145 insertions(+), 49 deletions(-) diff --git a/frontend/src/views/RecipeManager.vue b/frontend/src/views/RecipeManager.vue index 29d538f..3679a9a 100644 --- a/frontend/src/views/RecipeManager.vue +++ b/frontend/src/views/RecipeManager.vue @@ -58,40 +58,33 @@ - +

📖 我的配方 ({{ myRecipes.length }})

- -
- {{ r.name }} +
+ {{ d.name }} - {{ t }} + {{ t }} - {{ oils.fmtPrice(oils.calcCost(r.ingredients)) }} + {{ oils.fmtPrice(oils.calcCost(d.ingredients || [])) }}
- - + +
暂无个人配方
- -
+ +

🌿 公共配方库 ({{ publicRecipes.length }})