From fba66b42c2208532752a83f02a6ce24b3058eef6 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 14:42:42 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AB=E6=8A=A4=E8=82=A4=E5=93=81?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E6=96=B9=E5=8D=A1=E7=89=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=AE=B9=E9=87=8F=EF=BC=88=E4=BB=8E=E5=A4=87=E6=B3=A8=E6=8F=90?= =?UTF-8?q?=E5=8F=96ml/=E5=85=8B=EF=BC=8C=E5=90=A6=E5=88=99=E6=98=BE?= =?UTF-8?q?=E7=A4=BA"=E8=B0=83=E9=85=8D"=EF=BC=89?= 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/RecipeCard.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/RecipeCard.vue b/frontend/src/components/RecipeCard.vue index 8e33197..2d633e7 100644 --- a/frontend/src/components/RecipeCard.vue +++ b/frontend/src/components/RecipeCard.vue @@ -50,11 +50,21 @@ const isFav = computed(() => recipesStore.isFavorite(props.recipe)) const volumeLabel = computed(() => { const ings = props.recipe.ingredients || [] const coco = ings.find(i => i.oil === '椰子油') - if (!coco || !coco.drops) return '' - const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0) - const ml = totalDrops / 18.6 - if (ml <= 2) return '单次' - return `${Math.round(ml)}ml` + if (coco && coco.drops) { + const totalDrops = ings.reduce((s, i) => s + (i.drops || 0), 0) + const ml = totalDrops / 18.6 + if (ml <= 2) return '单次' + return `${Math.round(ml)}ml` + } + // Non-coconut: check if has portion product, extract volume from note + const hasPortion = ings.some(i => oilsStore.isPortionUnit(i.oil)) + if (hasPortion) { + const note = props.recipe.note || '' + const m = note.match(/(\d+)\s*(ml|毫升|克|g)/i) + if (m) return `${m[1]}${m[2].toLowerCase()}` + return '调配' + } + return '' })