From 986715fc217c2d77bc42348088041660cbf1e7b0 Mon Sep 17 00:00:00 2001 From: xiaohei <11674173+xiaohei102908@user.noreply.gitee.com> Date: Fri, 10 Nov 2023 19:20:08 +0800 Subject: [PATCH] 1110 --- pages/Bluetooth/Bluetooth.js | 56 +++++++++++++++++++++++++++++++----------- pages/Bluetooth/Bluetooth.wxml | 4 +-- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/pages/Bluetooth/Bluetooth.js b/pages/Bluetooth/Bluetooth.js index 3750f57..6855544 100644 --- a/pages/Bluetooth/Bluetooth.js +++ b/pages/Bluetooth/Bluetooth.js @@ -61,11 +61,10 @@ Page({ * 页面的初始数据 */ data: { - platformId: 0, // 运营商 + platformId: 0, // 运营商 platformname: "", sheetshow: false, - actions1: [ - { + actions1: [{ name: '电信', id: 1 }, @@ -234,7 +233,7 @@ Page({ } let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) basecode = superAdminId - console.log(superAdminId, basecode); + console.log("超管", basecode, superAdminId, this.data.lock); this.setData({ deviceInfo: res.data.list[0], lock: lock, @@ -1727,7 +1726,7 @@ Page({ // 注册到平台 resgiterDeviceMethods1() { - if(this.data.platformId == 0){ + if (this.data.platformId == 0) { return wx.showToast({ title: '请先选择运营商', icon: "none", @@ -1756,15 +1755,28 @@ Page({ var superAdmin = [] var superAdminId var deviceimei - if(this.data.selectRadio1 == 1201){ - deviceimei = this.data.lock.imei - }else if(this.data.selectRadio1 == 1241) { - if (this.data.deviceNum.length <= 15) { - deviceimei = this.data.deviceNum + console.log(that.data.lock); + if (that.data.selectRadio1 == 1201) { + deviceimei = that.data.lock.imei + } else if (that.data.selectRadio1 == 1241) { + if (that.data.deviceNum.length <= 15) { + deviceimei = that.data.deviceNum + } else { + deviceimei = that.data.deviceNum.slice(that.data.deviceNum.length - 15, that.data.deviceNum.length) + } + } + for (let i = 0; i < superAdminIdlist.length; i++) { + if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) { + superAdmin.push(superAdminIdlist[i]) } else { - deviceimei = this.data.deviceNum.slice(this.data.deviceNum.length - 15, this.data.deviceNum.length) + let adminid = superAdminIdlist.charCodeAt(i) + superAdmin.push(adminid) } } + superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) + console.log(lockMac, superAdminIdlist, superAdminId); + // let superAdmin = [] + // var superAdminIdlist = lock.mac.slice(lock.mac.length - 11, lock.mac.length).split(":").join("") // for (let i = 0; i < superAdminIdlist.length; i++) { // if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) { // superAdmin.push(superAdminIdlist[i]) @@ -1773,9 +1785,9 @@ Page({ // superAdmin.push(adminid) // } // } - // superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) - // console.log(lockMac, superAdminIdlist, superAdminId); - console.log("123123123123", basecode); + // let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) + basecode = superAdminId + console.log("123123123123", basecode, superAdminId, deviceimei); let data = { code: 'lwj/registerDevice', data: { @@ -1788,7 +1800,7 @@ Page({ } console.log(data); WXAPI.sendCommand(data).then(res => { - console.log(res, data); + console.log(res, data, basecode); if (res.success) { let data1 = { code: 'lwj/registerSupperAdmin', @@ -2761,6 +2773,20 @@ Page({ console.log(isInitReady, 'isConnected', isConnected) if (isConnected) { if (isInitReady) { + let lock = that.data.lock + let superAdmin = [] + var superAdminIdlist = lock.mac.slice(lock.mac.length - 11, lock.mac.length).split(":").join("") + for (let i = 0; i < superAdminIdlist.length; i++) { + if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) { + superAdmin.push(superAdminIdlist[i]) + } else { + let adminid = superAdminIdlist.charCodeAt(i) + superAdmin.push(adminid) + } + } + let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) + basecode = superAdminId + console.log(basecode,"basecode") setTimeout(() => { that.doWork() }, 500) diff --git a/pages/Bluetooth/Bluetooth.wxml b/pages/Bluetooth/Bluetooth.wxml index ac2aff7..f780c1b 100644 --- a/pages/Bluetooth/Bluetooth.wxml +++ b/pages/Bluetooth/Bluetooth.wxml @@ -131,8 +131,8 @@ - - + +