Browse Source

1110

master
xiaohei 1 year ago
parent
commit
986715fc21
2 changed files with 43 additions and 17 deletions
  1. +41
    -15
      pages/Bluetooth/Bluetooth.js
  2. +2
    -2
      pages/Bluetooth/Bluetooth.wxml

+ 41
- 15
pages/Bluetooth/Bluetooth.js View File

@ -61,11 +61,10 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
platformId: 0, // 运营商
platformId: 0, // 运营商
platformname: "", platformname: "",
sheetshow: false, sheetshow: false,
actions1: [
{
actions1: [{
name: '电信', name: '电信',
id: 1 id: 1
}, },
@ -234,7 +233,7 @@ Page({
} }
let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length)
basecode = superAdminId basecode = superAdminId
console.log(superAdminId, basecode);
console.log("超管", basecode, superAdminId, this.data.lock);
this.setData({ this.setData({
deviceInfo: res.data.list[0], deviceInfo: res.data.list[0],
lock: lock, lock: lock,
@ -1727,7 +1726,7 @@ Page({
// 注册到平台 // 注册到平台
resgiterDeviceMethods1() { resgiterDeviceMethods1() {
if(this.data.platformId == 0){
if (this.data.platformId == 0) {
return wx.showToast({ return wx.showToast({
title: '请先选择运营商', title: '请先选择运营商',
icon: "none", icon: "none",
@ -1756,15 +1755,28 @@ Page({
var superAdmin = [] var superAdmin = []
var superAdminId var superAdminId
var deviceimei 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 { } 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++) { // for (let i = 0; i < superAdminIdlist.length; i++) {
// if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) { // if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) {
// superAdmin.push(superAdminIdlist[i]) // superAdmin.push(superAdminIdlist[i])
@ -1773,9 +1785,9 @@ Page({
// superAdmin.push(adminid) // 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 = { let data = {
code: 'lwj/registerDevice', code: 'lwj/registerDevice',
data: { data: {
@ -1788,7 +1800,7 @@ Page({
} }
console.log(data); console.log(data);
WXAPI.sendCommand(data).then(res => { WXAPI.sendCommand(data).then(res => {
console.log(res, data);
console.log(res, data, basecode);
if (res.success) { if (res.success) {
let data1 = { let data1 = {
code: 'lwj/registerSupperAdmin', code: 'lwj/registerSupperAdmin',
@ -2761,6 +2773,20 @@ Page({
console.log(isInitReady, 'isConnected', isConnected) console.log(isInitReady, 'isConnected', isConnected)
if (isConnected) { if (isConnected) {
if (isInitReady) { 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(() => { setTimeout(() => {
that.doWork() that.doWork()
}, 500) }, 500)


+ 2
- 2
pages/Bluetooth/Bluetooth.wxml View File

@ -131,8 +131,8 @@
</view> </view>
<view class='row'> <view class='row'>
<!-- <button class="button-action" type='primary' bindtap="changemanId" disabled="{{!resgiterdevice}}">注册到平台</button> -->
<button class="button-action" type='primary' bindtap="changemanId">注册到平台</button>
<button class="button-action" type='primary' bindtap="changemanId" disabled="{{!resgiterdevice}}">注册到平台</button>
<!-- <button class="button-action" type='primary' bindtap="changemanId">注册到平台</button> -->
<button class="button-action" type='primary' bindtap="bindRoomMethods" disabled="{{resgiterdevice}}">绑定房间</button> <button class="button-action" type='primary' bindtap="bindRoomMethods" disabled="{{resgiterdevice}}">绑定房间</button>
</view> </view>


Loading…
Cancel
Save