From 5d02e675aecc86cf8e9cb2529e14d824a11b5d84 Mon Sep 17 00:00:00 2001 From: zhangyan Date: Mon, 6 Jul 2026 10:01:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=96=99=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=8D=E7=BD=AE=E6=8C=89=E9=92=AE=20+=20?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E6=8C=89=E9=92=AE=E6=94=B9=E4=B8=BA=E9=87=8D?= =?UTF-8?q?=E9=87=8F=E5=BD=92=E9=9B=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 下拉选择框右侧新增"重置"按钮,点击清除调料选择 - "清空"按钮行为调整:仅将重量归零,保留调料名称 - 信息格(油)重置恢复默认1000g,清空归零 Co-Authored-By: Claude Opus 4.6 --- .../ratio-scale/04-seasoning-settings.html | 69 ++++++++++++++----- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/other-module/canteen-device/ratio-scale/04-seasoning-settings.html b/other-module/canteen-device/ratio-scale/04-seasoning-settings.html index c684629..95e2285 100644 --- a/other-module/canteen-device/ratio-scale/04-seasoning-settings.html +++ b/other-module/canteen-device/ratio-scale/04-seasoning-settings.html @@ -129,7 +129,15 @@ font-size: 11px; padding: 2px 8px; border-radius: 4px; background: rgba(74,144,217,0.15); color: #4a90d9; font-weight: 600; } - .select-panel__select-wrap { position: relative; } + .select-panel__select-wrap { position: relative; flex: 1; } + .select-panel__select-row { display: flex; gap: 8px; align-items: center; } + .select-panel__btn--reset-inline { + padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; + cursor: pointer; transition: all 0.2s; border: none; font-family: inherit; flex-shrink: 0; + background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5); + border: 1px solid rgba(255,255,255,0.1); + } + .select-panel__btn--reset-inline:hover { background: rgba(255,255,255,0.1); color: #fff; } .select-panel__select { width: 100%; padding: 10px 14px; background: #121832; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; @@ -220,11 +228,14 @@ 选择调料 位置 -- -
- - +
+
+ + +
+
放置重量: @@ -351,14 +362,14 @@ function openSelect(pos) { editingPos = pos; document.getElementById('posTag').textContent = pos === 0 ? '信息格 (油)' : '位置 ' + pos; - /* 信息格时调整标题和按钮 */ - var clearBtn = document.querySelector('.select-panel__btn--clear'); + /* 信息格时调整标题 */ + var resetBtn = document.getElementById('resetInlineBtn'); if (pos === 0) { document.querySelector('.select-panel__title').firstChild.textContent = '修改油量 '; - clearBtn.textContent = '重置'; + resetBtn.textContent = '恢复默认'; } else { document.querySelector('.select-panel__title').firstChild.textContent = '选择调料 '; - clearBtn.textContent = '清空'; + resetBtn.textContent = '重置'; } /* 填充下拉选项 */ @@ -414,20 +425,42 @@ showToast('位置 ' + editingPos + ' 已配置为 ' + name + ' (' + weight + 'g)', 1500, 'success'); } - /* 清空位置 */ + /* 清空位置(重量归零,保留调料名称) */ function clearSlot() { if (editingPos === 0) { - /* 信息格恢复默认重量 */ - config[0] = { name: '油', weight: 1000 }; + /* 信息格重量归零 */ + config[0] = { name: '油', weight: 0 }; + document.getElementById('seasoningWeight').value = '0'; renderGrid(); - closeSelect(); - showToast('油重量已重置为 1000g', 1500, 'success'); + showToast('油重量已清零', 1500, 'success'); return; } - delete config[editingPos]; + if (config[editingPos] && config[editingPos].name) { + config[editingPos].weight = 0; + } else { + config[editingPos] = { name: '', weight: 0 }; + } + document.getElementById('seasoningWeight').value = '0'; renderGrid(); - closeSelect(); - showToast('位置 ' + editingPos + ' 已清空', 1500, 'success'); + showToast('位置 ' + editingPos + ' 重量已清零', 1500, 'success'); + } + + /* 重置调料选择(清除下拉选中,清空重量输入) */ + function resetSlot() { + var select = document.getElementById('seasoningSelect'); + var weightInput = document.getElementById('seasoningWeight'); + if (editingPos === 0) { + /* 信息格:重量恢复默认值 */ + select.value = '油'; + weightInput.value = '1000'; + config[0] = { name: '油', weight: 1000 }; + renderGrid(); + showToast('油重量已恢复默认 1000g', 1500, 'success'); + return; + } + select.value = ''; + weightInput.value = ''; + showToast('位置 ' + editingPos + ' 调料选择已清除', 1500, 'success'); } /* 关闭选择 */