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 5s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Has been cancelled
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 16s
Test / e2e-test (push) Has been cancelled
编辑器: - 顶部容量选择: 单次/5ml/10ml/15ml/20ml/30ml/自定义 - 椰子油默认在最底行,单次时可编辑滴数(默认10) - 非单次时椰子油自动填满(显示"约Xml") - 实时提示:单次显示滴数+稀释比例,非单次显示总容量+填满+比例 - 新增精油插入到椰子油上方 - 编辑已有配方自动识别容量和稀释比例 其他: - 拼音搜索改前缀匹配 - 输入法enter不触发保存 - 导出Excel移到标签行右侧小图标 - 新增→新增, 标签筛选→标签 - 配方名过长自动缩小 - 已审核标签viewer不可见 - ml显示整数 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -842,6 +842,22 @@ onMounted(() => {
|
||||
})
|
||||
customOilNameEn.value = enMap
|
||||
|
||||
// Calculate current dilution ratio and volume from ingredients
|
||||
const ings = r.ingredients || []
|
||||
const coco = ings.find(i => i.oil === '椰子油')
|
||||
const eoDrops = ings.filter(i => i.oil && i.oil !== '椰子油').reduce((s, i) => s + (i.drops || 0), 0)
|
||||
const cocoDrops = coco ? (coco.drops || 0) : 0
|
||||
const totalDrops = eoDrops + cocoDrops
|
||||
if (eoDrops > 0 && cocoDrops > 0) {
|
||||
dilutionRatio.value = Math.round(cocoDrops / eoDrops)
|
||||
}
|
||||
const ml = totalDrops / DROPS_PER_ML
|
||||
if (ml <= 1.5) selectedVolume.value = 'single'
|
||||
else if (Math.abs(ml - 5) < 1.5) selectedVolume.value = '5'
|
||||
else if (Math.abs(ml - 10) < 3) selectedVolume.value = '10'
|
||||
else if (Math.abs(ml - 30) < 8) selectedVolume.value = '30'
|
||||
else { selectedVolume.value = 'custom'; customVolumeValue.value = Math.round(totalDrops); customVolumeUnit.value = 'drops' }
|
||||
|
||||
loadBrand()
|
||||
nextTick(() => generateCardImage())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user