|
@ -43,6 +43,7 @@ Page({ |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
|
*/ |
|
|
*/ |
|
|
data: { |
|
|
data: { |
|
|
|
|
|
isUnloked: false, |
|
|
toSearch: true, |
|
|
toSearch: true, |
|
|
isSearch: false, |
|
|
isSearch: false, |
|
|
event: '', |
|
|
event: '', |
|
@ -132,7 +133,7 @@ Page({ |
|
|
basecode = superAdminId |
|
|
basecode = superAdminId |
|
|
console.log(basecode, "basecode"); |
|
|
console.log(basecode, "basecode"); |
|
|
} |
|
|
} |
|
|
if(deviceinfo.manufactureId==201||deviceinfo.manufactureId == 221){ |
|
|
|
|
|
|
|
|
if(deviceinfo.manufactureId == 201||deviceinfo.manufactureId == 221){ |
|
|
var data3 = { |
|
|
var data3 = { |
|
|
code: "zg/bleRegisterInfo", |
|
|
code: "zg/bleRegisterInfo", |
|
|
signature:wx.getStorageSync('signature'), |
|
|
signature:wx.getStorageSync('signature'), |
|
@ -142,11 +143,13 @@ Page({ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
WXAPI.sendCommandOne(data3).then(res1 => { |
|
|
WXAPI.sendCommandOne(data3).then(res1 => { |
|
|
|
|
|
console.log(res1); |
|
|
if (res1.success) { |
|
|
if (res1.success) { |
|
|
wx.setStorageSync('cgInfo', res1.data) |
|
|
wx.setStorageSync('cgInfo', res1.data) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
cgInfo: res1.data |
|
|
cgInfo: res1.data |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log(this.data.cgInfo); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -1032,6 +1035,11 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
changeLockUnlockState: function () { |
|
|
|
|
|
var that = this |
|
|
|
|
|
taskId = 101 |
|
|
|
|
|
that.initBluetooth() |
|
|
|
|
|
}, |
|
|
// 蓝牙初始化
|
|
|
// 蓝牙初始化
|
|
|
btntest1(e) { |
|
|
btntest1(e) { |
|
|
var event = e.currentTarget.dataset.i |
|
|
var event = e.currentTarget.dataset.i |
|
@ -1042,7 +1050,7 @@ Page({ |
|
|
remotePasswordStatus:false |
|
|
remotePasswordStatus:false |
|
|
}) |
|
|
}) |
|
|
if (deviceinfo.manufactureId == 201||deviceinfo.manufactureId == 221) { |
|
|
if (deviceinfo.manufactureId == 201||deviceinfo.manufactureId == 221) { |
|
|
if (this.data.isSearch) { |
|
|
|
|
|
|
|
|
if (app.globalData.zgBlueStatus) { |
|
|
if (event == 0) { |
|
|
if (event == 0) { |
|
|
this.openTheDoor() |
|
|
this.openTheDoor() |
|
|
} else if (event == 1) { |
|
|
} else if (event == 1) { |
|
@ -1059,7 +1067,10 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}else if (event == 12) { |
|
|
}else if (event == 12) { |
|
|
this.goPasswordList() |
|
|
this.goPasswordList() |
|
|
|
|
|
}else if(event == 17){ |
|
|
|
|
|
this.synchronizationTime() |
|
|
} |
|
|
} |
|
|
|
|
|
wx.hideLoading() |
|
|
} else { |
|
|
} else { |
|
|
that.goBlue() |
|
|
that.goBlue() |
|
|
} |
|
|
} |
|
@ -1104,6 +1115,10 @@ Page({ |
|
|
this.goPasswordList() |
|
|
this.goPasswordList() |
|
|
}else if(event == '1'){ |
|
|
}else if(event == '1'){ |
|
|
this.addPincode() |
|
|
this.addPincode() |
|
|
|
|
|
}else if(event == 71){ |
|
|
|
|
|
this.changeLockUnlockState() |
|
|
|
|
|
}else if(event == 117){ |
|
|
|
|
|
this.syncClock() |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.searchDevicesMethods() |
|
|
this.searchDevicesMethods() |
|
@ -1185,6 +1200,10 @@ Page({ |
|
|
that.configurewifj() |
|
|
that.configurewifj() |
|
|
}else if(that.data.event == '12'){ |
|
|
}else if(that.data.event == '12'){ |
|
|
that.goPasswordList() |
|
|
that.goPasswordList() |
|
|
|
|
|
}else if(that.data.event == '71'){ |
|
|
|
|
|
that.changeLockUnlockState() |
|
|
|
|
|
}else if(that.data.event == '117'){ |
|
|
|
|
|
that.syncClock() |
|
|
} |
|
|
} |
|
|
wx.hideLoading({ |
|
|
wx.hideLoading({ |
|
|
success: (res) => {}, |
|
|
success: (res) => {}, |
|
@ -1371,6 +1390,15 @@ Page({ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
onChangeLockUnlockState: function () { |
|
|
|
|
|
var that = this |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: that.data.isUnloked ? '退出常开模式' : '进入常开模式', |
|
|
|
|
|
}) |
|
|
|
|
|
var bytes = plugin.setLockUnlockState(lockDevice.name, !that.data.isUnloked) |
|
|
|
|
|
console.debug('bytes', bytes) |
|
|
|
|
|
that.sendBytes(bytes) |
|
|
|
|
|
}, |
|
|
onConfigurewifi() { |
|
|
onConfigurewifi() { |
|
|
var that = this |
|
|
var that = this |
|
|
var bytes = plugin.configureWifi(lockDevice.name, lockMac, that.data.wifiName, that.data.wifiPwd) |
|
|
var bytes = plugin.configureWifi(lockDevice.name, lockMac, that.data.wifiName, that.data.wifiPwd) |
|
@ -2126,6 +2154,50 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
synchronizationTime() { |
|
|
|
|
|
var time = parseInt(new Date().getTime() / 1000) |
|
|
|
|
|
ICINLocker.getSignKey(this.data.cgInfo.lockerId, this.data.cgInfo.superId, this.data.cgInfo.superId, |
|
|
|
|
|
(callback) => { |
|
|
|
|
|
var signKey = callback.signKey |
|
|
|
|
|
ICINLocker.getCommonKey(this.data.cgInfo.lockerId, this.data.cgInfo.superId, this.data.cgInfo.superId, signKey, (callback1) => { |
|
|
|
|
|
var _commonKey = callback1.commonKey |
|
|
|
|
|
ICINLocker.updateTime(this.data.cgInfo.lockerId, this.data.cgInfo.superId, time, '', _commonKey, callback2 => { |
|
|
|
|
|
if (callback2.status == '00') { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '同步时间成功', |
|
|
|
|
|
duration: 2000, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showIP: false |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '同步时间失败,错误码:' + callback2.status, |
|
|
|
|
|
duration: 2000, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
syncClock: function() { |
|
|
|
|
|
var that = this |
|
|
|
|
|
taskId = 42 |
|
|
|
|
|
that.initBluetooth() |
|
|
|
|
|
}, |
|
|
|
|
|
onSyncClock: function() { |
|
|
|
|
|
var that = this |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '同步时钟中', |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(lockDevice.name, basecode, util1.getLocalTime(8), '0000') |
|
|
|
|
|
var bytes = plugin.syncClock(lockDevice.name, basecode, util1.getLocalTime(8)) |
|
|
|
|
|
console.debug('bytes', bytes) |
|
|
|
|
|
that.sendBytes(bytes) |
|
|
|
|
|
}, |
|
|
LwjonOpenLock: function () { |
|
|
LwjonOpenLock: function () { |
|
|
var that = this |
|
|
var that = this |
|
|
wx.showLoading({ |
|
|
wx.showLoading({ |
|
@ -2179,23 +2251,27 @@ Page({ |
|
|
icon: "none", |
|
|
icon: "none", |
|
|
duration: 2000 |
|
|
duration: 2000 |
|
|
}) |
|
|
}) |
|
|
if (this.data.event == 0) { |
|
|
|
|
|
this.openTheDoor() |
|
|
|
|
|
}else if(this.data.event == 1){ |
|
|
|
|
|
this.addPassword() |
|
|
|
|
|
} else if (this.data.event == 3) { |
|
|
|
|
|
this.addFingerPrints() |
|
|
|
|
|
} else if (this.data.event == 6) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
show: true |
|
|
|
|
|
}) |
|
|
|
|
|
}else if(this.data.event == 11){ |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showOne: true |
|
|
|
|
|
}) |
|
|
|
|
|
}else if (event == 12) { |
|
|
|
|
|
this.goPasswordList() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
if (this.data.event == 0) { |
|
|
|
|
|
this.openTheDoor() |
|
|
|
|
|
}else if(this.data.event == 1){ |
|
|
|
|
|
this.addPassword() |
|
|
|
|
|
} else if (this.data.event == 3) { |
|
|
|
|
|
this.addFingerPrints() |
|
|
|
|
|
} else if (this.data.event == 6) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
show: true |
|
|
|
|
|
}) |
|
|
|
|
|
}else if(this.data.event == 11){ |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
showOne: true |
|
|
|
|
|
}) |
|
|
|
|
|
}else if (this.data.event == 12) { |
|
|
|
|
|
this.goPasswordList() |
|
|
|
|
|
}else if(this.data.event == 17){ |
|
|
|
|
|
this.synchronizationTime() |
|
|
|
|
|
} |
|
|
|
|
|
},500) |
|
|
} else { |
|
|
} else { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
var msg = '' |
|
|
var msg = '' |
|
@ -2235,6 +2311,8 @@ Page({ |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
wx.hideLoading() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|