diff --git a/App.vue b/App.vue index eb826f1..022d225 100644 --- a/App.vue +++ b/App.vue @@ -113,7 +113,7 @@ } .green { - color: #4CAF50 !important; + color: #aed600 !important; } .red { diff --git a/components/MessagePopup/MessagePopup.vue b/components/MessagePopup/MessagePopup.vue index b638dd0..46291b3 100644 --- a/components/MessagePopup/MessagePopup.vue +++ b/components/MessagePopup/MessagePopup.vue @@ -393,4 +393,6 @@ padding-top: 40rpx; } + + \ No newline at end of file diff --git a/manifest.json b/manifest.json index 282ed38..7255c9c 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ "Bluetooth" : {}, "Camera" : {}, "Geolocation" : {}, - "Maps" : {} + "Maps" : {}, + "Record" : {} }, /* 应用发布信息 */ "distribute" : { @@ -89,7 +90,24 @@ "appkey_android" : "d7d852dbda2b95f6f796fb9a711a9fee" } }, - "push" : {} + "push" : { + "unipush" : { + "version" : "2", + "offline" : true, + "honor" : {}, + "meizu" : {}, + "mi" : {}, + "vivo" : {}, + "oppo" : {}, + "hms" : {}, + "icons" : { + "small" : { + "xxhdpi" : "", + "xhdpi" : "" + } + } + } + } }, "icons" : { "android" : { diff --git a/pages.json b/pages.json index 4498b63..ac5614a 100644 --- a/pages.json +++ b/pages.json @@ -329,11 +329,24 @@ "navigationBarTitleText": "BJQ 4877" } }, + { + "path": "pages/4877/BJQ4877V1", + "style": { + "navigationBarTitleText": "BJQ 4877" + } + }, { "path": "pages/100/HBY100", "style": { "navigationBarTitleText": "HBY 100" } + }, + { + "path" : "pages/4877/BJQ4877CheckColor", + "style" : + { + "navigationBarTitleText" : "选择配组" + } } diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue index 4dcc609..9933740 100644 --- a/pages/100/HBY100.vue +++ b/pages/100/HBY100.vue @@ -172,7 +172,7 @@ @@ -184,7 +184,7 @@ @@ -196,7 +196,7 @@ diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue index 6b197bd..8da16ab 100644 --- a/pages/4877/BJQ4877.vue +++ b/pages/4877/BJQ4877.vue @@ -2,8 +2,7 @@ - + @@ -28,27 +27,42 @@ {{device.deviceName}} - Mac地址 - {{device.deviceMac}} - + Mac地址 + {{device.deviceMac}} + 蓝牙名称 {{device.bluetoothName}} - + 蓝牙状态 {{formData.bleStatu?'已连接':'未连接'}} + + 信道:{{formData.sta_Channel}} + 修改 + - + 设备强制报警中! {{formData.warnTime}}s + @@ -85,25 +99,22 @@ 单色配组 - - + + 选择配组 - - - - - - - {{item['text']}} + + + + + + {{item.name}} @@ -213,19 +224,16 @@ :iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText" @buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText" - :showCancel="Status.Pop.showCancel" @cancelPop="closePop" /> + :showCancel="Status.Pop.showCancel" @cancelPop="closePop" :showSlot="Status.Pop.showSlot"> + + 修改信道 + - - + + + @@ -244,18 +252,23 @@ request, baseURL } from '../../utils/request'; + import { + colors as groupColors + } from '@/api/4877/BJQ4877.js'; + - import usrApi from '@/api/670/HBY670.js' const pagePath = "/pages/4877/BJQ4877"; var ble = null; var these = null; var recei = null; var interval = null; + var slidTime = null; export default { data() { return { Status: { + ShowEditChannel: false, pageHide: false, Pop: { showPop: false, //是否显示弹窗 @@ -276,6 +289,7 @@ okCallback: null, buttonCancelText: '', showCancel: false, + showSlot: false }, BottomMenu: { show: false, @@ -327,13 +341,14 @@ macAddress: '', bleStatu: false, sta_SOSType: '', //sos - sta_GroupType: '', //配组 + sta_GroupType: -1, //配组 sta_ArrowType: '', //箭头方向 - warnTime: 0 + warnTime: 0, + sta_Channel: 80 }, dic: { SOS: [{ - text: '声光报警', + text: 'SOS报警', val: 'sos', img: '/static/images/4877/sg.png', activeImg: '/static/images/4877/sgActive.png' @@ -345,30 +360,7 @@ activeImg: '/static/images/4877/fanActive.png' } ], - gropus: [{ - text: '红配组', - val: 'red_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '蓝配组', - val: 'blue_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '绿配组', - val: 'green_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - }, - { - text: '黄配组', - val: 'yellow_group', - img: '/static/images/4877/light.png', - activeImg: '/static/images/4877/lightActive.png' - } + groups: [ ] }, @@ -397,11 +389,14 @@ onUnload() { console.log("页面卸载,释放资源"); ble.removeAllCallback(pagePath); + clearInterval(interval); }, onLoad: function() { these = this; recei = BleReceive.getBleReceive(); ble = BleTool.getBleTool(); + this.dic.gropus = []; + ble.addReceiveCallback(this.bleValueNotify, pagePath); @@ -415,7 +410,23 @@ eventChannel.on('detailData', function(data) { - // console.log("收到父页面的参数:" + JSON.stringify(data)); + console.log("收到父页面的参数:" + JSON.stringify(data)); + + let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id); + if (checkIds && checkIds.length) { + let groups = groupColors.filter(v => { + let filt = checkIds.find(id => { + return id === v.id; + }); + if (filt) { + return true; + } + return false; + }); + + these.dic.groups = groups; + + } var device = data.data; these.device = device; let f = ble.data.LinkedList.find((v) => { @@ -443,7 +454,7 @@ } these.formData.blename = f.name ? f.name : "Unname"; these.formData.deviceName = device.deviceName; - + these.formData.bleStatu = false; these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { @@ -466,7 +477,71 @@ }, methods: { + ShowChannelEdit() { + this.Status.ShowEditChannel = true; + this.showPop({ + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#BBE600', + textColor: '#ffffffde', + buttonBgColor: '#BBE600', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '确定', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: false, + okCallback: ()=>{ + this.onChannelChanging(); + this.Status.ShowEditChannel=false; + }, + showSlot: true, + buttonCancelText: '取消', + showCancel: true, + cancelCallback:()=>{ + this.Status.ShowEditChannel=false; + } + }); + }, + onChannelChanging() { + let regex = /^(0|([1-9]\d?)|1[01]\d|12[0-5])$/; + if (!regex.test(this.formData.sta_Channel)) { + this.showMsg("只能输入0-125整数"); + return; + } + let f = this.getDevice(); + + if (!f) { + this.showBleUnConnect(); + return; + } + clearTimeout(slidTime); + slidTime = setTimeout(() => { + console.log("11111"); + let json = { + ins_channel: this.formData.sta_Channel + } + json = JSON.stringify(json); + ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => { + console.log("发送成功"); + this.setBleFormData(); + }).catch(ex => { + this.showMsg(ex.msg); + }); + }, 200) + + + }, ArrowSet(val) { + if (this.formData.sta_SOSType === 'sos') { + this.showMsg("设备强制报警中,请先关闭报警") + return; + } + let f = this.getDevice(); if (!f) { this.showBleUnConnect(); @@ -486,27 +561,54 @@ this.showMsg(ex.msg); }); }, - groupSetting(item, index) { + groupCheck() { + + uni.navigateTo({ + url: '/pages/4877/BJQ4877CheckColor', + events: { + CheckGroupOver: function(data) { + debugger; + let arr = groupColors.filter(v => { + + let f = data.checkIds.find(item => { + return item === v.id; + }) + if (f) { + return true; + } + return false; + }); + + these.dic.groups = arr; + these.CheckGroupOver(data.allFlag); + } + }, + success(res) { + res.eventChannel.emit("CheckGroup", these.device) + } + }); + }, + CheckGroupOver(arr) { //选择了某些配组 + debugger; let f = this.getDevice(); if (!f) { this.showBleUnConnect(); return; } - if (this.formData.sta_GroupType === item.val) { - this.formData.sta_GroupType = ''; - } else { - this.formData.sta_GroupType = item.val; - } + var json = { - ins_GroupType: this.formData.sta_GroupType + ins_GroupType: arr } json = JSON.stringify(json); - ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30) - .catch(ex => { - this.showMsg(ex.msg); - }); + ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => { + + }).catch(ex => { + this.showMsg(ex.msg); + }); }, + + showUnWarn(val) { this.showPop({ message: '确定解除声光报警模式?', @@ -526,28 +628,57 @@ }); }, - sosSetting(item, index) { + groupSetting(item, index) { + if (this.formData.sta_SOSType === 'sos') { + this.showMsg("设备强制报警中,请先关闭报警") + return; + } + if (this.formData.sta_GroupType === item.id) { + return; + } let f = this.getDevice(); if (!f) { this.showBleUnConnect(); return; } + + let groupSet = () => { + setTimeout(() => { + let buffer = { + ins_statusType: [item.id] + } + buffer = JSON.stringify(buffer); + console.error("发送命令:", buffer); + ble.sendString(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then( + result => { + this.formData.sta_GroupType = item.id; + this.formData.sta_SOSType = 'sos_off' + console.log("配组设置成功"); + }); + }, 0); + } + groupSet(); + }, + sosSetting(item, index) { + + let f = this.getDevice(); + if (!f) { + this.showBleUnConnect(); + + return; + } let task = () => { var json = { ins_SOSType: this.formData.sta_SOSType == item.val ? 'sos_off' : item.val } - json = JSON.stringify(json); + console.error("发送指令:", json); + // let f={deviceId:'111111'} ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => { - - if (this.formData.sta_SOSType === item.val) { - this.formData.sta_SOSType = 'sos_off'; - } else { - this.formData.sta_SOSType = item.val; - } - + this.formData.sta_GroupType = -1; + this.formData.sta_SOSType = json.ins_SOSType if (this.formData.sta_SOSType == 'sos') { this.formData.warnTime = 0; clearInterval(interval); @@ -560,25 +691,32 @@ }) .catch(ex => { this.showMsg(ex.msg); + }); } if (item.val === 'sos') { this.showPop({ - message: '确定开启声光报警模式?', + message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?', iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", okCallback: task, - buttonText: "开启", + buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'), showCancel: true, buttonCancelText: '取消' }); + } else if (item.val === 'sos_off') { + task(); } else { - if (index !== undefined && this.formData.sta_SOSType == 'sos') { - this.showUnWarn(item.val); + + if (this.formData.sta_SOSType === 'sos') { + this.showMsg("设备强制报警中,请先关闭报警"); + + return; } else { task(); + } } @@ -753,7 +891,7 @@ return false; }); - uni.setStorageSync(ble.StorageKey, ble.data.LinkedList); + ble.updateCache(); }, showBleUnConnect() { @@ -1345,7 +1483,7 @@ border-radius: 16rpx; background: rgba(26, 26, 26, 1); width: 100%; - padding: 30rpx 0rpx; + padding: 10rpx 0rpx; } .modeSetting { @@ -1381,8 +1519,8 @@ } .modeSetting .arrow .outCircle { - width: 150rpx; - height: 150rpx; + width: 120rpx; + height: 120rpx; box-sizing: border-box; display: flex; flex-direction: row; @@ -1593,4 +1731,124 @@ justify-content: space-between; align-items: center; } + + .checkgroup { + color: rgba(174, 214, 0, 1); + + font-family: PingFang SC; + font-size: 28rpx; + font-weight: 400; + + letter-spacing: 0.14px; + text-align: left; + } + + + .colorContent { + display: flex; + align-content: center; + justify-content: flex-start; + justify-items: center; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + width: 100%; + box-sizing: border-box; + + } + + .colorContent .polygon { + width: 40rpx; + height: 40rpx; + border-radius: 8rpx; + + } + + .colorContent .text { + color: rgba(255, 255, 255, 0.87); + font-family: PingFang SC; + font-size: 30rpx; + font-weight: 400; + letter-spacing: 2rpx; + margin-left: 15rpx; + } + + .colorContent .item { + background-color: #1A1A1A; + margin-left: 36rpx; + width: calc(calc(100% - 72rpx) / 3); + height: 110rpx; + margin-top: 24rpx; + box-sizing: border-box; + padding-left: 25rpx; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: center; + align-content: center; + border-width: 1rpx; + border-style: solid; + border-color: #00000000; + border-radius: 8rpx; + } + + .colorContent .item.active { + border-color: #AED600 !important; + } + + .colorContent .marginNoLeft { + margin-left: 0rpx !important; + } + + + + .popup-prompt { + width: 100%; + box-sizing: border-box; + padding: 30rpx 15%; + } + + + .popup-prompt-title { + + text-align: center; + width: 100%; + float: left; + box-sizing: border-box; + white-space: nowrap; + color: rgba(255, 255, 255, 0.87); + font-family: PingFang SC; + font-size: 28rpx; + font-weight: 400; + line-height: 40rpx; + letter-spacing: 0.14rpx; + + + } + + .popup-prompt-input { + + width: 100%; + height: 60rpx; + line-height: 60rpx; + color: rgba(255, 255, 255, 0.87); + box-sizing: border-box; + border-bottom: 2rpx solid rgba(255, 255, 255, 0.4); + font-size: 28rpx; + font-weight: 400; + letter-spacing: 0.14px; + } + + .popup-prompt-input-placeHolder { + color: rgba(255, 255, 255, 0.4); + + font-family: PingFang SC; + font-size: 28rpx; + font-weight: 400; + + letter-spacing: 0.14px; + text-align: center; + + } \ No newline at end of file diff --git a/pages/common/addBLE/LinkBle.vue b/pages/common/addBLE/LinkBle.vue index 9977b67..82c2791 100644 --- a/pages/common/addBLE/LinkBle.vue +++ b/pages/common/addBLE/LinkBle.vue @@ -173,6 +173,7 @@ } else{ try{ + console.log("str=",receive.str) let json=JSON.parse(receive.str); let key = "sta_address"; if (key in json) {//100 diff --git a/pages/common/audioManager/AudioList.vue b/pages/common/audioManager/AudioList.vue index 21f05f1..f3f379a 100644 --- a/pages/common/audioManager/AudioList.vue +++ b/pages/common/audioManager/AudioList.vue @@ -601,6 +601,8 @@ console.log("无文件删除"); return; } + + console.log("item=", item); let delFile = (tempFilePath) => { let promise = new Promise((resolve, reject) => { @@ -687,7 +689,7 @@ this.Status.isEdit = false; this.showMsg("操作成功", true); - }, 100) + }, 0) } diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 6c77356..877b62b 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -1740,9 +1740,9 @@ class BleHelper { bufferHex = bytes.map(b => '0x' + b.toString(16).padStart(2, '0').toUpperCase()).join(' '); } } - console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId); - console.log("发送数据(Hex):", bufferHex || "(空数据)"); - console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0); + // console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId); + // console.log("发送数据(Hex):", bufferHex || "(空数据)"); + // console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0); if (ms === undefined) { ms = 50; } @@ -1831,10 +1831,10 @@ class BleHelper { } if (c.Linked) { - console.log("蓝牙已连接,直接发送数据"); + // console.log("蓝牙已连接,直接发送数据"); return sendBuffer(); } else { - console.log("蓝牙未连接,先连接蓝牙再发送数据"); + // console.log("蓝牙未连接,先连接蓝牙再发送数据"); return new Promise((resolve, reject) => { let f = this.data.LinkedList.find((v) => { return v.deviceId == deviceid;