fix: 保存配方卡片所有英文翻译(含精油名称) #16

Closed
yoyo wants to merge 1 commits from fix/save-oil-translations into main
Collaborator

问题

点击「应用」保存翻译后,下次打开配方卡片精油的英文名会重置回默认值,因为只有 en_name(配方名)被持久化了,精油名称的自定义翻译(customOilNameEn)只存在内存里。

修复

  • backend/database.pyrecipes 表新增 en_oils 列(存 JSON 字符串)
  • backend/main.pyRecipeUpdate 增加 en_oils 字段;update_recipe 写入 DB;所有 SELECT 和 _recipe_to_dict 补上该字段
  • frontend/stores/recipes.js — store 映射 en_oils
  • frontend/RecipeDetailOverlay.vueapplyTranslation() 同时提交 en_oilsonMounted 优先从 r.en_oils 还原,再 fallback 静态翻译表

Closes #15

## 问题 点击「应用」保存翻译后,下次打开配方卡片精油的英文名会重置回默认值,因为只有 `en_name`(配方名)被持久化了,精油名称的自定义翻译(`customOilNameEn`)只存在内存里。 ## 修复 - **backend/database.py** — `recipes` 表新增 `en_oils` 列(存 JSON 字符串) - **backend/main.py** — `RecipeUpdate` 增加 `en_oils` 字段;`update_recipe` 写入 DB;所有 SELECT 和 `_recipe_to_dict` 补上该字段 - **frontend/stores/recipes.js** — store 映射 `en_oils` - **frontend/RecipeDetailOverlay.vue** — `applyTranslation()` 同时提交 `en_oils`;`onMounted` 优先从 `r.en_oils` 还原,再 fallback 静态翻译表 Closes #15
yoyo added 17 commits 2026-04-08 19:58:03 +00:00
- RecipeDetailOverlay: 未上传二维码/背景图时,卡片上方显示提示横幅,下方出现「上传我的二维码」按钮,点击跳转到 MyDiary 品牌设置页并记录来源配方
- MyDiary: 新增二维码图片上传区域(直接上传图片文件,存为 base64 → PUT /api/brand qr_code 字段);上传成功后若有待返回配方则自动跳回配方卡片;修复 loadBrandSettings 字段名与后端不一致的问题
- RecipeSearch: 支持 ?openRecipe= 查询参数,页面挂载时自动打开指定配方卡片,实现从 MyDiary 上传后无缝返回

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: 未登录用户也显示二维码上传提示,点击时引导登录/注册
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
PR Preview / test (pull_request) Successful in 4s
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 1m8s
955512d344
fix: 卡片预览加入容量切换,非单次滴数四舍五入
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 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Has been cancelled
dee4b1649a
- VOLUME_DROPS 新增「单次」(null,不缩放)
- 新增 scaleIngredients() 按比例缩放成分
- 卡片预览区加入容量切换按钮,切换后实时更新滴数与成本
- priceInfo 与 coconutDrops 均基于缩放后数据

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix LoginModal z-index to 6000 so it appears above recipe overlay
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 4s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 1m4s
b9681141af
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Raise toast z-index to 9000 so it shows above all overlays
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 13s
Test / e2e-test (push) Has been cancelled
edc053ae0e
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove volume selector from recipe card view
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 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Has been cancelled
3bbe437616
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shorten copy toast to just '已复制'
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 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 1m4s
4d5e3c46e7
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix toast rendering: display toast.msg instead of object
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 12s
Test / e2e-test (push) Failing after 1m7s
5eba04a1fa
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resume pending action after login (favorite, diary, QR upload)
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 13s
Test / e2e-test (push) Failing after 1m4s
96504ed1d7
Add pendingAction callback to UI store. When user clicks favorite,
save-to-diary, or upload QR while not logged in, the action is stored
and automatically executed after successful login/register instead of
reloading the page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: 顶部导航栏sticky修正、右上角显示角色身份、QR上传预览布局优化
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 13s
Test / e2e-test (push) Has been cancelled
19f4ab8abe
- 预览环境下nav-tabs top偏移36px,避免被orange banner遮挡
- 登录用户名旁显示角色身份(查看者/编辑/管理员等)
- 账户页角色改用绿色渐变徽章样式,对齐UserMenu风格
- QR图片上传区改为120x120居中方形,预览样式与二维码链接预览一致

