From 90cee62df1e7ce50b5a941ad9bcc4879ca2fbe59 Mon Sep 17 00:00:00 2001 From: liub Date: Fri, 17 Oct 2025 17:29:08 +0800 Subject: [PATCH] =?UTF-8?q?6331=E5=89=8D=E7=AB=AF=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90,=E6=89=A9=E5=B1=95msgPop?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8F=92=E6=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/MessagePopup/MessagePopup.vue | 17 +- pages.json | 7 + pages/6331/AudioManager.vue | 22 + pages/6331/BJQ6331.vue | 1505 +++++++--------------- pages/670/HBY670.vue | 3 +- pages/common/index/index.vue | 4 + static/images/6331/jieN.png | Bin 0 -> 1524 bytes static/images/6331/jieNActive.png | Bin 0 -> 2099 bytes static/images/6331/play.png | Bin 0 -> 1037 bytes static/images/6331/shuXie.png | Bin 0 -> 2076 bytes static/images/6331/shuxieActive.png | Bin 0 -> 2908 bytes static/images/6331/upload.png | Bin 0 -> 1290 bytes static/images/6331/volume.png | Bin 0 -> 2058 bytes static/images/6331/work.png | Bin 0 -> 1528 bytes static/images/6331/workActive.png | Bin 0 -> 2242 bytes utils/BleHelper.js | 47 +- 16 files changed, 574 insertions(+), 1031 deletions(-) create mode 100644 pages/6331/AudioManager.vue create mode 100644 static/images/6331/jieN.png create mode 100644 static/images/6331/jieNActive.png create mode 100644 static/images/6331/play.png create mode 100644 static/images/6331/shuXie.png create mode 100644 static/images/6331/shuxieActive.png create mode 100644 static/images/6331/upload.png create mode 100644 static/images/6331/volume.png create mode 100644 static/images/6331/work.png create mode 100644 static/images/6331/workActive.png diff --git a/components/MessagePopup/MessagePopup.vue b/components/MessagePopup/MessagePopup.vue index 6b6cefc..b638dd0 100644 --- a/components/MessagePopup/MessagePopup.vue +++ b/components/MessagePopup/MessagePopup.vue @@ -17,6 +17,7 @@ :style="{color:textColor || getTypeStyle('textColor')}" @click="closeClick" >x + - {{ message }} + {{ message }} + + + @@ -40,16 +44,18 @@ /> - + {{ buttonCancelText?buttonCancelText:'取消' }} diff --git a/pages/6331/BJQ6331.vue b/pages/6331/BJQ6331.vue index 5df12b7..451501a 100644 --- a/pages/6331/BJQ6331.vue +++ b/pages/6331/BJQ6331.vue @@ -1,7 +1,7 @@ @@ -183,16 +236,19 @@ } from '../../utils/request'; import usrApi from '@/api/670/HBY670.js' - const pagePath = "pages/650/HBY650"; + const pagePath = "pages/6331/BJQ6331"; var ble = null; var these = null; var recei = null; + var slideTime = null; + export default { data() { return { Status: { - + showLightingSet: false, + showVolumeSet: false, Pop: { showPop: false, //是否显示弹窗 popType: 'custom', @@ -209,7 +265,8 @@ promptTitle: '设备名称', modelValue: '', visibleClose: false, - okCallback: null + okCallback: null, + showSlot: false }, BottomMenu: { show: false, @@ -254,25 +311,15 @@ battary: '', xuhang: '', blename: '', - deviceId: '', deviceName: '', - RSSI: '', - statu: '', - liangDu: '', - warnLevel: '', - macAddress: '', - cMode: false, - modeCurr: 'low', - - company: '', - name: '', - job: '', - id: '', - iswarn: false, - bleStatu: false + lightCurr: '', + liangDu: 100, + modeCurr: '', + bleStatu: false, + deviceId: '', + volume: 100 }, - rgb565Data: [], - videoHexArray: [], + device: { id: "", deviceName: "", @@ -289,9 +336,9 @@ latitude: null, longitude: null, alarmStatus: null, - detailPageUrl: "/pages/650/HBY650", + detailPageUrl: "/pages/6331/BJQ6331", showConfirm: false - }, + } } }, @@ -339,16 +386,19 @@ let keys = Object.keys(form); for (var i = keys.length; i >= 0; i--) { let key = keys[i]; - these.formData[key] = form[key]; + if (key in these.formData) { + these.formData[key] = form[key]; + } + } } these.formData.blename = f.name ? f.name : "Unname"; these.formData.deviceName = device.deviceName; these.formData.img = device.devicePic; - + these.formData.deviceId = f.deviceId; - ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res=>{ - these.formData.bleStatu=true; + ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { + these.formData.bleStatu = true; }); these.setBleFormData(); these.getDetail(); @@ -364,24 +414,186 @@ this.Status.pageHide = false; }, computed: { - RSSIRemark: function() { - let remark = '极弱'; - if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) { - remark = '强'; - } - if (this.formData.RSSI < -30 && this.formData.RSSI >= -60) { - remark = '一般'; - } - if (this.formData.RSSI < -60 && this.formData.RSSI >= -85) { - remark = '弱'; - } - if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) { - remark = '微弱'; - } - } }, methods: { + sliderChange: function(evt) { + + let val = evt.detail.value; + let type = ""; + if (this.Status.showLightingSet) { + this.formData.liangDu = val; + type = "liangdu"; + } else { + this.formData.volume = val; + type = "volume" + } + clearTimeout(slideTime) + //给蓝牙设备发送信号更新亮度 + slideTime = setTimeout(() => { + this.bleSendCmd(type, val) + }, 200); + }, + closeSetPop() { + this.Status.showLightingSet = false; + this.Status.showVolumeSet = false; + }, + playAudio() { //播放语音 + let play = () => { + alert('正在播放中'); + } + this.showPop({ + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#383934bd', + borderColor: '#FFC84E1E', + textColor: '#ffffffde', + buttonBgColor: '#FFC84E', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '确认播放设备语音内容?', + buttonText: '确定', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: true, + okCallback: play + }); + }, + audioManage() { //语音管理 + uni.navigateTo({ + url: '/pages/6331/AudioManager', + success(res) { + res.eventChannel.emit("deviceData", these.device); + }, + events: { + over: function(data) { + + } + } + }) + }, + volumeSetting() { //音量设置 + this.Status.showVolumeSet = true; + + this.showPop({ + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#38393466', + borderColor: '#00000000', + textColor: '#ffffffde', + buttonBgColor: '#FFC84E', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: true, + okCallback: null, + showSlot: true + }); + + }, + showLihgtPercent(item) { //亮度调整 + if (item == this.formData.lightCurr) { + + this.Status.showLightingSet = true; + + this.showPop({ + showPop: true, //是否显示弹窗 + popType: 'custom', + bgColor: '#38393466', + borderColor: '#00000000', + textColor: '#ffffffde', + buttonBgColor: '#FFC84E', + buttonTextColor: '#232323DE', + iconUrl: '', + message: '', + buttonText: '', + clickEvt: '', + visiblePrompt: false, + promptTitle: '', + modelValue: '', + visibleClose: true, + okCallback: null, + showSlot: true + }); + + + + } + + + }, + warnLightSetting(item) { //警示灯模式 + let type = item; + if (item == this.formData.modeCurr) { + type = 'warnClose'; + } + + this.formData.modeCurr = type; + this.bleSendCmd(type); + }, + lightSetting(item) { + let type = item; + if (item == this.formData.lightCurr) { + type = 'lightClose'; + } + + this.formData.lightCurr = type; + this.bleSendCmd(type); + }, + bleSendCmd(type, values) { + let f = this.getDevice(); + + if (!f) { + this.showBleUnConnect(); + return; + } + + let dic = { + shuxie: [], + work: [], + jieN: [], + rb: [], + yellow: [], + quwen: [], + liangdu: [], + volume: [] + } + let array = dic[type]; + if (type in dic) { + if (type === 'liangdu' || type == 'volume') { + if (Array.isArray(values)) { + array = array.concat(values); + } else { + array.push(values); + } + } + } else { + if (Array.isArray(values)) { + array = values; + } else { + array = [values]; + } + } + + + ble.sendHexs(f.deviceId, array, f.writeServiceId, f.wirteCharactId, 100).catch(ex => { + these.showPop({ + message: "发送失败," + ex.msg, + iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", + borderColor: "#e034344d", + buttonBgColor: "#E03434", + }); + }); + + }, + deviceRecovry(res) { if (this.Status.pageHide) { return; @@ -461,88 +673,11 @@ urls: [img] }) }, - getWarnStyle(index) { - let className = ""; - switch (this.formData.warnLevel) { - case "无预警": - break; - case "弱预警": - if (index <= 1) { - className = "active"; - } - break; - case "中预警": - if (index <= 3) { - className = "active"; - } - break; - case "强预警": - if (index <= 4) { - className = "active"; - } - break; - case "非常强预警": - if (index <= 5) { - className = "active"; - } - break; - } - return className; - }, bleValueNotify: function(receive, device, path) { //订阅消息 console.log("收到设备的数据", receive) let data = recei.ReceiveData(receive, device, pagePath); - if (data) { - if ("staBlue_picture" in data) { - //重发图片 - console.log("收到重新发送图片的命令"); - this.checkImgUpload('img', data.staBlue_picture); - return; - } else if ("staBlue_text" in data) { - //重发文本 - console.log("收到重新发送文本的命令"); - this.sendUsr(data.staBlue_text); - return; - } else if ("staBlue_vidio" in data) { - //重发视频 - console.log("收到重新发送视频的命令"); - this.checkImgUpload('video', data.staBlue_vidio); - return; - } else if ("staBlue" in data) { - if (data.staBlue == "finish") { - console.log("收到设备回复,全部传输完成"); - } - return; - } - - let keys = Object.keys(data); - for (var i = 0; i < keys.length; i++) { - let key = keys[i]; - if (key in these.formData) { - these.formData[key] = data[key]; - } - - } - - if (these.formData.iswarn) { - these.showPop({ - message: "环境存在漏电电源", - iconUrl: "/static/images/6155/DeviceDetail/warnning.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - } - - these.setBleFormData(); - } - - - // // 转换为字节数组 - // const bytes = receive.bytes; - // parseData(bytes); - }, @@ -559,16 +694,10 @@ getDetail() { var that = this; usrApi.getDetail(this.device.id).then(res => { -console.log("res=",res); + console.log("res=", res); if (res && res.code == 200) { res = res.data; - let personnelInfo = res.personnelInfo; - if (personnelInfo) { - that.formData.company = personnelInfo.unitName; - that.formData.name = personnelInfo.name; - that.formData.job = personnelInfo.position; - that.formData.id = personnelInfo.code - } + } }); }, @@ -585,100 +714,10 @@ console.log("res=",res); uni.setStorageSync(ble.StorageKey, ble.data.LinkedList); }, - MainModeSetting: function(type, byteType) { - if (this.formData.modeCurr == type) { - return; - } - showLoading(this, { - text: "请稍候..." - }); - let task = () => { - this.formData.modeCurr = type; - let dataValue = 0x00; - let btype = 0x00; - switch (type) { - case "low": //低档 - dataValue = 0x67; - break; - case "center": //中档 - dataValue = 0x66; - break; - case "hight": //高档 - dataValue = 0x65; - break; - case "close": //关闭 - dataValue = 0x64; - break; - case true: //开灯 - dataValue = 0x6E; - break; - case false: //关灯 - dataValue = 0x6F; - break; - default: //未知 - dataValue = 0x00; - break; - } - switch (byteType) { - case "staticBattery": - btype = 0x00; - break; - case "lamp": - btype = 0x01; - break; - default: - break; - } - let buffer = new ArrayBuffer(6); - let dataView = new DataView(buffer); - - dataView.setUint8(0, 0x55); // 帧头 - dataView.setUint8(1, btype); // 帧类型 - dataView.setUint8(2, 0x01); // 包序号 - dataView.setUint8(3, 0x00); // 数据长度 - dataView.setUint8(4, 0x01); // 数据长度 - dataView.setUint8(5, dataValue); // 数据 - - - - let f = this.getDevice(); - - if (f) { - // 发送数据 - - ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(() => { - - - console.log("发送成功了"); - }).catch((ex) => { - - these.showPop({ - message: ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - - }).finally(() => { - - hideLoading(these); - - these.setBleFormData(); - }); - } else { - these.showBleUnConnect(); - hideLoading(these); - } - } - - setTimeout(task, 0); - - - }, showBleUnConnect() { - this.showPop({ + these.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", borderColor: "#e034344d", @@ -706,12 +745,13 @@ console.log("res=",res); }) } }); - }, - LampToggle: function() { - this.formData.cMode = !this.formData.cMode; - this.MainModeSetting(this.formData.cMode, "lamp"); + + + + }, + proParam: function() { uni.navigateTo({ @@ -737,510 +777,6 @@ console.log("res=",res); } }); }, - checkImgUpload: function(type, index) { - console.log("123213213213"); - let f = these.getDevice(); - // 分包发送图片数据 - var sendImagePackets = function(ReSendNo) { - - return new Promise((resolve, reject) => { - - // 总数据包数 - let totalPackets = 52; - let currentPacket = 1; - - if (ReSendNo) { - totalPackets = ReSendNo; - currentPacket = ReSendNo; - } - - if (f) { - // 发送单个数据包 - const sendNextPacket = () => { - if (currentPacket > totalPackets) { - hideLoading(these); - these.Status.BottomMenu.show = false; - these.showPop({ - showPop: true, - message: "上传成功", - iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - }); - if (!ReSendNo) { - setTimeout(() => { - these.HoldYouHand("transmit complete", 0, f - .deviceId, f - .writeServiceId, f.wirteCharactId); - }, 500); - - } - - resolve(); - return; - } - - // 计算当前包的数据 - let packetSize = 250; - // if (currentPacket <= 51) { - // packetSize = 250; // 前51个包每个500字节 - // } else { - // packetSize = 50; // 最后一个包100字节 - // } - - // 创建数据包 - const startIndex = (currentPacket - 1) * packetSize; - const endIndex = Math.min(startIndex + packetSize, these.rgb565Data - .length); - if (startIndex > endIndex) { - return; - } - const packetData = these.rgb565Data.slice(startIndex, - endIndex); - // 构建数据包 - const bufferSize = 505; // 5 + packetData.length * 2; // 头部5字节 + 数据部分 - const buffer = new ArrayBuffer(bufferSize); - const dataView = new DataView(buffer); - - // 填充头部 - dataView.setUint8(0, 0x55); // 帧头 - dataView.setUint8(1, 0x02); // 帧类型:开机画面 - dataView.setUint8(2, '0x' + currentPacket.toString(16).padStart(2, - '0')); // 包序号 - - - if (packetData.length == 250) { - dataView.setUint8(3, 0x01); - dataView.setUint8(4, 0xF4); - } else { - dataView.setUint8(3, 0x00); - dataView.setUint8(4, 0x64); - } - - // 填充数据(每个RGB565值占2字节) - for (let i = 0; i < packetData.length; i++) { - dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序 - } - - if (currentPacket > 51) { //第52包补FF - for (var i = 105; i < bufferSize; i++) { - dataView.setUint8(i, 0xFF); - } - } - - - - //发送数据包 - ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, - 10) - .then(() => { - - - updateLoading(these, { - text: "正在发送:" + currentPacket + "/" + - totalPackets - }) - currentPacket++; - - setTimeout(sendNextPacket, 0); - }).catch(err => { - console.log("发送数据包失败了" + JSON.stringify(err)); - if (err.code == '10007') { - setTimeout(sendNextPacket, 0); - return; - } - these.Status.BottomMenu.show = false; - - - - these.showPop({ - message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - hideLoading(these); - reject(err); - }); - } - - if (ReSendNo) { - sendNextPacket(ReSendNo); - return; - } - // 开始牵手 - these.HoldYouHand("picture transmit start", 120, f.deviceId, f.writeServiceId, - f.wirteCharactId).then(() => { - sendNextPacket(); - }).catch((err) => { - console.log("握手没有成功"); - these.showPop({ - message: err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - hideLoading(these); - reject(err); - }); - } - }); - } - //去图片裁剪 - var gotoCutImg = (imgPath) => { - - uni.navigateTo({ - url: "/pages/6155/ImgCrop", - events: { - ImgCutOver: function(data) { - // console.log("我收到裁剪后的图片了,感谢老铁," + data) - showLoading(these, { - text: "正在发送..." - }); - - these.Status.BottomMenu.show = false; - these.rgb565Data = ble.convertToRGB565(data.piexls); - setTimeout(function() { - sendImagePackets().catch(() => { - - }); - }, 0) - - } - }, - success(ev) { - ev.eventChannel.emit('checkImg', { - data: imgPath - }); - these.Status.BottomMenu.show = false; - } - }); - } - - - let sendVideoPackets = (ReSendNo) => { - console.log("开始发送分片数据"); - return new Promise((resolve, reject) => { - if (f) { - // 总数据包数 - var totalPackets = 1536; - - let currentPacket = 1; - console.log("发送数据准备中,总共" + totalPackets); - if (ReSendNo) { - totalPackets = ReSendNo; - currentPacket = ReSendNo; - } - this.totalPackets = totalPackets; - // 发送单个数据包 - const sendNextVideoPacket = () => { - console.log("准备发送一段数据"); - if (currentPacket > totalPackets) { - if (!ReSendNo) { - setTimeout(() => { - these.HoldYouHand("transmit complete", 0, f - .deviceId, f - .writeServiceId, f.wirteCharactId).then( - () => { - console.log("全部发送完毕") - }).catch((ex) => { - console.log("出现异常", ex); - }); - }, 500); - - } - these.Status.BottomMenu.show = false; - hideLoading(these); - these.showPop({ - showPop: true, - message: "上传成功", - iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" - }); - - - - - resolve(); - - return; - } - - // 计算当前包的数据 - let packetSize = 500; - - - // 创建数据包 - const startIndex = (currentPacket - 1) * packetSize; - const endIndex = Math.min(startIndex + packetSize, these.videoHexArray - .length); - if (startIndex > endIndex) { - resolve(); - return; - } - ////console.log("111111"); - const packetData = these.videoHexArray.slice(startIndex, endIndex); - - // 构建数据包 - ////console.log("packetData.length"+packetData.length); - const bufferSize = 506; // 头部5字节 + 数据部分 - const buffer = new ArrayBuffer(bufferSize); - const dataView = new DataView(buffer); - - let sortNo = currentPacket.toString(16).padStart(4, '0'); - - // 填充头部 - dataView.setUint8(0, 0x55); // 帧头 - dataView.setUint8(1, 0x04); // 帧类型:开机画面 - dataView.setUint8(2, '0x' + sortNo.substring(0, 2)); // 包序号 - dataView.setUint8(3, '0x' + sortNo.substring(2, 4)); // 包序号 - - dataView.setUint8(4, 0x01); - dataView.setUint8(5, 0xF4); - - for (let i = 0; i < packetData.length; i++) { - dataView.setUint8(6 + i, '0x' + packetData[i]); - } - - let inteval = 50; - console.log("开始发送一段视频"); // - ble.sendData(f.deviceId, buffer, f.writeServiceId, f - .wirteCharactId, 10).then(() => { - - updateLoading(these, { - text: "正在发送:" + currentPacket + "/" + - totalPackets - }) - - currentPacket++; - - console.log("发送一段成功,发送下一段"); - setTimeout(sendNextVideoPacket, inteval); - }).catch(err => { - console.log("发送失败了"); - if (err.code == '10007') { //遇到这个错误自动重新发送 - console.log(err.errMsg + ",发送失败了,正在补偿:" + - currentPacket); - setTimeout(sendNextVideoPacket, inteval); - } else { - these.Status.BottomMenu.show = false; - hideLoading(these); - - these.showPop({ - showPop: true, - message: err.msg + ",发送失败了", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - buttonText: "确定", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png" - }); - reject(err); - return; - } - - }); - }; - - - sendNextVideoPacket(); - - - } else { - console.log("Fail.......") - } - }); - } - - var sendVideo = (videoPath) => { - let uploadVideo = () => { - - if (these.videoHexArray.length > 0) { - console.log("开始处理,无需上传"); - shotVideoClick(these.videoHexArray); - return; - - } - console.log("开始处理,正在上传"); - - showLoading(these, { - text: "上传中" - }); - let p1 = these.HoldYouHand("video transmit start", 2200, f.deviceId, f.writeServiceId, - f.wirteCharactId); - let p2 = new Promise((succ, err) => { - - const token = uni.getStorageSync('token'); - const clientid = uni.getStorageSync('clientID'); - if (!token) { - err({ - code: 401, - msg: "请先登陆后再试" - }); - hideLoading(these); - return; - } - - uni.uploadFile({ - // url: 'http://114.55.111.217/video/upload', - url: baseURL + "app/video/upload", - filePath: videoPath, - name: 'file', - header: { - "Method": "POST", - "Content-Type": "multipart/form-data", - "Authorization": 'Bearer ' + token, - "clientid": clientid - }, - timeout: 600000, - fail: (ex) => { - console.log("上传视频失败" + JSON.stringify(ex)); - - err(ex); - }, - success: (res) => { - - console.log("上传完成,向蓝牙设备发送"); - succ(res); - } - - }); - }); - - Promise.all([p1, p2]).then((arr) => { - - let res = arr[1]; - res = JSON.parse(res.data); - if (res.data) { - these.videoHexArray = res.data; - updateLoading(these, { - text: "正在发送:0/1536" - }); - - these.Status.BottomMenu.show = false; - - shotVideoClick(res.data); - - - } else { - console.log("服务器未返回正确的数据"); - - - these.showPop({ - message: "与服务器连接出现异常,请检查网络设置", - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - } - - }).catch((ex) => { - - hideLoading(these); - these.showPop({ - message: "出现异常," + ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - }) - } - let f = these.getDevice(); - - - - - let shotVideoClick = () => { - console.log("正在开始发送"); - sendVideoPackets().then(() => { - console.log("发送完成"); - - }).catch((ex1) => { - //console.log("出现了异常", ex1) - }).finally(() => { - hideLoading(these); - }); - } - - - uploadVideo(); - - } - - if (type) { - if (type == 'img') { - sendImagePackets(index); - } else if (type == 'video') { - sendVideoPackets(index); - } - return; - } - uni.chooseMedia({ - count: 1, - mediaType: ['image', 'video'], - sourceType: ['album'], - maxDuration: 3, - sizeType: ['original'], - success: (res) => { - - let file = res.tempFiles[0]; - - if (file.fileType == 'image') { - gotoCutImg(file.tempFilePath); - return; - } - - if (file.fileType == 'video') { - if (file.duration < 2) { - this.alert('提示', "请选择2S及以上的视频"); - return; - } - - these.videoHexArray = []; - sendVideo(file.tempFilePath); - return; - } - } - }); - - - }, - ShowUpload: function() { - //上传开机画面 - this.Status.BottomMenu.menuItems = []; - this.Status.BottomMenu.title = "上传开机画面"; - this.Status.BottomMenu.type = "checkImg"; - this.Status.BottomMenu.show = true; - this.formData.cMode = "img"; - }, - - showMenu(flag) { - this.Status.BottomMenu.show = true; - }, - closeMenu() { - this.Status.BottomMenu.show = false; - }, - btnClick(item, index) { - - - - - }, - setMode(mode) { - - - - - }, - handleItemClick(item, index) { - - switch (this.Status.BottomMenu.type) { - case "main": - - break; - case "fu": - - break; - } - this.Status.BottomMenu.activeIndex = index; - - }, closePop: function() { this.Status.Pop.showPop = false; @@ -1260,242 +796,51 @@ console.log("res=",res); } }, showPop: function(option) { + let def = { + 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: null, + showSlot: false + } - if (!option) { - option = { - a: 1 - }; - } - let keys = Object.keys(option); - for (var i = 0; i < keys.length; i++) { + let keys = Object.keys(def); + + for (let i = 0; i < keys.length; i++) { let key = keys[i]; - these.Status.Pop[key] = option[key]; + if (key in option) { + continue; + } + these.Status.Pop[key] = def[key]; } + if (option) { + keys = Object.keys(option); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + + these.Status.Pop[key] = option[key]; + } + } + if (!option.borderColor) { option.borderColor = '#BBE600'; option.buttonBgColor = '#BBE600'; } these.Status.Pop.showPop = true; - }, - sendUsr: function(ReSendNo) { - - - - var textLines = [ - this.formData.company, - this.formData.name, - this.formData.job, - this.formData.id - ]; - - - let f = this.getDevice(); - if (!f) { - these.showBleUnConnect(); - return; - } - showLoading(this, { - text: "请稍候..." - }); - var sendText = function() { - // 总数据包数 - let totalPackets = textLines.length; - let currentPacket = 1; - // console.log("currentPacket=",currentPacket); - // console.log("ReSendNo=",ReSendNo); - if (ReSendNo) { - totalPackets = ReSendNo; - currentPacket = ReSendNo; - } - // console.log("currentPacket=",currentPacket); - // 发送单个数据包 - const sendNextPacket = () => { - - if (currentPacket > totalPackets) { - if (!ReSendNo) { - setTimeout(() => { - these.HoldYouHand("transmit complete", 0, f.deviceId, f - .writeServiceId, f - .wirteCharactId); - }, 500); - - } - - these.showPop({ - showPop: true, //是否显示弹窗 - popType: 'custom', - bgColor: '#383934bd', - borderColor: '#BBE600', - textColor: '#ffffffde', - buttonBgColor: '#BBE600', - buttonTextColor: '#232323DE', - iconUrl: '/static/images/6155/DeviceDetail/sendSucc.png', - message: '人员信息发送成功', - buttonText: '确定', - clickEvt: 'SendUsr', - visiblePrompt: false, - promptTitle: '', - modelValue: '', - visibleClose: true - }); - these.setBleFormData(); - - - let json = { - deviceId: these.device.id, - name: these.formData.name, - position: these.formData.job, - unitName: these.formData.company, - code: these.formData.id - }; - usrApi.sendUsr(json) - return; - } - - // 获取当前行文字 - const text = textLines[currentPacket - 1] || ''; - let arr = gbk.encode(text) - let gbkData = gbk.arr2hex(arr); - - let s = (text.length * 2).toString(16); - let len = String(s).padStart(4, '0') - len = len.match(/.{1,2}/g); - // 构建数据包 - const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分 - const buffer = new ArrayBuffer(bufferSize); - const dataView = new DataView(buffer); - - // 填充头部 - dataView.setUint8(0, 0x55); // 帧头 - dataView.setUint8(1, 0x03); // 帧类型:文字 - dataView.setUint8(2, currentPacket.toString(16)); // 包序号 - dataView.setUint8(3, parseInt('0x' + len[0], 16)); // 数据长度 - dataView.setUint8(4, parseInt('0x' + len[1], 16)); // 数据长度 - - // 填充数据 - let index = 0; - for (var i = 0; i < gbkData.length; i += 2) { - let value = parseInt(gbkData[i] + "" + gbkData[i + 1], 16); - dataView.setUint8(5 + index, value); - index++; - } - - - // 发送数据包 - - - ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(() => { - // 更新进度 - console.log( - `发送文字数据包 ${currentPacket}/${totalPackets}: ${text}` - ); - - // 发送下一个包 - currentPacket++; - setTimeout(sendNextPacket, 0); - }).catch(err => { - - these.showPop({ - message: "文字发送失败," + err.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - }).finally(() => { - hideLoading(these); - }); - - - - - - }; - - // 开始发送第一个包 - sendNextPacket(); - } - - - if (ReSendNo) { - sendText(ReSendNo); - return; - } - setTimeout(() => { - these.HoldYouHand("word transmit start", 120, f.deviceId, f.writeServiceId, f - .wirteCharactId).then( - () => { - - setTimeout(sendText, 200); - }).catch((ex) => { - console.log("握手没有成功", ex); - hideLoading(these); - these.showPop({ - message: ex.msg, - iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", - borderColor: "#e034344d", - buttonBgColor: "#E03434", - }); - }); - }, 0); - - - - }, - - HoldYouHand(str, pauseTime, deviceid, serviceid, characid) { - if (!pauseTime) { - pauseTime = 0; - } - - var promise = new Promise((resolve, reject) => { - // 1. 创建 ArrayBuffer 和 DataView - const buffer = new ArrayBuffer(str.length); - const dataView = new DataView(buffer); - - // 2. 将字符串转换为 ASCII 码并写入 DataView - for (let i = 0; i < str.length; i++) { - dataView.setUint8(i, str.charCodeAt(i)); - } - console.log("开始握手"); - - let send = () => { - ble.sendData(deviceid, buffer, serviceid, characid, 10).then( - () => { - setTimeout(() => { - console.log("握手成功并完成了等待"); - resolve(true); - }, pauseTime); - }).catch(err => { - if (err.code == 10007) { - send(); - } else { - console.log("握手没有成功", err) - reject(err); - } - - }); - } - - send(); - - - - }); - - - - return promise; - }, - - ack: function() { - - - let eventChannel = this.getOpenerEventChannel(); - eventChannel.emit('ack', { - data: '我已收到了您的消息,谢谢。' - }); - } + } } @@ -1630,6 +975,12 @@ console.log("res=",res); margin-top: 24rpx; } + .lamp .title .active {} + + .lamp .title .noActive { + color: #FFFFFF3c !important; + } + .lamp .title { width: 100%; height: 60rpx; @@ -1646,7 +997,7 @@ console.log("res=",res); } .lampMode { - padding: 30rpx 0rpx; + width: 100%; box-sizing: border-box; @@ -1667,6 +1018,10 @@ console.log("res=",res); box-sizing: border-box; } + .lampMode .mode.noMargintop { + margin-top: 0px !important; + } + .lampMode .mode.active { border: 1px solid rgba(174, 214, 0, 1); @@ -1891,17 +1246,20 @@ console.log("res=",res); align-content: center; justify-content: space-around; align-items: center; - + background-color: #1a1a1a; + box-sizing: border-box; + padding: 30rpx 0rpx; + border-radius: 16rpx; } .modeSetting .item { - width: 150rpx; - height: 150rpx; - background: rgba(26, 26, 26, 1); + width: 120rpx; + height: 120rpx; + background: #2A2A2A; border-radius: 50%; color: rgba(255, 255, 255, 0.87); - margin-top: 20rpx; + font-family: PingFang SC; font-size: 28rpx; font-weight: 400; @@ -1913,7 +1271,7 @@ console.log("res=",res); .modeSetting .item.active { border: 4rpx solid rgba(174, 214, 0, 1); background: rgba(26, 26, 26, 1); - padding: 6rpx; + padding: 4rpx; color: rgba(26, 26, 26, 0.87); } @@ -1968,6 +1326,10 @@ console.log("res=",res); height: 100%; } + .line15 { + line-height: 34rpx; + } + .center { display: flex; flex-direction: row; @@ -1977,6 +1339,11 @@ console.log("res=",res); align-items: center; } + .centerCol { + display: flex; + flex-direction: column; + } + .centerLeft { display: flex; flex-direction: row; @@ -2045,4 +1412,94 @@ console.log("res=",res); .net.active { background: #FFFFFF !important; } + + .lightMode { + width: 100%; + height: 180rpx; + border-radius: 16rpx; + background: rgba(26, 26, 26, 1); + margin-bottom: 30rpx; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-content: center; + justify-content: space-between; + align-items: center; + } + + + .lightMode .item { + width: calc(calc(100% - 90rpx) / 3); + height: 100%; + box-sizing: border-box; + border-radius: 16rpx; + + color: rgba(255, 255, 255, 0.87); + font-family: 'PingFang SC'; + font-size: 28rpx; + font-weight: 400; + letter-spacing: 0.14rpx; + display: flex; + flex-direction: column; + flex-wrap: nowrap; + align-content: center; + justify-content: space-evenly; + align-items: center; + } + + .lightMode .item.active { + + color: #AED600; + } + + .lightMode .imgContent { + width: 80rpx; + height: 100rpx; + } + + .lightMode .imgContent .img { + width: 100%; + height: 100%; + + } + + .mask { + position: fixed; + z-index: 99998; + width: 100%; + height: 100%; + background-color: #00000000; + top: 0px; + left: 0px; + } + + .popContent { + position: fixed; + z-index: 99999; + width: 85%; + height: auto; + min-height: 200rpx; + border-radius: 40rpx; + backdrop-filter: blur(28rpx); + background: #383934; + left: 50%; + /* 水平方向居中起点(父容器50%位置) */ + top: 50%; + /* 垂直方向居中起点 */ + transform: translate(-50%, -50%); + /* 向左/上偏移自身一半,实现完全居中 */ + } + + .slideTitle { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-content: center; + justify-content: space-between; + align-items: center; + margin-top: 30rpx; + width: 100%; + box-sizing: border-box; + padding: 0px 30rpx; + } \ No newline at end of file diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index cdcd8c1..e852e90 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -2336,8 +2336,9 @@ // 获取当前行文字 const text = textLines[currentPacket - 1] || ''; let arr = gbk.encode(text) + console.log("arr=",arr); let gbkData = gbk.arr2hex(arr); - + console.log("gbkData=",gbkData); // 构建数据包 const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分 diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 3995d7f..f5777b8 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -541,6 +541,10 @@ // 列表跳转 handleFile(item) { let url = item.detailPageUrl; + + // url="/pages/6331/BJQ6331"; + + uni.navigateTo({ url: url, success: (res) => { diff --git a/static/images/6331/jieN.png b/static/images/6331/jieN.png new file mode 100644 index 0000000000000000000000000000000000000000..71d371da3af1c49a2dccf38e403e0dcc360a6451 GIT binary patch literal 1524 zcmchXZ%i9y9LMh}P%M91H-!YpKUYSwDa{58V;~Js)*T=$BKF0$mMo;sSS@BFEke0= zh`@-zu2~jDXe3=sW?}&iEK<2T8`&nTv2Pfucm=jKxKyr`m7`qm@k)Im(^n?*mppeb z?)QAZzwhVnp6*lC(ga=#4}zcs$i@F$=mdU~{O67?Yl8>hb2Y8MurA*VL(bPD?mQ^E^ zx?wwtd}OPHX0%H=Fv_K^<{o;!l+GX1aj5uuBRW*(_6yHGz!R78Zto@}A3_I-Ya2Rx zzJ%=wUAG-(-p@gT66SFRGkBj#Vp4@V0ca9{H&kdGNW_Y}!0|3{U;^(zxk$PlO|_$Y zUBoTC-OOK(XsVZp5+~QE;Q9!AV3J(RSZ${)?Uef5_GwDfzftm+(`$6$$zaBRw-H76 z`qUQ?XZCu;sRgp!!{^p2gT)ceVz@PC^bUS6lWfLvc6x3Ho_Eg~u0g%NTW2{;BGrr} zZ&^BS{$6hQw?*ZT>v-BY_W`$((H!H`M@cF6fv3Ea${!6S*#`Z%tFI!MAkXVUvs`^q z#l7I=X~e1Ui^}Lj3(PV16`CN0h~fu4-e+lGlZz!RlgPs)hJS^{@Us9^uoyvE81NB0 zj(OEfK)^EnKexmgYH6Zz%IxqcKA~jex?FP176Yb+xNI12c*K~A8aSQv>ny1D7%cr4 zhm#YQiQ54V3+4$$Jj~adjNd+Bp=icKAK41m@gE(P!2;%q0Kh8o9PrEXi_JuYnD`i@WND*A0$rgAFs}ohE`a=T{Q3sz#SEyOy01bZ>x4X z{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ALPsP;j#1}K2KR$` zGwo;DaBI5f)jF{$Mt7f>t}u71$iiUMvpY{xDp@7#{cT%Ni=JY1^v;$E ztJltP(rw;m+9uGJldZFG+P&LS(HyngLz@D;^>e4HwAkI!@?DY2`XE?*Wl$@_1Jwp= z>3NG&6m1@Ve`G&Juf%XEckSkbmR@4F7=Gj&E}o*bh4I6-)A2urTHnq5St>3mq6QRb zn|c5CLDeZrQ?7WOx#6^Ti;(fMfc&*bdK9lzYa8xtWy@4mn|@)z+9OLiY`=3Ae+Wwo zYT0+|z=X9^XNW9p|FF=1;?}7%&TZ%aQO#VKzAjkqm_Vkdkk-U0%Hb-Pg}J&NCOf#~ zNi$5op~NX8rF84|mavYD`vMmOUGm;+FgrBs=Ej4QZ|bed2<`k{=jdYXQ^shp?3?IW Yd;aD}&vzVcJP68@p00i_>zopr0KV{(g#Z8m literal 0 HcmV?d00001 diff --git a/static/images/6331/shuXie.png b/static/images/6331/shuXie.png new file mode 100644 index 0000000000000000000000000000000000000000..2ae3e9c98a806edc116116e953e536f75f5b2a8a GIT binary patch literal 2076 zcmcgteM}Q)7{5~53LO+R(h0K#X=Ti5-9SL;S{+O{bk?|Om+9IjbDaxBSa8zH$6a+O zj7{|LBYun~*u`v11g8O~g&w3E!HA9Z4`Idigh|tEN3Rr1Dc8GQVTsQFwS~oE>T+9q zNZcO;u_4nrU`c2XCY0b)Zh>D3by$@Y_q+MgPcvLigU6?qL?m=i63rf_ z;&sg)p8_=ZK{7j(?PAp~l?|tPGeW)w!`iME_JD~EdO|9F0bDW0*;5+cPw|HpoO1SU z11C zGQ;s_7Sj7QE$L#1R%trFv$RYoPvI&+bT4pgX-Ezx!}vL#0v7&tToTEpmgee6wDM%5 z*^;_+b(#nb7Q(8D1{Yhg$C*yEp4*t@x`=+tF0fW=U-x?VnwU(u*@iDPH{B~FTd)Tvj8hQH zxDz>!85HF<5plv=sX9CTge(|I#4Z~8&LWBnG|;6K8DeFlEv4avwxwgUooldcIMw*L z7j$X^KHWkoYz>!C-*f}t1A+d?Rf`yN4+hW03>c_MWO@Sw zU!RAqXCU@ETaB7VVSjKgro+w;K16z(piGx9-kR)iJ4(YG1`}FDIITKprMJLHCCR?T z#~CU3Z8q)6>FW&6?<_?^{=KS=yjqhbBg#NZ=;hE>?79@6BGV~Omo~wmYI|6R3QIqn z5~IOY#BbXSxD>T>tf>4>5cT0W*740aPxqeU?Ge;#Q-v#5%jA2~e%Ss}T4 zq<4Af1Km;j(LFX3%%Lbnw(ANkU>%r%t^`nZ$wo&r*I%)(hGpdthe_X5D(V0~oMJ>_ zvi}ygV%GiGBaOU5A8uqSOdMy;tNe;S&tR?bf}|^rI?BwI+C_|>*DvvU-*y@)Jc;g` zFK^O8EI|2=hE%$_r*IxGH`M*}ieX^8zhWkU)SsYVZe#{Z1y>Q9|4Z}aqL2uL5_EH? z&;fr(l_+!oRE;SU$Cxq0A(o?AnjGj=Zw=F>;uvd=>_P?>kbdh?CXXr4<1;auGr}PU z7&bD^S;OkM(>wtpy+>$6BfYQ7%{T1QtDn3Rs6y)7c%2aq`r}l)F`9m*=)ZRw?J&ma z=V*rUz8rL_39-O$zPk|IWFG7Wa$z+~(;|G-Dyiep{v>*Eo<8|-zCfQbq*GML^fGdw zkj%V3AA)xL-_lTJFTg|J{9B&c4!;D{_Cazx^ya*N^!gVhvi9#l%D8Uch`DiiPb^S)0Q$!`%7+_|EpCt8eR${0)VnRpbBw literal 0 HcmV?d00001 diff --git a/static/images/6331/shuxieActive.png b/static/images/6331/shuxieActive.png new file mode 100644 index 0000000000000000000000000000000000000000..32d03b062dfaa5a6b40162c02bdcab0f8bfe3979 GIT binary patch literal 2908 zcmY*bc{~&RAD=}zBKNuED3mMaXbcaA5pvU_nr&>k=E{;hxpK@xj-{|#xjp16awKvz zF_bwY$4JD8P^#ZNzh2Mp_x$nseva?w`}w@T@9*c2Z?c2E6+f>uF8~1Gw}!)<*xH6I zw%iBVD=k^xpRG7Tovh3NmHnV4w!`UbYG(=nRHyOnA-UK-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g8 z_S|AUA=+s{16e61KE7dxq%Ui`o zl^bn*glfu{wyYc&FWSr753eN zR;A5l+?GN$-B((ek$^-FmyIKs8R%iX$<@|x1w)Ks>TJbC=jM{sWSmH7^p#>UC~2^E z^iojyvCNXKrn@6|7E&B)dk{sAi)5^hcosK;$I!fwk;)vSzd>Ds1|9z-ULPz$IlH*? za8VolZcxjnmP!K?XXVlg%>qj-+`OoI+aVbZ{yk`1ufAVId8||V>-Gt1Kqby;GqM<1LY-FoO(3+nQOfEm69dNCD$6hidqI+_l$QMoo ze*84&!ngfgfGj7tGuU#VFBXp5g&yAVE!mwC3*E7X`s#GO3)Y}?mYenr$N2nJ&zbA_ z#YouA9(N&);#)kZR%IoO3UD;{Aif>zB`t|ghZy;Y^7YC4f0Vi=$dchxomd35GEbkJ zQ@E1UPi}1c(m?OUKfja|FnaH@r^Krm?}G0Z!QbzUHOtaV6N1IKSRV!YU(Yvm1UI(b z8|rUHIN0M}-``lxM7R@RHfy_Ld@IWH_WaxLLIx|l8i+uT7x_|Sj~Y9+8W@Pl9gSyK zl7MP4TFpEl!5MTR_UyR!bhb{kYgZJnYC%>;v)d6N5 z@<8B2y{Jo4;-4Zs1aGPFoBsq&XM6H@bD7YC#5^Gdcd#zRvd6V)%h{Ov?()VyfqtztCf?Gf4egRgUP+%pqz6K#h|6+LRend4lS<`#xOuMb)R*SPDkl_Hhs?w=> k@X%OI)XRq_DlJ(iVpT?o)EE(o{V%Syg*~j&>~idX0Qt9Avj6}9 literal 0 HcmV?d00001 diff --git a/static/images/6331/upload.png b/static/images/6331/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..f2a73ebaeb6382f4763b29bdab541e6747e3a551 GIT binary patch literal 1290 zcmeAS@N?(olHy`uVBq!ia0vp^CLqkg1|*MGNWTVBjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBufiR<}hF1enLwjaOL`j6Nk5zJhu3lnFep0GlMQ#C5H3Nf< zeMLcHa&~HoLQ-maW}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CV(8alWM zylH2ajk52YB$Zzemb=0?;P?%SIKpg@(RXBhNbb~mW4@hQd12y0fVgj=KWnm1Y&4M7 zNDV}fKt9>RM5^O^w1ef9(<)@WYp-@052bohyATNrvHJO-gSE^vAg&{N4y_F|S$~Yh zCn07HOm)NdnF{IFM=OX%s}ZuA9D(Q$>BXmwY!08SzudLAM}tR$;lsxQG6N zwxtlQ644%U)d4%S2(HBjJ@LW0GqfE5Vu0e;Ax9lb)&a-` zamvX^l)9_Ch|weTC+f6^SW=M^<~2s0!qBab{tDN!cvyS^ln#(#F|%JZdJc`AYm3}2 z)>UhD!Y2f`w6qXpJ)<*FJ;+ZMCTj6lNy+1~nmoguJYO>$Yt}9NnG;k&Xn+Nb(xZvQ7qJmUk&<OB}x@c9?kF7CkNp(Wo~I*}%ymNs6R@8#=WO z1B+aVYmq#bC(qm&%mZCwy3{;*q9No?;dIJFo@(=(^%ZksWg58oe;oyak7WC)Ef$v(a!iHpI#ktRq#Fq6EEb^Tcf2 zQgy_vXkw{ge!^7vvrI*JH?<`vaYGRIaiLdtnJ<9_#w>|q%yO_n95=vFFszsDu`(<~ zRzr5+E`rclJw29_lM|W=*fcAkES995ktdupE9sn|eMx_E0jZUnIg3RO0oUUc4Nx8~g0zX+6%3TPNirblpiw$?+Vk?*76P_M^76+&RmOJCeJ_pFG}$7z z9gU5RmNe;6rr>krAFtQD(hcq`-bkB-Vx_uoK%Cb8Qt7ih$@+a6k_=++@PIk`Zv*|5 c^RjH-UzaDfqWbTA>>bZj6zq^UZGQjIf8G)K!2kdN literal 0 HcmV?d00001 diff --git a/static/images/6331/work.png b/static/images/6331/work.png new file mode 100644 index 0000000000000000000000000000000000000000..64c8e2bfcb6f452e3c296fba0bd9a34631dc5f83 GIT binary patch literal 1528 zcmdT^UrbwN6u&KFg*I?26T9pWrL2t11-dwwA(U1|JGcWuo!EyhZCy+?vDuce(OXBk zWjI<=MSB@86Ql{LF`0?gJ%DkQUbGHeWDUH4X~?tdb`i093G&R#%8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(v(&=dgyJ-|`G&;Y31Gk&+2AP;{)V98CUio{qQrEU%b>WA(FFc;+M_zYaOIg|RB2 zqID3NS|h%@z1NL=m}fZaZxC5cS=DV* zo{LPxMJRneH+X(1(2{JfhgebLo=Ar^dB)3Nx$UD!v?vQ9z&`)VnKaslg5r(CkA#(( KJ*vtS7xN#UstKb2 literal 0 HcmV?d00001 diff --git a/utils/BleHelper.js b/utils/BleHelper.js index bf80ac8..2bfc057 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -135,7 +135,7 @@ class BleHelper { let item = this.data.LinkedList[i]; if (deviceId && item.device) { if (item.device.id == deviceId) { - console.log("找到要删除的设备", item); + console.log("找到要删除的设备", item); this.data.LinkedList.splice(i, 1); this.disconnectDevice(item.deviceId); flag = true; @@ -144,7 +144,7 @@ class BleHelper { } else { if (bleId && item.deviceId == bleId) { - console.log("找到要删除的设备1,", item) + console.log("找到要删除的设备1,", item) this.data.LinkedList.splice(i, 1); this.disconnectDevice(item.deviceId); flag = true; @@ -249,7 +249,7 @@ class BleHelper { } - + //设置蓝牙恢复连接的回调 @@ -313,7 +313,7 @@ class BleHelper { removeStateRecoveryCallback(currKey) { this.removeCallback(currKey, 'stateRecoveryCallback'); } - + //清除所有事件回调 removeAllCallback(currKey) { this.removeDeviceFound(currKey) @@ -1570,7 +1570,46 @@ class BleHelper { ////console.log("无已连接设备"); } } + //向蓝牙设备发送一个字符串的ASCII码 + sendString(deviceid, str, writeServiceId, wirteCharactId, ms) { + if (str && str.length) { + let buffer = new ArrayBuffer(str.length); + let dataView = new DataView(buffer); + // 2. 将字符串转换为 ASCII 码并写入 DataView + for (let i = 0; i < str.length; i++) { + dataView.setUint8(i, str.charCodeAt(i)); + } + + return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms); + } else { + return Promise.resolve({ + code: 200, + msg: "没有数据要发送" + }) + } + } + + //向蓝牙设备发送一个16进制的数组数据 + sendHexs(deviceid, array, writeServiceId, wirteCharactId, ms) { + if (array && array.length) { + let bufferSize = array.length; + let buffer = new ArrayBuffer(bufferSize); + let dataView = new DataView(buffer); + for (let i = 0; i < array.length; i++) { + dataView.setUint8(i, array); + } + + return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms); + + } else { + return Promise.resolve({ + code: 200, + msg: "没有数据要发送" + }) + } + + } //向蓝牙设备发送数据,如果没连接将自动连接后再发 sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms) {