feat: 调料弹窗新增重置按钮 + 清空按钮改为重量归零
- 下拉选择框右侧新增"重置"按钮,点击清除调料选择 - "清空"按钮行为调整:仅将重量归零,保留调料名称 - 信息格(油)重置恢复默认1000g,清空归零 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
eb762a0435
commit
5d02e675ae
@@ -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 @@
|
||||
选择调料
|
||||
<span class="select-panel__pos-tag" id="posTag">位置 --</span>
|
||||
</div>
|
||||
<div class="select-panel__select-wrap">
|
||||
<select class="select-panel__select" id="seasoningSelect">
|
||||
<option value="">-- 请选择调料 --</option>
|
||||
</select>
|
||||
<span class="select-panel__select-arrow">▼</span>
|
||||
<div class="select-panel__select-row">
|
||||
<div class="select-panel__select-wrap">
|
||||
<select class="select-panel__select" id="seasoningSelect">
|
||||
<option value="">-- 请选择调料 --</option>
|
||||
</select>
|
||||
<span class="select-panel__select-arrow">▼</span>
|
||||
</div>
|
||||
<button class="select-panel__btn--reset-inline" id="resetInlineBtn" onclick="resetSlot()">重置</button>
|
||||
</div>
|
||||
<div class="select-panel__weight-row">
|
||||
<span class="select-panel__weight-label">放置重量:</span>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
/* 关闭选择 */
|
||||
|
||||
Reference in New Issue
Block a user