diff --git a/pages/Bluetooth/Bluetooth.js b/pages/Bluetooth/Bluetooth.js index fcd4c49..19bb58d 100644 --- a/pages/Bluetooth/Bluetooth.js +++ b/pages/Bluetooth/Bluetooth.js @@ -61,6 +61,39 @@ Page({ * 页面的初始数据 */ data: { + platformId: 0, // 运营商 + platformname: "", + sheetshow: false, + actions1: [ + { + name: '电信', + id: 1 + }, + { + name: '移动', + id: 2 + }, + { + name: '联通', + id: 3 + }, + { + name: "直连UDP平台", + id: 8 + }, + { + name: "直连TCP平台", + id: 9 + }, + { + name: "消息服务器", + id: 98 + }, + { + name: "本地缓存", + id: 99 + } + ], selectRadio1: '1201', showreg: false, // 注册到平台的弹出层 show2: false, @@ -189,6 +222,18 @@ Page({ // } // }) + 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 this.setData({ deviceInfo: res.data.list[0], lock: lock, @@ -306,6 +351,18 @@ Page({ } this.getRoom() }, + onSelect(event) { + console.log(event.detail); + this.setData({ + platformId: event.detail.id, + platformname: event.detail.name + }) + }, + changesheetshow() { + this.setData({ + sheetshow: true + }) + }, // onChangeSelectRaio(event) { this.setData({ @@ -1669,8 +1726,15 @@ Page({ // 注册到平台 resgiterDeviceMethods1() { + if(this.data.platformId == 0){ + return wx.showToast({ + title: '请先选择运营商', + icon: "none", + duration: 2000 + }) + } if (this.data.selectRadio1 == '1201') { - this.addAdmin() + this.resgWfiDevice() } else if (this.data.selectRadio1 == '1221') { } else if (this.data.selectRadio1 == '1231') { @@ -1711,11 +1775,12 @@ Page({ data: { deviceNum: this.data.deviceNum, imei: deviceimei, - imsi: "", - platformId: 9, + imsi: deviceimei, + platformId: this.data.platformId, manufactureId: this.data.selectRadio1 } } + console.log(data); WXAPI.sendCommand(data).then(res => { console.log(res, data); if (res.success) { @@ -1782,9 +1847,9 @@ Page({ // duration: 2000 // }) // } else { - this.setData({ - showreg: true - }) + this.setData({ + showreg: true + }) // } // }) }, @@ -2095,12 +2160,13 @@ Page({ }, onClose() { this.setData({ - show: false + show: false, + show2: false }); }, - onClose() { + onClose1() { this.setData({ - show2: false + sheetshow: false }) }, // 获取房间 @@ -3506,7 +3572,7 @@ Page({ characteristicId: config.uuid.writeUuid.toUpperCase(), value: bytes, success: function (res) { - + }, }) }, 50) diff --git a/pages/Bluetooth/Bluetooth.wxml b/pages/Bluetooth/Bluetooth.wxml index f2e3a96..f780c1b 100644 --- a/pages/Bluetooth/Bluetooth.wxml +++ b/pages/Bluetooth/Bluetooth.wxml @@ -132,6 +132,7 @@ + @@ -208,7 +209,12 @@ Wifi人脸智能锁 + + 选择运营商: + {{platformname}} + 确定 - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/Bluetooth/Bluetooth.wxss b/pages/Bluetooth/Bluetooth.wxss index 2564993..70b0261 100644 --- a/pages/Bluetooth/Bluetooth.wxss +++ b/pages/Bluetooth/Bluetooth.wxss @@ -85,3 +85,13 @@ .radiolists{ padding: 0 10px; } +.sheetlist{ + width: 100%; + padding: 0 10px; + display: flex; + align-items: center; + margin-bottom: 10px; +} +.platformIdlist{ + margin-right: 10px; +}