优化设备控制,提交后,实时获取设备返回状态信息

This commit is contained in:
fengerli
2025-08-14 13:46:57 +08:00
parent d8edb9f31e
commit e56bbfe674
15 changed files with 1104 additions and 383 deletions

View File

@ -128,9 +128,9 @@
</view> -->
<view class="mode-section">
<view class="mode-buttons">
<view v-for="(item, index) in modeItems" :key="index" class="mode-v1" :class="{ 'active-mode': selectedIndex === index }">
<view class="mode-v2"
@click="handleModeClick(index)">
<view v-for="(item, index) in modeItems" :key="index" class="mode-v1"
:class="{ 'active-mode': selectedIndex === index }">
<view class="mode-v2" @click="handleModeClick(index)">
<image :src="item.image" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">{{ item.title }}</view>
@ -249,23 +249,31 @@
<script>
// 弹框配置中心
const POPUP_CONFIGS = {
// 人员信息发送
person: {
config: {
icon: '/static/images/common/sendSucc.png',
message: '信息发送成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
},
// 开机log
// 上传开机log
logo: {
config: {
icon: '/static/images/common/upload.png',
message: '上传成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
},
// 电量低于20%.提示框
bettery: {
config: {
title: '设备电量低于20%',
@ -276,24 +284,24 @@
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true
},
onConfirm() {
console.log('确认按钮');
confirm() {
return true; // 直接关闭
}
},
// 解除报警关闭的那个提示
cancel: {
config: {
titleColor: 'rgba(224, 52, 52, 1)',
icon: '/static/images/common/svg.png',
icon: '/static/images/6170/svg.png',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true //取消按钮
},
onConfirm() {
confirm() {
console.log('解除报警确认');
}
},
// 手动报警弹框
del: {
config: {
message: '确定开启报警?',
@ -302,8 +310,26 @@
confirmBtnBg: 'rgba(255, 200, 78, 1)',
showCancel: true
},
onConfirm() {
console.log('删除确认');
confirm() {
return 'alarmCountdown'; //点击确认,再次弹框,解除报警,再次报警的类型
}
},
// 手动报警再次弹框 再次报警,解除报警指令
alarmCountdown: {
config: {
title: '报警倒计时',
icon: '/static/images/6170/svg.png',
message: '59秒',
popupBorder: '1rpx solid rgba(224, 52, 52, 1)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
cancelBtnColor:"rgba(224, 52, 52, 1)",
confirmBtnColor:"rgba(255, 255, 255, 0.87)",
confirmText: '解除报警',
cancelText:"再次报警",
showCancel: true //取消按钮
},
confirm() {
console.log('解除报警确认');
}
},
// 自动报警
@ -320,9 +346,8 @@
confirmBtnColor: "rgba(255, 255, 255, 0.87)",
showCancel: false,
},
onConfirm() {
console.log('自动报警确认');
// 这里可以添加自动报警的逻辑
confirm() {
console.log('自动报警解除报警的弹框');
}
}
@ -437,12 +462,19 @@
this.currentPopup = {
show: true,
config: POPUP_CONFIGS[type].config,
callback: POPUP_CONFIGS[type].onConfirm
callback: POPUP_CONFIGS[type].confirm
}
},
handleConfirm() {
this.currentPopup.show = false;
console.log('这是点击了确认');
if (this.currentPopup.callback) {
const nextPopupType = this.currentPopup.callback(); // 执行回调并获取下一个弹框类型
this.currentPopup.show = false; // 关闭当前弹框
if (nextPopupType) {
this.showPopup(nextPopupType); // 打开下一个弹框
}
} else {
this.currentPopup.show = false; // 默认关闭
}
},
// 统一处理取消
handleCancel() {
@ -888,7 +920,8 @@
.mode-v1.active-mode .battery-v2 {
color: #BBE600 !important;
}
.mode-v1.active-mode .mode-v3{
.mode-v1.active-mode .mode-v3 {
color: #BBE600 !important;
}