Fix overlay: always show buttons, restrict translation, fix save data
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Failing after 1m5s

- Always show favorite/save-to-diary buttons (login check on click)
- Restrict translation editor to senior_editor/admin only (canManage)
- Fix save: map ingredient oil→oil_name for API, reload recipes after
- Ensures next open shows the saved data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 21:59:41 +00:00
parent 86be739667
commit 2088019ed7

View File

@@ -5,7 +5,7 @@
<div v-if="viewMode === 'card'" class="detail-card-view"> <div v-if="viewMode === 'card'" class="detail-card-view">
<!-- Top bar with close + edit --> <!-- Top bar with close + edit -->
<div class="card-header"> <div class="card-header">
<div class="card-top-actions" v-if="authStore.isLoggedIn"> <div class="card-top-actions">
<button class="action-btn action-btn-fav action-btn-sm" @click="handleToggleFavorite"> <button class="action-btn action-btn-fav action-btn-sm" @click="handleToggleFavorite">
{{ isFav ? ' 已收藏' : ' 收藏' }} {{ isFav ? ' 已收藏' : ' 收藏' }}
</button> </button>
@@ -122,7 +122,7 @@
<button class="action-btn" @click="saveImage">💾 保存图片</button> <button class="action-btn" @click="saveImage">💾 保存图片</button>
<button class="action-btn" @click="copyText">📋 复制文字</button> <button class="action-btn" @click="copyText">📋 复制文字</button>
<button <button
v-if="cardLang === 'en'" v-if="cardLang === 'en' && authStore.canManage"
class="action-btn" class="action-btn"
@click="showTranslationEditor = true" @click="showTranslationEditor = true"
> 修改翻译</button> > 修改翻译</button>
@@ -787,9 +787,10 @@ async function saveRecipe() {
name: editName.value.trim(), name: editName.value.trim(),
note: editNote.value.trim(), note: editNote.value.trim(),
tags: editTags.value, tags: editTags.value,
ingredients, ingredients: ingredients.map(i => ({ oil_name: i.oil, drops: i.drops })),
} }
await recipesStore.saveRecipe(payload) await recipesStore.saveRecipe(payload)
await recipesStore.loadRecipes()
ui.showToast('保存成功') ui.showToast('保存成功')
emit('close') emit('close')
} catch (e) { } catch (e) {