Closes #9 (part: items 1-3, accumulated to PR #5)

Co-Authored-By: YoYo <yoyo@euphon.net>
QR upload: replace inline hint with dialog, add back button in brand page
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 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 1m21s
65239abc53
- Replace the inline brand-upload-hint bar in RecipeDetailOverlay with a
  confirm dialog (「去上传」/「取消」) that pops up when the card opens
- Extend useDialog/CustomDialog to support custom ok/cancel button text
- Add a 「← 返回配方卡片」banner in MyDiary brand tab when navigated
  from a recipe card, allowing return without uploading

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: 存为我的改用自定义 showPrompt,与主分支保持一致
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 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Failing after 1m18s
4761253d73
将 saveToDiary 中的原生 prompt() 替换为项目内置的
showPrompt(),使对话框样式与主分支及全站风格保持一致。

Co-Authored-By: YoYo <yoyo@euphon.net>
fix: 配方卡片品牌样式与 initial commit 保持一致
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 15s
Test / e2e-test (push) Failing after 1m16s
de74ffe638
- 背景图改用 div+background-image,opacity 从 0.06 恢复为 0.12
- 二维码位置改回 top:36px/right:24px,尺寸 54×54,加圆角和阴影
- 二维码下方新增品牌名称小字(7px)
- Logo 位置改回 bottom:60px,尺寸 height:60px,opacity 0.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: 上传图片后不再自动跳转,由用户手动点击返回配方卡片
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 5s
PR Preview / deploy-preview (pull_request) Successful in 12s
Test / e2e-test (push) Failing after 1m21s
533cd2a0bd
Co-Authored-By: YoYo <yoyo@euphon.net>
将 handleLogout 里的 window.location.reload() 改为 router.push('/'),
确保在任何需要登录的页面退出后都能回到配方查询页面。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: 移除所有权限身份显示,QR上传布局还原为initial commit样式
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 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 1m19s
dcf516f2de
fix: 保存配方卡片所有英文翻译(含精油名称)
Some checks failed
Test / unit-test (push) Successful in 7s
Test / build-check (push) Successful in 3s
Test / e2e-test (push) Failing after 1m19s
PR Preview / test (pull_request) Has been skipped
PR Preview / teardown-preview (pull_request) Successful in 14s
PR Preview / deploy-preview (pull_request) Has been skipped
42aefaab17
之前保存翻译时只保存了配方名的 en_name,精油的自定义英文名
(customOilNameEn)没有持久化,刷新后丢失。

- backend: recipes 表新增 en_oils(JSON 字符串)列
- RecipeUpdate 模型增加 en_oils 字段,update_recipe 写入 DB
- 所有 SELECT 语句补上 en_oils,_recipe_to_dict 返回该字段
- frontend: applyTranslation() 同时提交 en_oils
- onMounted 优先从 r.en_oils 还原精油译名,再 fallback 静态表
- recipes store 映射 en_oils 字段

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner

🚀 Preview: https://pr-16.oil.oci.euphon.net

DB is a copy of production.

🚀 **Preview**: https://pr-16.oil.oci.euphon.net DB is a copy of production.
hera closed this pull request 2026-04-10 20:29:47 +00:00
Owner

🗑️ Preview torn down.

🗑️ Preview torn down.
Some checks failed
Test / unit-test (push) Successful in 7s
Test / build-check (push) Successful in 3s
Test / e2e-test (push) Failing after 1m19s
PR Preview / test (pull_request) Has been skipped
PR Preview / teardown-preview (pull_request) Successful in 14s
PR Preview / deploy-preview (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hera/oil-formula-calculator#16