From eff4332aaebac4f38238e85f232acc047c4f5d3d Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Fri, 10 Apr 2026 21:34:16 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E5=AD=98=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E5=90=8E0=E5=85=83bug=20+=20=E6=A0=87=E7=AD=BE=E5=AD=97?= =?UTF-8?q?=E6=AF=8D=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 保存公共配方后reload从服务器重新获取(修复oil_name覆盖oil导致显示0元) - 配方卡片标签按字母排序 Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/components/RecipeCard.vue | 4 ++-- frontend/src/stores/recipes.js | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/RecipeCard.vue b/frontend/src/components/RecipeCard.vue index 3e8b1de..5471295 100644 --- a/frontend/src/components/RecipeCard.vue +++ b/frontend/src/components/RecipeCard.vue @@ -36,8 +36,8 @@ const auth = useAuthStore() const visibleTags = computed(() => { if (!props.recipe.tags) return [] - if (auth.canEdit) return props.recipe.tags - return props.recipe.tags.filter(t => !EDITOR_ONLY_TAGS.includes(t)) + const tags = auth.canEdit ? [...props.recipe.tags] : props.recipe.tags.filter(t => !EDITOR_ONLY_TAGS.includes(t)) + return tags.sort((a, b) => a.localeCompare(b, 'zh')) }) const oilNames = computed(() => diff --git a/frontend/src/stores/recipes.js b/frontend/src/stores/recipes.js index 8e6f736..76729fe 100644 --- a/frontend/src/stores/recipes.js +++ b/frontend/src/stores/recipes.js @@ -48,10 +48,8 @@ export const useRecipesStore = defineStore('recipes', () => { async function saveRecipe(recipe) { if (recipe._id) { const data = await api.put(`/api/recipes/${recipe._id}`, recipe) - const idx = recipes.value.findIndex((r) => r._id === recipe._id) - if (idx !== -1) { - recipes.value[idx] = { ...recipes.value[idx], ...recipe, _version: data._version ?? data.version ?? recipe._version } - } + // Reload from server to get properly formatted data (oil_name → oil mapping) + await loadRecipes() return data } else { const data = await api.post('/api/recipes', recipe)