feat: 配方卡片编辑按钮跳转到管理配方统一编辑器
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 52s

- 点击配方卡片的编辑按钮,跳转到管理配方页面打开同一个编辑器
- 不再维护两套编辑器,确保界面完全一致

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 14:06:56 +00:00
parent d5edc57b98
commit 65ac0b688b
2 changed files with 16 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
<button
v-if="canEditThisRecipe"
class="action-btn action-btn-sm"
@click="viewMode = 'editor'"
@click="goEditInManager"
>编辑</button>
<button class="detail-close-btn" @click="handleClose"></button>
</div>
@@ -739,6 +739,14 @@ function addEoRow() {
editIngredients.value.push({ oil: '', drops: 1 })
}
function goEditInManager() {
const r = recipe.value
// Store recipe id for manager to pick up
localStorage.setItem('oil_edit_recipe_id', String(r._id))
emit('close')
router.push('/manage')
}
const editPriceInfo = computed(() =>
oilsStore.fmtCostWithRetail(editIngredients.value.filter(i => i.oil))
)

View File

@@ -946,6 +946,13 @@ onMounted(async () => {
if (res.ok) reviewHistory.value = await res.json()
} catch {}
}
// Open recipe editor if redirected from card view
const editId = localStorage.getItem('oil_edit_recipe_id')
if (editId) {
localStorage.removeItem('oil_edit_recipe_id')
const recipe = recipeStore.recipes.find(r => String(r._id) === editId)
if (recipe) editRecipe(recipe)
}
})
function editDiaryRecipe(diary) {