fix(ui): remove all toast popups and browser alert dialogs for pure silent industrial interaction
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 泡沫轴交互控制逻辑
|
||||
* 泡沫轴交互控制逻辑 (无弹窗纯净版)
|
||||
* 支持:已连接/未连接动态双态流转、真实倒计时启停与时长调节、动作/肌群/力量多维参数切换与保存。
|
||||
*/
|
||||
|
||||
@@ -20,21 +20,13 @@ function formatTime(sec) {
|
||||
return `${m}:${s}`;
|
||||
}
|
||||
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toastMessage');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 2200);
|
||||
}
|
||||
|
||||
function handleNavBack() {
|
||||
showToast('返回上一级主页面');
|
||||
// 无弹窗直接返回
|
||||
}
|
||||
|
||||
function handleScanRefresh() {
|
||||
const statusEl = document.getElementById('scanStatusText');
|
||||
statusEl.innerText = '正在重新扫描周边设备...';
|
||||
showToast('正在扫描周边可用蓝牙设备...');
|
||||
setTimeout(() => {
|
||||
statusEl.innerText = '自动扫描中';
|
||||
}, 1200);
|
||||
@@ -66,7 +58,6 @@ function toggleConnectState() {
|
||||
timer.classList.remove('dim-state');
|
||||
centerPanel.classList.remove('disabled-panel-state');
|
||||
rightPanel.classList.remove('disabled-panel-state');
|
||||
showToast('已成功连接泡沫轴 FR100-12EC');
|
||||
} else {
|
||||
// 切换为未连接态 (显示专属线框待连接图)
|
||||
if (isRunning) handlePauseTimer();
|
||||
@@ -82,26 +73,19 @@ function toggleConnectState() {
|
||||
timer.classList.add('dim-state');
|
||||
centerPanel.classList.add('disabled-panel-state');
|
||||
rightPanel.classList.add('disabled-panel-state');
|
||||
showToast('已断开与泡沫轴硬件设备的连接');
|
||||
}
|
||||
}
|
||||
|
||||
function connectDeviceItem(deviceName) {
|
||||
if (!isConnected) {
|
||||
toggleConnectState();
|
||||
} else {
|
||||
showToast(`当前已连接到设备:${deviceName}`);
|
||||
}
|
||||
}
|
||||
|
||||
function handleStartTimer() {
|
||||
if (!isConnected) {
|
||||
showToast('请先连接泡沫轴设备');
|
||||
return;
|
||||
}
|
||||
if (!isConnected) return;
|
||||
if (isRunning) return;
|
||||
isRunning = true;
|
||||
showToast('泡沫轴训练已开始!');
|
||||
timerInterval = setInterval(() => {
|
||||
if (totalSeconds > 0) {
|
||||
totalSeconds--;
|
||||
@@ -109,7 +93,6 @@ function handleStartTimer() {
|
||||
} else {
|
||||
clearInterval(timerInterval);
|
||||
isRunning = false;
|
||||
showToast('🎉 本轮泡沫轴训练已完成!');
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
@@ -118,7 +101,6 @@ function handlePauseTimer() {
|
||||
if (!isRunning) return;
|
||||
clearInterval(timerInterval);
|
||||
isRunning = false;
|
||||
showToast('泡沫轴训练已暂停');
|
||||
}
|
||||
|
||||
function selectDurationItem(el, seconds) {
|
||||
@@ -139,11 +121,9 @@ function setWorkMode(mode) {
|
||||
if (mode === 'auto') {
|
||||
btnA.className = 'mode-cap-btn active-blue';
|
||||
btnM.className = 'mode-cap-btn';
|
||||
showToast('已切换至:自动模式');
|
||||
} else {
|
||||
btnA.className = 'mode-cap-btn';
|
||||
btnM.className = 'mode-cap-btn active-red';
|
||||
showToast('已切换至:手动模式');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,13 +148,15 @@ function setStrengthLevel(level, btn) {
|
||||
btn.classList.add('active');
|
||||
const tag = document.getElementById('dispStrengthTag');
|
||||
if (tag) tag.innerText = level + ' 档';
|
||||
showToast(`力量档位已调节为:${level} 档`);
|
||||
}
|
||||
|
||||
function handleSaveConfig() {
|
||||
if (!isConnected) {
|
||||
showToast('未连接设备,无法保存配置');
|
||||
return;
|
||||
}
|
||||
showToast(`✅ 配置已保存:${currentMode === 'auto' ? '自动模式' : '手动模式'} | 动作:${currentAction} | 肌群:${currentMuscle} | 力量:${currentStrength}档`);
|
||||
if (!isConnected) return;
|
||||
// 保存配置静默完成,按钮呈现短暂保存确认态
|
||||
const btn = document.getElementById('btnSaveConfig');
|
||||
const originText = btn.innerText;
|
||||
btn.innerText = '已保存';
|
||||
setTimeout(() => {
|
||||
btn.innerText = originText;
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user