From 6c5a702ff9bd74f07eac5a4f1d4bda2bd6aa9590 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Tue, 5 Aug 2025 19:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=89=93=E7=82=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/6170/callPolice.js | 9 ++ components/CustomPopup/CustomPopup.vue | 4 +- manifest.json | 3 +- pages/210/deviceControl/index.vue | 2 +- pages/6170/callPolice/index.vue | 38 +++-- pages/6170/deviceControl/index.vue | 34 ++--- pages/common/index/index.vue | 11 +- pages/common/map/index.vue | 191 ++++++++++++++++++------- pages/common/send/index.vue | 2 +- static/images/common/device.png | Bin 0 -> 4229 bytes 10 files changed, 208 insertions(+), 86 deletions(-) create mode 100644 api/6170/callPolice.js create mode 100644 static/images/common/device.png diff --git a/api/6170/callPolice.js b/api/6170/callPolice.js new file mode 100644 index 0000000..cebbd97 --- /dev/null +++ b/api/6170/callPolice.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' +//报警 +export function deviceSendAlarmMessage(data) { + return request({ + url: '/app/device/sendAlarmMessage', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/components/CustomPopup/CustomPopup.vue b/components/CustomPopup/CustomPopup.vue index f18221b..3a50afd 100644 --- a/components/CustomPopup/CustomPopup.vue +++ b/components/CustomPopup/CustomPopup.vue @@ -139,7 +139,7 @@ }, popupBg: { type: String, - default: 'rgb(42, 42, 42)' + default: 'rgb(42, 42, 42, 0.9)' }, popupRadius: { type: String, @@ -267,7 +267,7 @@ left: 0; right: 0; bottom: 0; - background-color: rgba(0, 0, 0, 1); + background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; diff --git a/manifest.json b/manifest.json index 8253fa2..5a09c99 100644 --- a/manifest.json +++ b/manifest.json @@ -84,7 +84,8 @@ "name" : "amapHG8nIFW5", "appkey_ios" : "065c43f02c7b627a74ad7dd23b16bb4f", "appkey_android" : "d7d852dbda2b95f6f796fb9a711a9fee" - } + }, + "customStyle": true }, "oauth" : {}, "push" : {} diff --git a/pages/210/deviceControl/index.vue b/pages/210/deviceControl/index.vue index 2547f70..b9970b1 100644 --- a/pages/210/deviceControl/index.vue +++ b/pages/210/deviceControl/index.vue @@ -6,7 +6,7 @@ diff --git a/pages/6170/callPolice/index.vue b/pages/6170/callPolice/index.vue index 2907694..6f10be6 100644 --- a/pages/6170/callPolice/index.vue +++ b/pages/6170/callPolice/index.vue @@ -35,11 +35,13 @@ + :show-cancel="false" @close="onclosePopup" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" + confirmBtnColor="#fff" /> + :show-cancel="false" @close="onclosePopup" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" + confirmBtnColor="#fff" /> @@ -49,8 +51,8 @@ deviceInfo, } from '@/api/common/index.js' import { - deviceSendMessage - } from '@/api/6170/deviceControl.js' + deviceSendAlarmMessage + } from '@/api/6170/callPolice.js' export default { components: { CustomPopup @@ -64,6 +66,7 @@ popupMessage: '确认要对所选设备开启强制报警?', popupConfirmText: '确认', popupType: 'force', // 'force' or 'cancel' + pendingAlarmAction: '' } }, computed: { @@ -72,6 +75,9 @@ } }, methods: { + onclosePopup() { + this.showPopupFlag = false + }, toggleSelect(index) { this.deviceList[index].checked = !this.deviceList[index].checked this.$forceUpdate() @@ -122,6 +128,8 @@ this.popupType = 'force'; this.popupMessage = '确认要对所选设备开启强制报警?'; this.showPopupFlag = true; + this.pendingAlarmAction = 1 + }, // 解除报警 cancelAlarm() { @@ -136,6 +144,8 @@ this.popupType = 'cancel'; this.popupMessage = '确认要解除所选设备的报警状态?'; this.showPopupFlag = true; + this.pendingAlarmAction = 1 + }, sendAlarmCommand(type) { const selectedDevices = this.deviceList.filter(item => item.checked); @@ -143,12 +153,20 @@ let data = { deviceIds: deviceIds, - commandType: type // '强制或者解除' + instructValue: this.pendingAlarmAction, // '强制或者解除' } - - deviceSendMessage(data).then((res) => { + deviceSendAlarmMessage(data).then((res) => { if (res.code == 200) { - this.showPopupFlag = true; + uni.showToast({ + title: res.msg, + icon: 'none' + }); + this.showPopupFlag = false + setTimeout(() => { + uni.navigateBack() + }, 500) + + } else { uni.showToast({ title: res.msg, @@ -159,10 +177,8 @@ }, // 点击确认状态 onPopupConfirm() { - this.showPopupFlag = false - uni.navigateBack() - console.log('用户点击了确定') this.sendAlarmCommand(this.popupType); + // 处理确认逻辑 }, }, diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 7d99346..2c8bd0c 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -222,9 +222,9 @@ - 确认开启激光模式? + {{ isLaserOn ? '确认关闭激光模式?' : '确认开启激光模式?' }} - + 注意事项 1.禁止直视光源或反射面! 2.避免直射人或易燃物! @@ -326,7 +326,7 @@ file: '', selectedItemIndex: 0, popupType: 'person', //弹框类型 - timer: null + isLaserOn: false } }, computed: { @@ -346,20 +346,13 @@ // 添加调试日志 uni.navigateTo({ url: '/pages/common/map/index', - success: (res) => { - // 确保使用深拷贝 - const mapData = { - deviceLocation: { - longitude: String(item.longitude), // 强制转为字符串 - latitude: String(item.latitude), - deviceImage: item.devicePic || '', - deviceName: item.deviceImei || '' - } - } - res.eventChannel.emit('MapData', JSON.parse(JSON.stringify(mapData))) + events: { + ack: function(data) {} }, - fail: (err) => { - + success: (res) => { + res.eventChannel.emit('Map', { + data: item + }); } }) }, @@ -558,9 +551,10 @@ }, // 激光确认框提交 handleBtn() { + const instructValue = this.isLaserOn ? 0 : 1; let data = { deviceId: this.deviceID, - instructValue: 1 + instructValue: instructValue } laserModeSettings(data).then((res) => { if (res.code == 200) { @@ -568,6 +562,7 @@ icon: 'none', title: res.msg }) + this.isLaserOn = !this.isLaserOn; this.lightModeC = false } else { uni.showToast({ @@ -885,7 +880,8 @@ this.mqttClient.subscribe(statusTopic, (payload) => { console.log(`收到来自 ${statusTopic} 的消息:`, payload); //收到电量上报。延迟20s请求接口数据 - const parsedMessage = typeof payload === 'string' ? JSON.parse(payload) : payload; + const parsedMessage = typeof payload === 'string' ? JSON.parse(payload) : + payload; const deviceState = parsedMessage.state; // 直接取 state 数组 // ✅ 发送全局事件通知主页面更新 uni.$emit('deviceStatusUpdate', { @@ -896,7 +892,7 @@ setTimeout(() => { this.fetchDeviceDetail(data.data.id); }, 20000); - + // 这里判断电量低于20%,弹框提示 if (this.deviceInfo.batteryPercentage < 20) { this.popupType = 'bettery' diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index ddc6000..7bb31d6 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -442,7 +442,16 @@ // 位置 location() { uni.navigateTo({ - url: '/pages/common/map/index' + url: '/pages/common/map/index', + events: { + ack: function(data) {} + }, + success: (res) => { + // 页面跳转成功后的回调函数 + res.eventChannel.emit('Map', { + data: this.deviceList, + }); + } }) }, handleFile(item) { diff --git a/pages/common/map/index.vue b/pages/common/map/index.vue index fa1488b..f2c2265 100644 --- a/pages/common/map/index.vue +++ b/pages/common/map/index.vue @@ -1,73 +1,151 @@ + - + \ No newline at end of file diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index ef21f1e..34806e3 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -32,7 +32,7 @@ 编辑信息