Browse Source

1028,完成指纹,密码,NFC集成

master
xiaoheiiskinder 1 year ago
parent
commit
b7432e2895
8 changed files with 108 additions and 52 deletions
  1. +3
    -0
      pages/Bluetooth/Bluetooth.js
  2. +20
    -13
      pages/addperson/addperson.js
  3. +2
    -2
      pages/addperson/addperson.wxml
  4. +70
    -24
      pages/roomDetail/roomDetail.js
  5. +2
    -2
      pages/roomDetail/roomDetail.wxml
  6. +4
    -4
      pagesA/facepeople/facepeople.wxss
  7. +6
    -6
      pagesA/selectFace/selectFace.js
  8. +1
    -1
      project.config.json

+ 3
- 0
pages/Bluetooth/Bluetooth.js View File

@ -1963,6 +1963,9 @@ Page({
// }) // })
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)
that.sendBytes(bytes) that.sendBytes(bytes)
this.setData({
show2: false
})
// }else{ // }else{
// this.initBluetooth() // this.initBluetooth()
// } // }


+ 20
- 13
pages/addperson/addperson.js View File

@ -228,7 +228,8 @@ Page({
starttime:minDate, starttime:minDate,
endtime:minDate1, endtime:minDate1,
deviceinfo: deviceinfo, deviceinfo: deviceinfo,
personLi: personLi
personLi: personLi,
isSearch: false
}) })
this.getPassword() this.getPassword()
this.getNfc() this.getNfc()
@ -2056,7 +2057,8 @@ Page({
}) })
} }
}) })
}else if (deviceinfo.manufactureId == 1201){
}else if (deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241){
console.log(this.data.isSearch);
if(this.data.isSearch){ if(this.data.isSearch){
wx.hideLoading() wx.hideLoading()
this.addPincode() this.addPincode()
@ -2066,7 +2068,7 @@ Page({
} }
}, },
onAddPincode: function () { onAddPincode: function () {
console.log("2073123");
var that = this var that = this
wx.showLoading({ wx.showLoading({
title: '添加密码中', title: '添加密码中',
@ -2119,6 +2121,7 @@ Page({
that.sendBytes(bytes) that.sendBytes(bytes)
}, },
addPincode: function () { addPincode: function () {
console.log("2124");
var that = this var that = this
taskId = 51 taskId = 51
that.initBluetooth() that.initBluetooth()
@ -2138,7 +2141,9 @@ Page({
}) })
console.log(isInitReady,'isConnected', isConnected) console.log(isInitReady,'isConnected', isConnected)
if (isConnected) { if (isConnected) {
console.log("2144");
if (isInitReady) { if (isInitReady) {
console.log("2146");
that.doWork() that.doWork()
} else { } else {
that.setupConnection() that.setupConnection()
@ -3192,6 +3197,7 @@ Page({
}, },
doWork: function () { doWork: function () {
var that = this var that = this
console.log(taskId);
switch (taskId) { switch (taskId) {
case 11: { case 11: {
that.onBindLock() that.onBindLock()
@ -3236,15 +3242,15 @@ Page({
} }
case 61: { case 61: {
// that.onAddRfCard() // that.onAddRfCard()
if (lockModel > 70) {
// if (lockModel > 70) {
that.sendAddRfcard() that.sendAddRfcard()
} else {
wx.showModal({
title: '提示',
content: '请刷卡!',
showCancel: false
})
}
// } else {
// wx.showModal({
// title: '提示',
// content: '请刷卡!',
// showCancel: false
// })
// }
break break
} }
case 62: { case 62: {
@ -3675,7 +3681,7 @@ Page({
}) })
} }
}) })
}else if (deviceinfo.manufactureId == 1201){
}else if (deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241){
if(this.data.isSearch){ if(this.data.isSearch){
wx.hideLoading() wx.hideLoading()
this.addRfCard() this.addRfCard()
@ -3685,6 +3691,7 @@ Page({
} }
}, },
addRfCard: function () { addRfCard: function () {
console.log("3691NFC");
var that = this var that = this
taskId = 61 taskId = 61
that.initBluetooth() that.initBluetooth()
@ -4082,7 +4089,7 @@ Page({
}) })
} }
}) })
}else if(deviceinfo.manufactureId == 1201){
}else if(deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241){
if(this.data.isSearch){ if(this.data.isSearch){
// fingerprintIndex = 1 // fingerprintIndex = 1
// serialNumber = 1686309639840 // serialNumber = 1686309639840


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

@ -2,8 +2,8 @@
<view class="page"> <view class="page">
<van-sidebar active-key="{{ activeKey }}" class="left" bind:change="onChange"> <van-sidebar active-key="{{ activeKey }}" class="left" bind:change="onChange">
<van-sidebar-item title="密码" /> <van-sidebar-item title="密码" />
<van-sidebar-item title="NFC" wx:if="{{deviceinfo.manufactureId==201||deviceinfo.manufactureId == 221||deviceinfo.manufactureId == 1201}}" />
<van-sidebar-item title="指纹" wx:if="{{deviceinfo.manufactureId==201 || deviceinfo.manufactureId == 1201}}" />
<van-sidebar-item title="NFC" wx:if="{{deviceinfo.manufactureId==201||deviceinfo.manufactureId == 221||deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241}}" />
<van-sidebar-item title="指纹" wx:if="{{deviceinfo.manufactureId==201 || deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241}}" />
<!-- <van-sidebar-item title="身份证" /> --> <!-- <van-sidebar-item title="身份证" /> -->
</van-sidebar> </van-sidebar>
<view class="" class="right"> <view class="" class="right">


+ 70
- 24
pages/roomDetail/roomDetail.js View File

@ -290,33 +290,48 @@ Page({
} }
}, },
// 配网 // 配网
changeshow2() {
changeshow2(e) {
var event = e.currentTarget.dataset.i
var that = this;
this.setData({ this.setData({
show2: true
event
}) })
var deviceinfo = this.data.deviceinfo
if (deviceinfo.manufactureId == '1241') {
if (event == '3') {
this.setData({
show2: true
})
}
}else{
wx.showToast({
title: '该类型锁不支持配网功能',
duration: 2000,
icon: 'none'
})
}
},
configurationWifi() {
let event = {
currentTarget: {
dataset: {
i: '3'
}
}
}
if(!this.data.isSearch){
this.btntest1(event)
}else{
this.configurewifj()
}
}, },
onConfigurewifi() { onConfigurewifi() {
var that = this var that = this
that.wifitimer = setTimeout(() => {
wx.closeBLEConnection({
deviceId: lockDevice.deviceId,
success(res) {
},
fail: res => {
console.log("1", res);
}
})
wx.showToast({
title: '配网失败,请重试',
duration: 2000
})
}, 6000)
wx.showLoading({
title: '配置网络中...',
})
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)
that.sendBytes(bytes) that.sendBytes(bytes)
this.setData({
show2: false
})
}, },
// 前往图像管理 // 前往图像管理
goImageManagement() { goImageManagement() {
@ -782,7 +797,7 @@ Page({
mask: true mask: true
}); });
this.setVolume1(volume) this.setVolume1(volume)
} else if (this.data.deviceinfo.manufactureId == 1201) {
} else if (this.data.deviceinfo.manufactureId == 1201 || this.data.deviceinfo.manufactureId == 1241) {
this.setData({ this.setData({
isMuted: isMuted isMuted: isMuted
}) })
@ -808,7 +823,16 @@ Page({
this.data.fingerprintId = app.globalData.fingerprintId this.data.fingerprintId = app.globalData.fingerprintId
}, },
// 人员管理 // 人员管理
personManger() {
personManger(e) {
if(this.data.isSearch){
wx.navigateTo({
url: '/pages/personManger/personManger',
})
}else{
this.btntest1(e)
}
},
gotoperson() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/personManger/personManger', url: '/pages/personManger/personManger',
}) })
@ -1181,7 +1205,7 @@ Page({
} else { } else {
this.startconnect() this.startconnect()
} }
} else if (deviceinfo.manufactureId == 1201) {
} else if (deviceinfo.manufactureId == 1201 || deviceinfo.manufactureId == 1241) {
if (this.data.isSearch) { if (this.data.isSearch) {
if (event == '0') { if (event == '0') {
// let iotLwj = new LwJ(this.data.lockDevice,isConnected,connectedDeviceId,isInitReady,this.data.lockDevice.lockModel) // let iotLwj = new LwJ(this.data.lockDevice,isConnected,connectedDeviceId,isInitReady,this.data.lockDevice.lockModel)
@ -1191,6 +1215,10 @@ Page({
this.setData({ this.setData({
show: true show: true
}) })
}else if(event == '3') {
this.configurewifj()
}else if(event == '8') {
this.personnelmanagement()
} }
} else { } else {
this.searchDevicesMethods() this.searchDevicesMethods()
@ -1272,6 +1300,10 @@ Page({
that.setData({ that.setData({
show: true show: true
}) })
} else if (that.data.event == '3') {
that.configurewifj()
}else if(that.data.event == '8') {
that.personnelmanagement()
} }
wx.hideLoading({ wx.hideLoading({
success: (res) => {}, success: (res) => {},
@ -1318,11 +1350,17 @@ Page({
taskId = 41 taskId = 41
that.initBluetooth() that.initBluetooth()
}, },
configurewifj(){
configurewifj() {
var that = this var that = this
taskId = 121 taskId = 121
that.initBluetooth() that.initBluetooth()
}, },
// 人员管理
personnelmanagement() {
var that = this
taskId = 9010
that.initBluetooth()
},
LwjonOpenLock: function () { LwjonOpenLock: function () {
var that = this var that = this
wx.showLoading({ wx.showLoading({
@ -1461,6 +1499,10 @@ Page({
case 121: { case 121: {
this.onConfigurewifi() this.onConfigurewifi()
} }
// 人员管理
case 9010: {
this.gotoperson()
}
default: { default: {
} }
@ -2199,6 +2241,10 @@ Page({
// that.onQueryBindState() // that.onQueryBindState()
if (taskId == 41 && that.data.event == '0') { if (taskId == 41 && that.data.event == '0') {
that.doWork() that.doWork()
}else if(taskId == 121 && that.data.event == '3') {
that.doWork()
}else if(taskId == 9010 && that.data.event == '8') {
that.doWork()
} }
}, 500) }, 500)
}, },


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

@ -58,7 +58,7 @@
<view class="iconfont icon-quanxianguanli text-green"></view> <view class="iconfont icon-quanxianguanli text-green"></view>
<view class="text-grey text-sm">图像管理</view> <view class="text-grey text-sm">图像管理</view>
</view> </view>
<view class="actionli" bindtap="changeshow2" wx:if="{{(deviceinfo.manufactureId ==1201 || deviceinfo.manufactureId == 1241) && authority}}">
<view class="actionli" bindtap="changeshow2" data-i="3" wx:if="{{(deviceinfo.manufactureId ==1201 || deviceinfo.manufactureId == 1241) && authority}}">
<view class="iconfont icon-shezhi text-green"></view> <view class="iconfont icon-shezhi text-green"></view>
<view class="text-grey text-sm">配网</view> <view class="text-grey text-sm">配网</view>
</view> </view>
@ -150,6 +150,6 @@
<view class="wificontact"> <view class="wificontact">
<van-field value="{{ wifiName }}" placeholder="请输入wifi名称" border="{{ false }}" bind:change="onChangewifi" /> <van-field value="{{ wifiName }}" placeholder="请输入wifi名称" border="{{ false }}" bind:change="onChangewifi" />
<van-field value="{{ wifiPwd }}" placeholder="请输入wifi密码" border="{{ false }}" bind:change="onChangewifi1" /> <van-field value="{{ wifiPwd }}" placeholder="请输入wifi密码" border="{{ false }}" bind:change="onChangewifi1" />
<van-button block type="primary" bindtap="onConfigurewifi">确定</van-button>
<van-button block type="primary" bindtap="configurationWifi">确定</van-button>
</view> </view>
</van-popup> </van-popup>

+ 4
- 4
pagesA/facepeople/facepeople.wxss View File

@ -108,11 +108,11 @@
.pic{ .pic{
width: 100%; width: 100%;
position: relative; position: relative;
height: 40vw;
height: 48vw;
} }
.picadd{ .picadd{
width: 150px;
height: 150px;
width: 200px;
height: 200px;
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
@ -123,6 +123,6 @@
} }
.faceimg{ .faceimg{
width: 120px; width: 120px;
height: 120px;
height: 160px;
border-radius: 10px; border-radius: 10px;
} }

+ 6
- 6
pagesA/selectFace/selectFace.js View File

@ -77,14 +77,14 @@ Page({
_image.initialHeight = _src.height _image.initialHeight = _src.height
} }
// 控制图片在屏幕居中 // 控制图片在屏幕居中
_image.initialX = (systemInfo.windowWidth - _image.initialWidth) >> 1
_image.initialY = (systemInfo.windowHeight - _image.initialHeight) >> 1
_image.initialX = 0//(systemInfo.windowWidth - _image.initialWidth) >> 1
_image.initialY = 0//(systemInfo.windowHeight - _image.initialHeight) >> 1
console.log(JSON.stringify(_image)) console.log(JSON.stringify(_image))
// 定义方框的位置和尺寸 // 定义方框的位置和尺寸
let _cropBorder = {} let _cropBorder = {}
_cropBorder.size = systemInfo.windowWidth * 0.8 _cropBorder.size = systemInfo.windowWidth * 0.8
_cropBorder.x = (systemInfo.windowWidth - _cropBorder.size) >> 1 _cropBorder.x = (systemInfo.windowWidth - _cropBorder.size) >> 1
_cropBorder.y = (systemInfo.windowHeight - _cropBorder.size * (4/3)) >> 1
_cropBorder.y = (systemInfo.windowHeight - _cropBorder.size) >> 1
that.setData({ that.setData({
src: _src, src: _src,
image: _image, image: _image,
@ -164,7 +164,7 @@ takePhoto() {
// 画方框的外框 // 画方框的外框
this.context.setStrokeStyle('white') this.context.setStrokeStyle('white')
// 往外画大一圈,这样在canvas上填充图片的时候框线就不会变细啦 // 往外画大一圈,这样在canvas上填充图片的时候框线就不会变细啦
this.context.strokeRect(cropBorder.x - 1, cropBorder.y - 1, cropBorder.size + 2, cropBorder.size * (4/3) + 2)
this.context.strokeRect(cropBorder.x - 1, cropBorder.y - 1, cropBorder.size + 2, (cropBorder.size * (4/3)) + 2)
this.context.draw() this.context.draw()
}, },
/** /**
@ -230,13 +230,13 @@ takePhoto() {
let srcY = (cropBorder.y - image.curY - 120 / 750 * that.data.windowWidth) / curImageHeight * src.height let srcY = (cropBorder.y - image.curY - 120 / 750 * that.data.windowWidth) / curImageHeight * src.height
// 方框区域映射到源图片中的尺寸 // 方框区域映射到源图片中的尺寸
let srcWidth = cropBorder.size / curImageWidth * src.width let srcWidth = cropBorder.size / curImageWidth * src.width
let srcHeight = cropBorder.size / curImageHeight * src.height
let srcHeight = (cropBorder.size * (4/3)) / curImageHeight * src.height
console.log('srcX = ' + srcX + ', srcY = ' + srcY + ', srcWidth = ' + srcWidth + ', srcHeight = ' + srcHeight + ', cropX = ' + cropBorder.x + ', cropY = ' + cropBorder.y + ', cropSize = ' + cropBorder.size) console.log('srcX = ' + srcX + ', srcY = ' + srcY + ', srcWidth = ' + srcWidth + ', srcHeight = ' + srcHeight + ', cropX = ' + cropBorder.x + ', cropY = ' + cropBorder.y + ', cropSize = ' + cropBorder.size)
// 绘制图片不要透明啦,不然会看到重影 // 绘制图片不要透明啦,不然会看到重影
this.context.setFillStyle('rgba(0,0,0,1)') this.context.setFillStyle('rgba(0,0,0,1)')
// 鉴于尺寸的精确度,方框内图片的覆盖在y方向会有微微的偏移, // 鉴于尺寸的精确度,方框内图片的覆盖在y方向会有微微的偏移,
// 但是一旦截图就返回上一页了,强迫症患者没有后悔的余地。 // 但是一旦截图就返回上一页了,强迫症患者没有后悔的余地。
this.context.drawImage(src.path, srcX, srcY, srcWidth, srcHeight, cropBorder.x, cropBorder.y, cropBorder.size, cropBorder.size * (4/3))
this.context.drawImage(src.path, srcX, srcY, srcWidth, srcHeight, cropBorder.x, cropBorder.y, cropBorder.size, cropBorder.size)
// 这里绘图一定要有回调,不然图片还没绘制完成就截图那就GG了 // 这里绘图一定要有回调,不然图片还没绘制完成就截图那就GG了
this.context.draw(true, function(res) { this.context.draw(true, function(res) {
wx.canvasToTempFilePath({ wx.canvasToTempFilePath({


+ 1
- 1
project.config.json View File

@ -49,7 +49,7 @@
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.23.4", "libVersion": "2.23.4",
"appid": "wx20de9fe5943934a1", "appid": "wx20de9fe5943934a1",
"projectname": "applte",
"projectname": "appltegy",
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",
"tabSize": 4 "tabSize": 4


Loading…
Cancel
Save