Browse Source

版本1.0.6 2023-11-29 ljd

1、租客端增加同步时间,q系列锁页面增加常开常闭功能,z系列页面隐藏多余的模块
master
xiaohei 1 year ago
parent
commit
5d449a6a4c
3 changed files with 116 additions and 25 deletions
  1. +97
    -19
      pages/userbluetoothUnlock/userbluetoothUnlock.js
  2. +18
    -6
      pages/userbluetoothUnlock/userbluetoothUnlock.wxml
  3. +1
    -0
      utils/ICINPakage/ICINLocker.js

+ 97
- 19
pages/userbluetoothUnlock/userbluetoothUnlock.js View File

@ -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()
} }
}) })
}, },


+ 18
- 6
pages/userbluetoothUnlock/userbluetoothUnlock.wxml View File

@ -47,18 +47,18 @@
<view class="iconfont icon-suoding text-green"></view> <view class="iconfont icon-suoding text-green"></view>
<view class="text-grey text-sm">蓝牙开锁</view> <view class="text-grey text-sm">蓝牙开锁</view>
</view> </view>
<view class="actionli" bindtap="btntest1" data-i="1" wx:if="userRole == 1" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}">
<!-- <view class="actionli" bindtap="btntest1" data-i="1" wx:if="userRole == 1" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}">
<view class="iconfont icon-xiaoxi text-green"></view> <view class="iconfont icon-xiaoxi text-green"></view>
<view class="text-grey text-sm">添加蓝牙密码</view> <view class="text-grey text-sm">添加蓝牙密码</view>
</view>
<view class="actionli" bindtap="addRemotePassword" wx:if="userRole == 1" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}">
</view> -->
<!-- <view class="actionli" bindtap="addRemotePassword" wx:if="userRole == 1" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}">
<view class="iconfont icon-xiaoxi text-green"></view> <view class="iconfont icon-xiaoxi text-green"></view>
<view class="text-grey text-sm">添加远程密码</view> <view class="text-grey text-sm">添加远程密码</view>
</view>
<view class="actionli" bindtap="btntest1" data-i="12" wx:if="userRole == 1">
</view> -->
<!-- <view class="actionli" bindtap="btntest1" data-i="12" wx:if="userRole == 1">
<view class="iconfont icon-liebiao text-green"></view> <view class="iconfont icon-liebiao text-green"></view>
<view class="text-grey text-sm">密码列表</view> <view class="text-grey text-sm">密码列表</view>
</view>
</view> -->
<!-- <view class="actionli" bindtap="btntest1" data-i="11" wx:if="{{deviceinfo.manufactureId == 201 || deviceinfo.manufactureId == 221 }}"> <!-- <view class="actionli" bindtap="btntest1" data-i="11" wx:if="{{deviceinfo.manufactureId == 201 || deviceinfo.manufactureId == 221 }}">
<view class="iconfont icon-xiaoxi text-green"></view> <view class="iconfont icon-xiaoxi text-green"></view>
<view class="text-grey text-sm">添加卡</view> <view class="text-grey text-sm">添加卡</view>
@ -75,6 +75,10 @@
<view class="iconfont icon-jiludanzilishijilu text-green"></view> <view class="iconfont icon-jiludanzilishijilu text-green"></view>
<view class="text-grey text-sm">开锁记录</view> <view class="text-grey text-sm">开锁记录</view>
</view> </view>
<view class="actionli" bindtap="btntest1" data-i="71" wx:if="{{deviceinfo.manufactureId ==1241 || deviceinfo.manufactureId == 1201}}">
<view class="iconfont icon-shezhi text-green"></view>
<view class="text-grey text-sm">{{isUnloked ? '退出常开模式' : '进入常开模式'}}</view>
</view>
<view class="actionli" bindtap="personManger" data-i="8" wx:if="{{authority}}"> <view class="actionli" bindtap="personManger" data-i="8" wx:if="{{authority}}">
<view class="iconfont icon-renyuanguanli text-green"></view> <view class="iconfont icon-renyuanguanli text-green"></view>
<view class="text-grey text-sm">人员管理</view> <view class="text-grey text-sm">人员管理</view>
@ -83,6 +87,14 @@
<view class="iconfont icon-shanchu text-red"></view> <view class="iconfont icon-shanchu text-red"></view>
<view class="text-grey text-sm">常开设置</view> <view class="text-grey text-sm">常开设置</view>
</view> </view>
<view class="actionli" bindtap="btntest1" data-i="17" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId == 221}}">
<view class="iconfont icon-shezhi text-green"></view>
<view class="text-grey text-sm">同步时间</view>
</view>
<view class="actionli" bindtap="btntest1" data-i="117" wx:if="{{deviceinfo.manufactureId ==1201 || deviceinfo.manufactureId == 1241}}">
<view class="iconfont icon-shezhi text-green"></view>
<view class="text-grey text-sm">同步时间</view>
</view>
<view class="actionli" bindtap="getTemporaryPassword" data-i="9" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}"> <view class="actionli" bindtap="getTemporaryPassword" data-i="9" wx:if="{{deviceinfo.manufactureId ==201 || deviceinfo.manufactureId ==221}}">
<view class="iconfont icon-xiaoxi text-green"></view> <view class="iconfont icon-xiaoxi text-green"></view>
<view class="text-grey text-sm">临时密码</view> <view class="text-grey text-sm">临时密码</view>


+ 1
- 0
utils/ICINPakage/ICINLocker.js View File

@ -207,6 +207,7 @@ export default class ICINLocker {
/***** 在搜索到的设备列表中查询需要连接的设备 */ /***** 在搜索到的设备列表中查询需要连接的设备 */
for (; devicesScanedPos <= res.devices.length; devicesScanedPos++) { for (; devicesScanedPos <= res.devices.length; devicesScanedPos++) {
console.log(res.devices, "210210");
if (res.devices[devicesScanedPos].name == null) { if (res.devices[devicesScanedPos].name == null) {
return; return;
} }


Loading…
Cancel
Save