diff --git a/App.vue b/App.vue index 5f1c716..110940d 100644 --- a/App.vue +++ b/App.vue @@ -35,6 +35,10 @@ //以上代码仅在开发时使用,否则会出现不可预知的问题。 // #ifdef APP|APP-PLUS + + let system=uni.getSystemInfoSync(); + + let initOS = () => { let ble = bleTool.getBleTool(); @@ -48,14 +52,17 @@ } }); if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法 - uni.setAppBadgeNumber = plus.runtime.setBadgeNumber; + if(plus){ + uni.setAppBadgeNumber = plus.runtime.setBadgeNumber; + } + } uni.onPushMessage((res) => { console.log("收到推送消息:", res); //监听推送消息 if (res.type == 'click') { //将App角标设置为0,清空app在消息中心的所有消息 uni.setAppBadgeNumber(0); - plus.push.clear(); + plus && plus.push.clear(); return; } uni.createPushMessage({ @@ -66,6 +73,7 @@ }); } + if (plus.os.name == 'Android') { if (plus.runtime.isAgreePrivacy()) { initOS(); @@ -75,7 +83,7 @@ } - let system=uni.getSystemInfoSync(); + console.log("system=",system); // #endif }, @@ -206,6 +214,9 @@ color: #ffffffde; } +.uni-app--maxwidth,.uni-body{ + background-color: #121212; +} .fleft { float: left; diff --git a/components/BottomSlideMenuPlus/BottomSlideMenuPlus.vue b/components/BottomSlideMenuPlus/BottomSlideMenuPlus.vue index 8b8d1b9..b0f551b 100644 --- a/components/BottomSlideMenuPlus/BottomSlideMenuPlus.vue +++ b/components/BottomSlideMenuPlus/BottomSlideMenuPlus.vue @@ -33,7 +33,7 @@ - {{ item.text }} + {{ item.text }} @@ -139,6 +139,9 @@ \ No newline at end of file diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue index 11ca4e5..03f9bdb 100644 --- a/pages/4877/BJQ4877.vue +++ b/pages/4877/BJQ4877.vue @@ -291,7 +291,8 @@ MsgClose, MsgWarning, showPop, - MsgInfo + MsgInfo, + MsgClear } from '@/utils/MsgPops.js' const pagePath = "/pages/4877/BJQ4877"; @@ -1180,6 +1181,7 @@ if (receive.deviceId !== this.formData.deviceId) { return; } + console.log("收到设备的数据", receive) let data = recei.ReceiveData(receive, device, pagePath, recArr); console.log("处理后的数据:", data); @@ -1206,6 +1208,7 @@ } if (msg.length) { msg = msg.join(","); + MsgClear(these); this.showMsg(msg); } @@ -1349,23 +1352,13 @@ }, - showMsg(msg, isSucc) { - let icoUrl = '/static/images/common/uploadErr.png'; - let borderColor = "#e034344d"; - let buttonBgColor = "#E03434"; + showMsg(msg, isSucc) { if (isSucc) { - icoUrl = '/static/images/common/success.png'; - borderColor = "#BBE600"; - buttonBgColor = "#BBE600"; + MsgSuccess(msg,'',this); + } + else{ + MsgError(msg,'',this); } - showPop({ - message: msg, - iconUrl: icoUrl, - borderColor: borderColor, - buttonBgColor: buttonBgColor, - buttonText: '确定', - okCallback: null - },this); } } } diff --git a/pages/6075J/BJQ6075J.vue b/pages/6075J/BJQ6075J.vue index 86221db..4167304 100644 --- a/pages/6075J/BJQ6075J.vue +++ b/pages/6075J/BJQ6075J.vue @@ -39,14 +39,7 @@ - - {{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}! - - - - - - + @@ -119,8 +112,15 @@ + + {{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}! + + + + + 灯光亮度 @@ -223,10 +223,7 @@ 职位: - - ID号: - - + @@ -625,7 +622,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '确定', - buttonTextColor: '#232323de', + buttonTextColor: '#FFFFFFde', showCancel: false, showHeader: false, visibleClose: true, @@ -1128,7 +1125,7 @@ uni.chooseImage({ count: 1, sizeType: ['original', 'compressed'], - sourceType: ['album'], + sourceType: ['album','camera'], success: function(res) { uni.navigateTo({ url: "/pages/common/ImgCrop/ImgCrop", @@ -1426,7 +1423,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '确定', - buttonTextColor: '#232323de', + buttonTextColor: '#FFFFFFde', showCancel: true, buttonCancelText: '取消', okCallback: send @@ -1463,7 +1460,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '确定', - buttonTextColor: '#232323de', + buttonTextColor: '#FFFFFFde', showCancel: true, showHeader: true, visibleClose: false, @@ -1522,9 +1519,7 @@ } - this.formData.textLines = [this.formData.company, this.formData.usrname, this.formData.job, this.formData - .usrid - ]; + this.formData.textLines = [this.formData.company, this.formData.usrname, this.formData.job]; console.log("data=", this.formData.textLines); showLoading(these, { text: "发送中" @@ -1590,11 +1585,14 @@ let sendPacket = () => { if (combinedData.length === curr - 1) { - holdHand('transmit complete', 200).then(res => { + setTimeout(()=>{ + holdHand('transmit complete', 200).then(res => { MsgSuccess("人员信息发送成功", "确定", these); hideLoading(these); this.setBleFormData(); }); + },300); + hideLoading(); return; } @@ -1608,7 +1606,7 @@ curr++; console.log("发送成功", curr); updateLoading(these, { - text: '发送中,' + (curr - 1) + '/' + 4 + text: '发送中,' + (curr - 1) + '/' + combinedData.length }) setTimeout(sendPacket, 250); }).catch(err => { diff --git a/pages/6155/BJQ6155.vue b/pages/6155/BJQ6155.vue index b83802b..02ae5f5 100644 --- a/pages/6155/BJQ6155.vue +++ b/pages/6155/BJQ6155.vue @@ -865,7 +865,7 @@ uni.chooseImage({ count: 1, sizeType: ['original', 'compressed'], - sourceType: ['album'], + sourceType: ['album','camera'], success: function(res) { uni.navigateTo({ url: "/pages/common/ImgCrop/ImgCrop", diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index 56d92a9..4e0c78f 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -903,7 +903,7 @@ uni.chooseImage({ count: 1, sizeType: ['original', 'compressed'], - sourceType: ['album'], + sourceType: ['album','camera'], success: function(res) { uni.navigateTo({ url: "/pages/common/ImgCrop/ImgCrop", diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 5db95c3..341752f 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -31,7 +31,7 @@ - {{ deviceInfo.batteryRemainingTime || '0' }}分钟 + {{remainTime}} 续航时间 @@ -54,13 +54,13 @@ 蓝牙状态 - + {{getbleStatu}} 充电状态 - + {{deviceInfo.chargeState != 0?'充电中':'未充电'}} @@ -112,7 +112,7 @@ - + @@ -121,17 +121,20 @@ - - + + - - + + - {{itemInfo.alarmStatus==1?'解除报警':'强制报警'}} + {{itemInfo.alarmStatus==1?'解除报警':'强制报警'}} - + @@ -147,7 +150,7 @@ + :color="'#000000'" :fontSize="12" :returnType="10" /> 人员信息登记 @@ -161,17 +164,16 @@ 单位: + :maxlength="8" /> 姓名: - + 职位: + :maxlength="8" /> ID: @@ -180,7 +182,7 @@ - + 发送信息 @@ -193,7 +195,7 @@ - + @@ -276,15 +278,17 @@ - + @cancel="onPopupConfirm" @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" + confirmBtnColor="#fff" /> + - - + @cancel="onPopupConfirm" @confirm="OpenWarn(1)" confirmBtnBg="rgba(224, 52, 52, 1)" + confirmBtnColor="#fff" /> + + @@ -306,7 +310,8 @@ MsgError, MsgClose, MsgWarning, - showPop + showPop, + MsgInfo } from '@/utils/MsgPops.js'; import Common from '@/utils/Common.js'; @@ -355,7 +360,7 @@ navTitle: "", sliderValue: 25, lightModeA: false, - currentMainMode: '强光', + currentMainMode: '关闭', currentlaserMode: "关闭", lightModeB: false, lightModeC: false, //激光提示框 @@ -402,7 +407,7 @@ rgb565Data: null, selectedItemIndex: 0, popupType: 'person', //弹框类型 - isLaserOn: false, + isLaserOn: false, //激光开启状态 isSending: false, isProcessing: false, isPolling: false, // 轮询状态 @@ -418,6 +423,9 @@ } }, computed: { + remainTime() { + return Common.formatTime(this.deviceInfo.batteryRemainingTime); + }, computedDeviceId() { return this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId; }, @@ -442,7 +450,8 @@ } }, methods: { - onReceive(deviceState){//蓝牙/Mq通用消息处理 + + onReceive(deviceState, parsedMessage) { //蓝牙/Mq通用消息处理 switch (deviceState[0]) { // 1设备切换灯光实时返回 case 1: @@ -452,13 +461,21 @@ this.sliderValue = deviceState[2]; this.deviceInfo.batteryRemainingTime = deviceState[3]; break; + case 6: + if(deviceState[1]==50){ + this.popupType = 'person'; + this.showPopupFlag = true; + this.popupMessage = '信息发送成功'; + uni.hideLoading(); + } + break; // 12为设备实时上报 case 12: - this.currentMainMode = this.getMainLightModeLabel( - deviceState[ - 1]); + this.currentMainMode = this.getMainLightModeLabel(deviceState[1]); this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位 this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; + this.deviceInfo.alarmStatus= deviceState[6];//报警状态 + this.itemInfo.alarmStatus= deviceState[6]; if (this.deviceInfo) { this.deviceInfo.batteryPercentage = deviceState[3]; //第4位电量百分比 this.deviceInfo.chargeState = deviceState[4]; //第5位为充电状态(0没有充电,1正在充电,2为已充满) @@ -501,19 +518,19 @@ }); return; } - + if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') { these.formData.bleStatu = 'connecting'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; }).catch(ex => { these.formData.bleStatu = 'err'; - MsgError("连接错误:"+ex.msg,"确定",these); + MsgError("连接错误:" + ex.msg, "确定", these); }); return; } - - + + }, getDevice: function() { if (ble) { @@ -556,7 +573,7 @@ borderColor: "#e034344d", buttonBgColor: "#E03434", buttonText: '去连接', - buttonTextColor: '#FFFFFFde', + buttonTextColor: '#FFFFFFde', showCancel: true, okCallback: function() { console.log("1111"); @@ -583,10 +600,15 @@ return; } let data = rec.ReceiveData(receive, device, pagePath, recArr); - console.log("蓝牙收到消息", data) - this.onReceive(data.state); + let keys = Object.keys(data); + if (keys.length && "state" in data) { + this.onReceive(data.state, receive.str); + } else { + console.log("不是状态数据,丢弃", data); + } + }, - + bleStateBreak() { if (this.Status.pageHide) { return; @@ -620,7 +642,7 @@ text: ex.msg }) these.formData.bleStatu = 'err'; - MsgError("连接错误:"+ex.msg,"确定",these); + MsgError("连接错误:" + ex.msg, "确定", these); }).finally(() => { setTimeout(() => { hideLoading(these); @@ -737,60 +759,62 @@ }); }, onSliderChanging(e) { - if (!this.cardRect) return; + let value = e.detail.value; - if (value < 10) { - value = 10; - } + this.sliderValue = value; // 实时更新UI - const now = Date.now(); - // 使用节流防止指令发送过于频繁 - if (now - this.lastBrightnessTime > 200) { // 200毫秒节流 - this.lastBrightnessTime = now; + return; + // const now = Date.now(); + // // 使用节流防止指令发送过于频繁 + // if (now - this.lastBrightnessTime > 200) { // 200毫秒节流 + // this.lastBrightnessTime = now; - let mqSend = () => { + // let mqSend = () => { - // 增加轻微的震动反馈,提升手感 - uni.vibrateShort({ - type: 'light' - }); + // // 增加轻微的震动反馈,提升手感 + // uni.vibrateShort({ + // type: 'light' + // }); - let data = { - deviceId: this.computedDeviceId, - instructValue: this.sliderValue + '.00', - deviceImei: this.itemInfo.deviceImei, - } - lightBrightnessSettings(data).then((res) => { - if (res.code !== 200) { - // 可以在这里处理错误,但滑动中不建议用toast - } - }) - } + // let data = { + // deviceId: this.computedDeviceId, + // instructValue: this.sliderValue + '.00', + // deviceImei: this.itemInfo.deviceImei, + // } + // lightBrightnessSettings(data).then((res) => { + // if (res.code !== 200) { + // // 可以在这里处理错误,但滑动中不建议用toast + // } + // }) + // } - if (ble && this.itemInfo.deviceMac) { - let f = this.getDevice(); - if (f) { - let json = { - instruct: [5, 0, 0, 0, 0] - }; - json.instruct[1] = parseInt(this.sliderValue); + // if (ble && this.itemInfo.deviceMac) { + // let f = this.getDevice(); + // if (f) { + // let json = { + // instruct: [5, 0, 0, 0, 0] + // }; + // json.instruct[1] = parseInt(this.sliderValue); - ble.sendString(f.deviceId, json).then(res => { + // ble.sendString(f.deviceId, json).then(res => { - }).catch(ex => { - mqSend(); - }); - } else { - mqSend(); - } - return; - } else { - mqSend(); - } - } + // }).catch(ex => { + // mqSend(); + // }); + // } else { + // mqSend(); + // } + // return; + // } else { + // mqSend(); + // } + // } }, onSliderChangeEnd(e) { - + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } let value = e.detail.value; if (value < 10) { value = 10; @@ -847,6 +871,10 @@ } }, selectMode(type) { + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } this.modeType = type; this.lightModeA = true; if (type === 'main') { @@ -906,7 +934,10 @@ }, // 灯光模式的确认 handleSumbit() { - + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } if (this.selectedItemIndex === null) return; const selectedItem = this.items[this.selectedItemIndex]; @@ -928,8 +959,13 @@ }; lightModeSettings(data).then((res) => { if (res.code == 200) { - this.currentMainMode = this.pendingMainMode; + this.selectedItemIndex = selectedItem; + + this.currentMainMode = this.getMainLightModeLabel(selectedItem.instructValue); + this.isLaserOn = false; //第3位表示当时激光灯档位 + this.currentlaserMode = "关闭"; + uni.showToast({ title: res.msg, icon: 'none' @@ -959,8 +995,11 @@ json.instruct[1] = parseInt(selectedItem.instructValue); ble.sendString(f.deviceId, json).then(res => { - console.log("ble send success",json); + console.log("ble send success", json); this.lightModeA = false; + this.currentMainMode = this.getMainLightModeLabel(selectedItem.instructValue); + this.isLaserOn = false; + this.currentlaserMode = "关闭"; }).catch(ex => { console.error("ble send fail,mqsending....") mqSend(); @@ -976,15 +1015,23 @@ }, // 激光模式 lasermode() { - + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } this.lightModeC = true }, - + // 激光确认框提交 handleBtn() { + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } + const instructValue = this.isLaserOn ? 0 : 1; let mqSend = () => { @@ -1011,6 +1058,10 @@ // 更新状态 this.isLaserOn = !this.isLaserOn; this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; + + this.currentMainMode = this.getMainLightModeLabel(0); + + this.lightModeC = false; } else { uni.showToast({ @@ -1035,6 +1086,8 @@ this.lightModeC = false; this.isLaserOn = !this.isLaserOn; this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; + + this.currentMainMode = this.getMainLightModeLabel(0); }).catch(ex => { mqSend(); }); @@ -1052,7 +1105,12 @@ }, // 上传开机画面 uploadStartup() { - this.lightModeB = true + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } + this.lightModeB = true; + this.selectedImage=null; }, // 上传开机画面 checkImgUpload() { @@ -1102,6 +1160,10 @@ }); return; } + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } let mqSend = () => { if (this.deviceInfo.onlineStatus !== 1) { @@ -1264,9 +1326,9 @@ dataView.setUint8(0, 0x55); // 帧头 dataView.setUint8(1, 0x02); // 帧类型:开机画面 dataView.setUint8(2, currentPacket); // 包序号 - dataView.setUint16(3, packetData.length*2,false); // 包t长度 + dataView.setUint16(3, packetData.length * 2, false); // 包t长度 + - // 填充数据(每个RGB565值占2字节) for (let i = 0; i < packetData.length; i++) { @@ -1338,11 +1400,11 @@ }); } - setTimeout(()=> { + setTimeout(() => { sendImagePackets().catch(() => { - }).finally(()=>{ - this.lightModeB=false; + }).finally(() => { + this.lightModeB = false; }); }, 0) } @@ -1373,6 +1435,11 @@ }, // 发送人员信息 sendPersonnelInfo() { + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } + let mqSend = async () => { if (this.isSending) return; const requiredFields = [{ @@ -1532,9 +1599,9 @@ hideLoading(); return; } - + let packData = combinedData[curr - 1]; let array = { - instruct: [2, curr].concat(combinedData[curr - 1]) + instruct: [2, curr, packData.length].concat(packData) }; @@ -1574,15 +1641,17 @@ setTimeout(() => { Promise.allSettled([holdHand('word transmit start', 2200), drawText()]).then( results => { + console.log("results=", results); if (results[0].status == 'rejected') { - + MsgError(results[0].reason.code + ':' + results[0].reason.msg, '', + these); setTimeout(() => { hideLoading(these) }, 500); return; } if (results[1].status == 'rejected') { - + MsgError("无法完成文字取模", '', these); return; } @@ -1615,32 +1684,36 @@ this.showPopupFlag = true; // this.popupConfirmText=""; }, - OpenWarn(val){//开启/解除强制报警 - debugger; + OpenWarn(val) { //开启/解除强制报警 + debugger; const topic = `B/${this.itemInfo.deviceImei}`; - let message={"instruct":[7,val,0,0,0,0]}; - message=JSON.stringify(message); - - let flag=this.mqttClient.publish(topic, message, { + let message = { + "instruct": [7, val, 0, 0, 0, 0] + }; + message = JSON.stringify(message); + + let flag = this.mqttClient.publish(topic, message, { qos: 1 }); - if(flag){ - this.itemInfo.alarmStatus=val; - }else{ - MsgError("操作没有成功",'确定',this); + if (flag) { + this.itemInfo.alarmStatus = val; + this.deviceInfo.alarmStatus = val; + } else { + MsgError("操作没有成功", '确定', this); } - - this.showPopupFlag = false; + + this.onPopupConfirm(); + }, - warnToggle(){ - if(this.itemInfo.alarmStatus==1){ + warnToggle() { + if (this.itemInfo.alarmStatus == 1) { this.popupType = 'cancel'; this.popupMessage = '确认解除报警状态'; - - }else{ + + } else { this.popupType = 'openWarn'; this.popupMessage = '确认开启报警状态'; - + } this.showPopupFlag = true; // this.popupConfirmText="开启"; @@ -1650,25 +1723,25 @@ // val=0; // msg="确认解除强制报警?"; // } - + // let mqSend=()=>{ // const topic = `B/${this.itemInfo.deviceImei}`; // let message={"instruct":[7,val,0,0,0,0]}; // message=JSON.stringify(message); - + // let flag=this.mqttClient.publish(topic, message, { // qos: 1 // }); // if(flag){ // this.itemInfo.alarmStatus=val; // } - + // } - - - + + + }, - + // 解除报警逻辑 async onPopupConfirmPolice() { if (this.deviceInfo.onlineStatus !== 1) { @@ -1676,7 +1749,7 @@ // title: '设备已离线', // icon: 'none' // }); - this.OpenWarn(0);//走mq直发 + this.OpenWarn(0); //走mq直发 return; } this.isPolling = true; // 标记开始轮询 @@ -1701,14 +1774,18 @@ // title: registerRes.msg, // icon: 'none' // }) - this.OpenWarn(0); + + return } - this.itemInfo.alarmStatus=0; + this.itemInfo.alarmStatus = 0; + this.deviceInfo.alarmStatus = 0; + uni.hideLoading(); + this.showPopupFlag = false // 4. 获取设备状态FunctionAccessBatchStatusRule 批量 let deviceImei = this.itemInfo.deviceImei let typeName = this.itemInfo.typeName - const statusRes = await getdeviceSTatus({ + getdeviceSTatus({ functionMode: 2, batchId, typeName: 'FunctionAccessBatchStatusRule', @@ -1716,22 +1793,26 @@ interval: 500 }, deviceRealTimeStatus - ); - if (statusRes.data.functionAccess === 'OK') { - uni.showToast({ - title: statusRes.msg, - icon: 'none' - }); - uni.$emit('deviceStatusUpdate', {}); - this.showPopupFlag = false - if (this.apiType === 'listA') { - this.fetchDeviceDetail(this.computedDeviceId) - } else { - // 分享权限详情 - this.fetchSharedDeviceDetail(this.itemInfo.id) - } + ).then(statusRes => { + if (statusRes.data.functionAccess === 'OK') { + uni.showToast({ + title: statusRes.msg, + icon: 'none' + }); + uni.$emit('deviceStatusUpdate', {}); + + if (this.apiType === 'listA') { + this.fetchDeviceDetail(this.computedDeviceId) + } else { + // 分享权限详情 + this.fetchSharedDeviceDetail(this.itemInfo.id) + } + + } + }).catch(ex => { + console.error("出现错误", ex); + }); - } } catch (error) { uni.showToast({ title: error.message, @@ -1751,6 +1832,12 @@ }); return; } + + if (this.deviceInfo.alarmStatus == 1) { + MsgError('请先解除强制报警', '', these); + return; + } + // 防重复提交 if (this.isSending) return; if (!this.messageToSend) { @@ -1801,9 +1888,9 @@ ); // 只有当状态为'OK'时才显示成功弹窗 if (statusRes.data.functionAccess === 'OK') { - this.popupType = 'person'; - this.showPopupFlag = true; - this.popupMessage = '信息发送成功'; + // this.popupType = 'person'; + // this.showPopupFlag = true; + // this.popupMessage = '信息发送成功'; } } catch (error) { uni.showToast({ @@ -1899,7 +1986,7 @@ } } }, - + // 发送mqtt查询设备信息 queryDeviceStatus() { if (this.mqttClient && this.mqttClient.isConnected()) { @@ -1955,14 +2042,30 @@ this.mqttClient.subscribe(statusTopic, (payload) => { try { console.log(`收到来自 ${statusTopic} 的消息:`, payload); + console.log("typeof payload=", typeof payload); const parsedMessage = typeof payload === 'string' ? JSON.parse( - payload) : - payload; - const deviceState = parsedMessage.state; // 直接取 state 数组 - // 切换主灯光模式,亮度值设备同步 - if (!deviceState) return; - - this.onReceive(deviceState); + payload) : payload; + + let keys = Object.keys(parsedMessage); + if("sta_BreakNews" in parsedMessage){ + console.error("收到确认消息") + if(parsedMessage.sta_BreakNews=='I get it'){ + MsgSuccess("用户已确认收到紧急通知","",this); + + } + + } + else if (keys.length && "state" in parsedMessage) { + const deviceState = parsedMessage.state; // 直接取 state 数组 + // 切换主灯光模式,亮度值设备同步 + if (!deviceState || !deviceState instanceof Array) { + return; + } + + this.onReceive(deviceState, parsedMessage); + }else{ + console.error("丢弃的消息",payload) + } } catch (error) { console.log('解析MQTT消息失败:', error, '原始消息:', payload); } @@ -1999,10 +2102,10 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then( res => { these.formData.bleStatu = true; - }).catch(ex=>{ - these.formData.bleStatu = 'err'; - MsgError("连接错误:"+ex.msg,"确定",these); - }); + }).catch(ex => { + these.formData.bleStatu = 'err'; + MsgError("连接错误:" + ex.msg, "确定", these); + }); } } @@ -2022,8 +2125,8 @@ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { console.log("连接成功") this.formData.bleStatu = true; - }).catch(ex=>{ - MsgError("连接错误:"+ex.msg,"确定",these); + }).catch(ex => { + MsgError("连接错误:" + ex.msg, "确定", these); }); } }, @@ -2261,8 +2364,9 @@ box-sizing: border-box; border: 1rpx solid #00000000; } - .mode-v1.active{ - border:1rpx solid #bbe600 !important; + + .mode-v1.active { + border: 1rpx solid #bbe600 !important; } .mode-v2 { diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue index f980767..a4a5a32 100644 --- a/pages/7305/BJQ7305.vue +++ b/pages/7305/BJQ7305.vue @@ -758,7 +758,7 @@ uni.chooseImage({ count: 1, sizeType: ['original', 'compressed'], - sourceType: ['album'], + sourceType: ['album','camera'], success: function(res) { uni.navigateTo({ url: "/pages/common/ImgCrop/ImgCrop", diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue index 18165c9..3dff491 100644 --- a/pages/common/addBLE/addEquip.vue +++ b/pages/common/addBLE/addEquip.vue @@ -23,10 +23,11 @@ 配对设备 - + - + @@ -34,7 +35,7 @@ - + @@ -50,10 +51,8 @@ 发现设备:{{deviceCnt}} 刷新 - - - + + { - + these.EquipMents = []; if (!ble) { ble = bleTool.getBleTool(); @@ -366,31 +365,31 @@ these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备 } }, pagePath); - + //蓝牙连接已恢复的回调 ble.addRecoveryCallback(res => { if (these.Status.isPageHidden) { return; } these.refreshLinked(); - + // hideLoading(these); - - if (!these.device) { + + if (!these.device) { hideLoading(these); - }else{ + } else { clearInterval(this.Status.intval); these.DeviceVerdict(res.deviceId); } - - + + }, pagePath); } let startValidDevice = () => { if (these.device) { console.log("进入配对模式,启用连接恢复和验证逻辑。"); - + //收到设备的消息回调 ble.addReceiveCallback((receivData, f, path, arr) => { @@ -412,7 +411,7 @@ showLoading(these, { text: '正在验证设备' }); - + setTimeout(() => { these.DeviceVerdict(f.deviceId); }, 0); @@ -424,7 +423,7 @@ StartSubsrib(); - + }, @@ -437,19 +436,19 @@ this.refreshLinked(); }, methods: { - refreshLinked(){ - - - - if(ble){ - let arr=[]; - arr=ble.data.LinkedList.filter(v=>{ + refreshLinked() { + + + + if (ble) { + let arr = []; + arr = ble.data.LinkedList.filter(v => { return v.Linked; }); - this.PairEquip=arr; + this.PairEquip = arr; } - - + + }, checkAndRequestLocationPermission() { return new Promise((resolve) => { @@ -500,7 +499,8 @@ } const hasPermission = await this.checkAndRequestLocationPermission(); if (!hasPermission) { - console.log("缺少定位权限,已中止蓝牙扫描。"); + + MsgError('缺少定位权限,已中止蓝牙扫描', '', this); return; } @@ -524,19 +524,19 @@ time = setTimeout(() => { these.EquipMents = []; - + ble.StartSearch().then(result => { // console.log("开始搜索成功", result); - these.Status.BottomMenu.show=false; + these.Status.BottomMenu.show = false; }).catch(err => { console.error("开始搜索失败:", err); if (err.code === 10001) { these.showOpenSetting(); } else { - - MsgClear(these); - MsgError('出现错误:' + err.msg, '确定', these); + MsgError('出现错误:' + err.msg, '确定', these, () => { + MsgClear(these); + }); } }).finally(() => { @@ -580,9 +580,9 @@ ble.showBlueSetting(false); }, DeviceVerdict(deviceId) { //判断是否是目标设备 - if (these.Status.isPageHidden) { - return; - } + if (these.Status.isPageHidden) { + return; + } console.log("deviceid=", deviceId); console.log("these.device=", these.device) if (these.device) { //从设备详情过来的,回设备详情去 @@ -681,7 +681,7 @@ text: "等待设备上报Mac地址," + these.Status.time + 's' }); - + clearInterval(this.Status.intval); this.Status.intval = null; @@ -708,7 +708,7 @@ } updateLoading(these, { - + text: "等待设备上报Mac地址," + these.Status.time + 's' }); @@ -729,7 +729,7 @@ let index = 1; let total = 5; - let linkCallback = (res) => { + let linkCallback = (res) => { console.log("连接成功", these.device); if (!these.device) { console.log("跳转到绑定") @@ -746,12 +746,12 @@ }); return; } - + } let execLink = () => { return new Promise((resolve, reject) => { - + if (index > total) { reject({ msg: "连接超时" @@ -759,7 +759,7 @@ return; } ble.LinkBlue(item.deviceId).then((res) => { - this.tmpLink=[item]; + this.tmpLink = [item]; console.log("连接成功"); ble.StopSearch(); resolve(res); @@ -767,9 +767,9 @@ if (index == total) { console.log("连接了N次都没连上"); reject(ex); - updateLoading(this, { - text: ex.msg - }) + updateLoading(this, { + text: ex.msg + }) return; } index++; @@ -786,7 +786,7 @@ execLink().then((res) => { console.log("res=", res); - if(this.Status.isPageHidden){ + if (this.Status.isPageHidden) { return; } linkCallback(res); @@ -802,21 +802,21 @@ }, - disConnect:function(item,index){ + disConnect: function(item, index) { // #ifdef H5|WEB - - this.PairEquip.splice(index,1); - + + this.PairEquip.splice(index, 1); + // #endif // #ifdef APP|APP-PLUS - if(ble){ - ble.disconnectDevice(item.deviceId).catch(ex=>{ - console.error("无法断开连接",ex); + if (ble) { + ble.disconnectDevice(item.deviceId).catch(ex => { + console.error("无法断开连接", ex); }); } // #endif - - + + } } } diff --git a/pages/common/addDevice/addBle.vue b/pages/common/addDevice/addBle.vue index bddf46d..39e0b39 100644 --- a/pages/common/addDevice/addBle.vue +++ b/pages/common/addDevice/addBle.vue @@ -486,13 +486,11 @@ MsgError('蓝牙不可用','',these); - these.EquipMents.filter((v, i) => { - these.$set(these.EquipMents[i], 'link', false); - }); + these.EquipMents=[]; }, pagePath); ble.addStateRecoveryCallback(() => { - + these.ReSearch(); MsgSuccess('蓝牙恢复可用','',these,()=>{ MsgClear(these); }) @@ -557,6 +555,7 @@ setTimeout(()=>{ + debugger; MsgInfo("如需要在PC上查看此数据,请复制链接后通过微信发送到PC,在PC端打开,然后点右上角扫码授权","复制链接",these,true,()=>{ console.log("执行复制"); uni.setClipboardData({ @@ -566,10 +565,18 @@ title:'已复制链接' }); - + // #ifdef APP plus.runtime.openURL('weixin://', (err) => { MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'"); }); + // #endif + + // #ifndef APP + MsgInfo("已复制链接,请打开浏览器查看","",these); + setTimeout(()=>{ + MsgClear(these); + },1200) + // #endif }, fail(ex){ console.error("无法复制",ex) @@ -878,9 +885,10 @@ }, ReSearch() { if (!ble) { + MsgError('蓝牙模块未初始化','',this); return; } - + showLoading(this,{text:'请稍候...'}); ble.disconnectDevice().finally(dis => { ble.StopSearch().finally(res => { @@ -893,6 +901,8 @@ }).catch(err => { console.error("err=", err); MsgError("出现错误:" + err.msg, '', these); + }).finally(()=>{ + hideLoading(these); }); },200); diff --git a/pages/common/allShare/index.vue b/pages/common/allShare/index.vue index 02ff8d3..12d60a6 100644 --- a/pages/common/allShare/index.vue +++ b/pages/common/allShare/index.vue @@ -9,57 +9,64 @@ - - - - - + + + + @@ -81,6 +88,7 @@ @@ -267,6 +331,9 @@ min-height: 100vh; background-color: rgb(18, 18, 18); padding: 30rpx; + width: 100%; + height: 100vh; + box-sizing: border-box; } .tab-bar { diff --git a/pages/common/audioManager/AudioList.vue b/pages/common/audioManager/AudioList.vue index 9f8267d..7f07c5c 100644 --- a/pages/common/audioManager/AudioList.vue +++ b/pages/common/audioManager/AudioList.vue @@ -196,7 +196,8 @@ isLock: false, empty: { tip: '暂无数据', - hideScroll: false + hideScroll: false, + icon: '/static/images/common/empty.png' } }, page: 1, // 当前页码 diff --git a/pages/common/callPolice/index.vue b/pages/common/callPolice/index.vue index 4df8bfc..4f928a3 100644 --- a/pages/common/callPolice/index.vue +++ b/pages/common/callPolice/index.vue @@ -117,6 +117,13 @@ sendApi: deviceSendAlarmMessage, statusTypeName: '', sendType: 'XSSend' + }, + , + { + type: ['HBY018A'], + sendApi: deviceSendAlarmMessage, + statusTypeName: '', + sendType: 'CommonSend' } ] }, @@ -134,7 +141,8 @@ isLock: false, empty: { tip: '暂无数据', - hideScroll: false + hideScroll: false, + icon: '/static/images/common/empty.png' }, textNoMore: '没有更多数据了' }, diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 0c95f43..f808e37 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -29,10 +29,10 @@ - - + @@ -62,7 +62,7 @@ - + @@ -242,7 +242,8 @@ isLock: false, empty: { tip: '暂无数据', - hideScroll: false + hideScroll: false, + icon: '/static/images/common/empty.png' }, textNoMore: '没有更多数据了' }, @@ -697,13 +698,20 @@ } }) }, + swipeToggle(item,index){ + if(!item.showOption || item.showOption=='none'){ + this.$set(this.deviceList[index],'showOption','right'); + return; + } + this.$set(this.deviceList[index],'showOption','none'); + }, // 列表跳转 - handleFile(item) { - let url = item.detailPageUrl; - // url="/pages/6075/BJQ6075L"; - // if(!url){ - // url="/pages/6075/BJQ6075" - // } + handleFile(item,index) { + if(item.showOption=='right'){ + this.$set(this.deviceList[index],'showOption','none'); + return; + } + let url = item.detailPageUrl; uni.navigateTo({ url: url, events: { @@ -773,7 +781,7 @@ }); // 监听设备状态更新事件 uni.$on('deviceStatusUpdate', (data) => { - console.log('列表收到消息了么'); + // console.log('列表收到消息了么'); this.downCallback(); }); ble = bleTool.getBleTool(); @@ -805,9 +813,9 @@ //接收到消息的回调 ble.addReceiveCallback((receive, device, path, recArr) => { - console.error("首页收到消息了"); + // console.error("首页收到消息了"); let json=recei.ReceiveData(receive, device, path, recArr); - console.error("消息内容",json); + // console.error("消息内容",json); this.updateBleStatu(); }, pagePath); @@ -1148,7 +1156,7 @@ border-radius: 40rpx; padding: 30rpx; text-align: center; - border: 1px solid #E034344d; + border: 1px solid #E0343480; } @@ -1161,7 +1169,7 @@ } .agreement-popupC .cancelBtn{ - border:1rpx solid #E034344d; + border:1rpx solid #E03434; color:#E03434; } diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index 68efc2d..1772b7d 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -113,7 +113,8 @@ isLock: false, empty: { tip: '暂无数据', - hideScroll: false + hideScroll: false, + icon: '/static/images/common/empty.png' }, textNoMore: '没有更多数据了' }, diff --git a/pages/common/sosSet/LinkManSetting.vue b/pages/common/sosSet/LinkManSetting.vue new file mode 100644 index 0000000..565991b --- /dev/null +++ b/pages/common/sosSet/LinkManSetting.vue @@ -0,0 +1,398 @@ + + + + + \ No newline at end of file diff --git a/pages/common/sosSet/TxtMsgSetting.vue b/pages/common/sosSet/TxtMsgSetting.vue new file mode 100644 index 0000000..87841ba --- /dev/null +++ b/pages/common/sosSet/TxtMsgSetting.vue @@ -0,0 +1,251 @@ +