feat: Header重排、共享配方到公共库、待审核配方、权限优化 #17

Merged
fam merged 39 commits from fix/ui-polish-round2 into main 2026-04-09 18:37:12 +00:00
Showing only changes of commit 9dbaf95839 - Show all commits

View File

@@ -611,16 +611,17 @@ async function applyTranslation() {
showTranslationEditor.value = false
let saved = 0
// 1. Save recipe English name
// 1. Save recipe English name (no version check — only updating en_name)
if (recipe.value._id && customRecipeNameEn.value) {
try {
await api.put(`/api/recipes/${recipe.value._id}`, {
en_name: customRecipeNameEn.value,
version: recipe.value._version,
})
recipe.value.en_name = customRecipeNameEn.value
saved++
} catch {}
} catch (e) {
console.error('Save recipe en_name failed:', e)
}
}
// 2. Save each oil's English name to oils table (syncs with oil reference page)
@@ -639,9 +640,16 @@ async function applyTranslation() {
}
}
if (saved > 0) ui.showToast(`翻译已保存(${saved}项)` + (failed > 0 ? `${failed}项失败` : ''))
else if (failed > 0) ui.showToast(`保存失败 ${failed}`)
else ui.showToast('没有修改')
if (saved > 0) {
ui.showToast(`翻译已保存(${saved}项)` + (failed > 0 ? `${failed}项失败` : ''))
// Reload data so next open shows updated names
recipesStore.loadRecipes()
oilsStore.loadOils()
} else if (failed > 0) {
ui.showToast(`保存失败 ${failed}`)
} else {
ui.showToast('没有修改')
}
cardImageUrl.value = null
nextTick(() => generateCardImage())