From 3ab58ac29e754db37c02f81f0c21892284dd9723 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 8 Aug 2025 17:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D6170=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=B8=AD=E5=87=BA=E7=8E=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/6170/callPolice.js | 2 +- api/6170/deviceControl.js | 14 +-- pages/6170/allShare/index.vue | 9 +- pages/6170/callPolice/index.vue | 6 +- pages/6170/deviceControl/index.vue | 146 +++++++++++++++++++++------ pages/common/index/index.vue | 2 +- static/images/common/chargeState.png | Bin 0 -> 966 bytes utils/request.js | 2 +- 8 files changed, 132 insertions(+), 49 deletions(-) create mode 100644 static/images/common/chargeState.png diff --git a/api/6170/callPolice.js b/api/6170/callPolice.js index cebbd97..88a5e01 100644 --- a/api/6170/callPolice.js +++ b/api/6170/callPolice.js @@ -2,7 +2,7 @@ import request from '@/utils/request' //报警 export function deviceSendAlarmMessage(data) { return request({ - url: '/app/device/sendAlarmMessage', + url: '/app/bjq/device/sendAlarmMessage', method: 'post', data: data }) diff --git a/api/6170/deviceControl.js b/api/6170/deviceControl.js index 75b1f25..e257231 100644 --- a/api/6170/deviceControl.js +++ b/api/6170/deviceControl.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function deviceDetail(id) { return request({ - url: `/app/device/${id}`, + url: `/app/bjq/device/${id}`, method: 'get', }) } @@ -16,7 +16,7 @@ export function deviceShareId(id) { // 人员信息登记 export function registerPersonInfo(data) { return request({ - url: `/app/device/registerPersonInfo`, + url: `/app/bjq/device/registerPersonInfo`, method: 'post', data: data }) @@ -24,7 +24,7 @@ export function registerPersonInfo(data) { // 发送信息 export function deviceSendMessage(data) { return request({ - url: `/app/device/sendMessage`, + url: `/app/bjq/device/sendMessage`, method: 'post', data: data }) @@ -32,7 +32,7 @@ export function deviceSendMessage(data) { // 灯光模式设置 export function lightModeSettings(data) { return request({ - url: `/app/device/lightModeSettings`, + url: `/app/bjq/device/lightModeSettings`, method: 'post', data: data }) @@ -40,7 +40,7 @@ export function lightModeSettings(data) { // 激光模式设置 export function laserModeSettings(data) { return request({ - url: `/app/device/laserModeSettings`, + url: `/app/bjq/device/laserModeSettings`, method: 'post', data: data }) @@ -49,7 +49,7 @@ export function laserModeSettings(data) { export function lightBrightnessSettings(data) { return request({ - url: `/app/device/lightBrightnessSettings`, + url: `/app/bjq/device/lightBrightnessSettings`, method: 'post', data: data }) @@ -57,7 +57,7 @@ export function lightBrightnessSettings(data) { // 地图逆解析 export function mapReverseGeocoding(data) { return request({ - url: `/app/device/mapReverseGeocoding`, + url: `/app/bjq/device/mapReverseGeocoding`, method: 'post', data: data }) diff --git a/pages/6170/allShare/index.vue b/pages/6170/allShare/index.vue index 024ce1b..91c9135 100644 --- a/pages/6170/allShare/index.vue +++ b/pages/6170/allShare/index.vue @@ -40,7 +40,12 @@ ID:{{item.deviceImei}} - 在线 + + 在线 + + 离线 电量:{{item.battery || '0'}}% @@ -67,7 +72,7 @@ - + {{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }} diff --git a/pages/6170/callPolice/index.vue b/pages/6170/callPolice/index.vue index 6f10be6..1b34bd6 100644 --- a/pages/6170/callPolice/index.vue +++ b/pages/6170/callPolice/index.vue @@ -144,8 +144,7 @@ this.popupType = 'cancel'; this.popupMessage = '确认要解除所选设备的报警状态?'; this.showPopupFlag = true; - this.pendingAlarmAction = 1 - + this.pendingAlarmAction = 0 }, sendAlarmCommand(type) { const selectedDevices = this.deviceList.filter(item => item.checked); @@ -162,11 +161,10 @@ icon: 'none' }); this.showPopupFlag = false + uni.$emit('deviceStatusUpdate', {}); setTimeout(() => { uni.navigateBack() }, 500) - - } else { uni.showToast({ title: res.msg, diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 80c8473..2bc8527 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -18,14 +18,20 @@ - {{deviceInfo.batteryPercentage}}% + + {{deviceInfo.batteryPercentage}}% + 电量 + + + - {{deviceInfo.batteryRemainingTime || '0分钟'}}分钟 + {{deviceInfo.batteryRemainingTime || '0'}}分钟 续航时间 @@ -101,6 +107,7 @@ 激光模式 + {{currentlaserMode}} @@ -256,8 +263,10 @@ + @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" /> + + @@ -273,14 +282,14 @@ lightBrightnessSettings, //灯光亮度设置 mapReverseGeocoding //地图逆解析 } from '@/api/6170/deviceControl.js' - import { - getDeviceId - } from '../../../store/BLETools'; import { baseURL, getToken, clientid } from '@/utils/request' + import { + deviceSendAlarmMessage + } from '@/api/6170/callPolice.js' export default { data() { return { @@ -297,6 +306,7 @@ sliderValue: 25, lightModeA: false, currentMainMode: '强光', + currentlaserMode: "关闭", lightModeB: false, lightModeC: false, //激光提示框 items: [], @@ -311,10 +321,7 @@ position: '', code: '', }, - deviceInfo: { - - }, - + deviceInfo: {}, activePermissions: [], // 存储当前设备的权限数组 isSharedDevice: false, // 标记是否来自分享 isRightIconVisible: false, @@ -326,7 +333,24 @@ file: '', selectedItemIndex: 0, popupType: 'person', //弹框类型 - isLaserOn: false + isLaserOn: false, + // 进度条 + Progress: { + show: false, //是否显示 + height: '40rpx', + showMask: true, //是否显示mask + maskBgColor: 'rgba(0, 0, 0, 0.5)', // 半透明黑色遮罩 + contentBgColor: 'rgba(18, 18, 18, 0.8)', // 主背景带透明度 + showText: true, //是否显示当前进度的文字 + txtColor: '#ffffffde', //文字的颜色 + curr: 20, //当前进度 + total: 100, //总进度 + proBgColor: '#2a2a2a', //进度条底色, + proBorder: '', //进度条border + currBgColor: '#bbe600', //当前进度底色 + currBorder: '', //当前进度border + borderRadius: '10rpx' + } } }, computed: { @@ -448,7 +472,7 @@ this.sliderValue = value; let data = { - deviceId: this.deviceID, + deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId, instructValue: this.sliderValue + '.00' } lightBrightnessSettings(data).then((res) => { @@ -527,7 +551,7 @@ // 修正这里的赋值错误,应该保存索引而不是文本 this.selectedItemIndex = this.selectedItemIndex; let data = { - deviceId: this.deviceID, + deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId, instructValue: selectedItem.instructValue } lightModeSettings(data).then((res) => { @@ -551,9 +575,9 @@ }, // 激光确认框提交 handleBtn() { - const instructValue = this.isLaserOn ? 0 : 1; + const instructValue = this.isLaserOn ? 0 : 1; let data = { - deviceId: this.deviceID, + deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId, instructValue: instructValue } laserModeSettings(data).then((res) => { @@ -562,7 +586,8 @@ icon: 'none', title: res.msg }) - this.isLaserOn = !this.isLaserOn; + this.isLaserOn = !this.isLaserOn; + this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; // 更新显示文本 this.lightModeC = false } else { uni.showToast({ @@ -622,18 +647,20 @@ }); return; } - // 显示上传中加载提示 - uni.showLoading({ - title: '上传中...', - mask: true - }); + // 显示进度条 + this.Progress = { + ...this.Progress, + show: true, + curr: 0, + showText: true + }; uni.uploadFile({ - url: baseURL + '/app/device/uploadLogo', + url: baseURL + '/app/bjq/device/uploadLogo', filePath: this.selectedImage, name: 'file', formData: { - deviceId: this.deviceID, + deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId, }, header: { 'Authorization': 'Bearer ' + getToken(), @@ -644,9 +671,6 @@ try { const responseData = JSON.parse(res.data); if (responseData.code === 200) { - this.popupType = 'logo'; //弹框类型 - this.showPopupFlag = true; - this.popupMessage = '上传成功'; this.selectedImage = ''; this.file = null; this.lightModeB = false @@ -661,6 +685,7 @@ title: '上传失败', icon: 'none' }); + this.Progress.show = false; // 上传失败隐藏进度条 } finally { uni.hideLoading(); } @@ -684,20 +709,23 @@ // 操作说明 operatingInst() { + let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId uni.navigateTo({ - url: `/pages/common/operatingInstruct/index?id=${this.deviceID}` + url: `/pages/common/operatingInstruct/index?id=${id}` }) }, // 产品参数 productparams() { + let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId uni.navigateTo({ - url: `/pages/common/productDes/index?id=${this.deviceID}` + url: `/pages/common/productDes/index?id=${id}` }) }, // 操作视频 operatingVideo() { + let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId uni.navigateTo({ - url: `/pages/common/operationVideo/index?id=${this.deviceID}` + url: `/pages/common/operationVideo/index?id=${id}` }) }, @@ -741,7 +769,7 @@ name: this.personnelInfo.name, position: this.personnelInfo.position, unitName: this.personnelInfo.unitName, - deviceId: this.deviceID + deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId, } registerPersonInfo(data).then((res) => { if (res.code == 200) { @@ -761,6 +789,32 @@ this.showPopupFlag = false console.log('用户点击了确定') }, + // 解除报警 + onPopupConfirmPolice() { + let data = { + deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId], + instructValue: 0, // '解除报警' + } + deviceSendAlarmMessage(data).then((res) => { + if (res.code == 200) { + uni.showToast({ + title: res.msg, + icon: 'none' + }); + this.showPopupFlag = false + setTimeout(() => { + this.fetchDeviceDetail(this.deviceID); + uni.$emit('deviceStatusUpdate', {}); + }, 500) + + } else { + uni.showToast({ + title: res.msg, + icon: 'none' + }); + } + }); + }, // 发送文本消息 sendTextMessage() { if (!this.messageToSend) { @@ -776,7 +830,9 @@ }) let data = { sendMsg: this.messageToSend, - deviceIds: [this.deviceID] + //deviceIds: [this.deviceID], + deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId], + } deviceSendMessage(data).then((res) => { if (res.code == 200) { @@ -892,7 +948,6 @@ setTimeout(() => { this.fetchDeviceDetail(data.data.id); }, 20000); - // 这里判断电量低于20%,弹框提示 if (this.deviceInfo.batteryPercentage < 20) { this.popupType = 'bettery' @@ -900,13 +955,32 @@ this.showPopupFlag = true; } } + // 处理上传照片进度消息 + if (deviceState[0] === 3) { + const progress = deviceState[1]; + // 更新进度条 + this.Progress = { + ...this.Progress, + curr: progress * 2, + show: progress < 50 // 进度达到100时自动隐藏 + }; + // 当进度为100时显示成功弹框 + if (progress === 50) { + this.popupType = 'logo'; + this.popupMessage = '上传成功'; + this.showPopupFlag = true; + this.lightModeB = false; // 关闭上传弹窗 + this.selectedImage = ''; // 清空已选图片 + } + } }); }); if (this.apiType === 'listA') { this.fetchDeviceDetail(data.data.id) } else { - this.fetchSharedDeviceDetail(data.data.deviceId) + // 查分享权限详情 + this.fetchSharedDeviceDetail(data.data.id) } }); @@ -995,6 +1069,12 @@ height: 52rpx; } + .chargeStateIMG { + width: 27rpx; + height: 37rpx; + margin-left: 10rpx; + } + .cpIMG { width: 66rpx; height: 66rpx; diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index f9564ca..1edd3cb 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -542,7 +542,7 @@ }); // 监听设备状态更新事件 uni.$on('deviceStatusUpdate', (data) => { - console.log('收到设备状态更新通知:', data); + console.log('列表收到消息了么'); this.onIntall() }); }, diff --git a/static/images/common/chargeState.png b/static/images/common/chargeState.png new file mode 100644 index 0000000000000000000000000000000000000000..c892c64c548b2e1155b04929aaac36569897acf4 GIT binary patch literal 966 zcmeAS@N?(olHy`uVBq!ia0vp^GC-`#!3HD)D>^?iFfjLex;TbZFur}jI6=j8l8UEL z_o|t@-CbPL($d00fuI}&zMr85C;=HA9uBf4EzQl%rDgZ*nOx_6(!$G2%gg=GgRJyf zRH3)OOnrXu4;_Xx&-Wbctug!0g(h&m4Wvf=8RNYNY)AGVT7S2-vcY@@b4GsVsR&-JYM3(#@@UN4B>&HXu^{V&jY^}L@gZ6;LcKG<4$5iGpu_gnKFjn^MC z*1grMjO1rwZd2!O8qyL<~01BqSj_Z}puYcywJH7ty+3e)H zZgJjUTX!4i&$@r?&pGKkC(=JNfVG2--``d-*L=sk`)oh9?*0LG<3fAY^ivGO* zGxzVUxiw~wHdkEy^G*8Bf!Dy0|0DL{)}PmZw}FC2`eWoCjWf>`;(#9dr+efz$Ajzd zo@^GJf3$wx{kmr93fYf7Kuh { console.log("options"+JSON.stringify(options),BASE.BASE_URL)