From 5a648787330a7b1b3b14b360d2c8e84305d54f5b Mon Sep 17 00:00:00 2001 From: xiaohei <11674173+xiaohei102908@user.noreply.gitee.com> Date: Fri, 24 Nov 2023 18:30:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC2.0=20=202023-11-24=20=20ljd?= =?UTF-8?q?=201=E3=80=81=E4=BF=AE=E6=94=B9=E4=BA=86=E5=88=A0=E9=99=A4NFC?= =?UTF-8?q?=E5=8D=A1=E5=87=AD=E8=AF=81=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BD=86=E6=98=AF=E8=BF=98=E6=98=AF=E6=9C=AA?= =?UTF-8?q?=E8=83=BD=E6=88=90=E5=8A=9F=E5=88=A0=E9=99=A4=E5=8D=A1=202?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=A0=E9=99=A4=E6=8C=87?= =?UTF-8?q?=E7=BA=B9=E5=87=AD=E8=AF=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/addperson/addperson.js | 107 ++++++++++++++++++++--- pages/indexUser/indexUser.js | 1 + pages/login/login.js | 1 + pages/userbluetoothUnlock/userbluetoothUnlock.js | 24 ++++- pagesA/facepeople/facepeople.js | 17 +++- 5 files changed, 133 insertions(+), 17 deletions(-) diff --git a/pages/addperson/addperson.js b/pages/addperson/addperson.js index 1ffbbed..8e4a67a 100644 --- a/pages/addperson/addperson.js +++ b/pages/addperson/addperson.js @@ -934,11 +934,11 @@ Page({ order: 6212, operateMode: 12, action: 2, - // cardNo: info.password, - passwordIndex: passwordIndex, + cardNo: info.password, type: 12, cardName: _this.data.personLi.name, - roomName: deviceinfo.roomName + roomName: deviceinfo.roomName, + cardIndex: info.index } } console.log(dataPasswod, 'dataPasswod', info) @@ -1094,6 +1094,7 @@ Page({ }) var cgInfo = this.data.cgInfo var personLi = this.data.FpList[index] + passwordLiAll = personLi var deviceinfo = this.data.deviceinfo var info = JSON.parse(personLi.content) var person = this.data.personLi @@ -1101,25 +1102,42 @@ Page({ console.log(personLi, "personLi"); this.getFpIndex(index, function (data) { if (data.length > 0) { - var FPindex = data[0].face // 删除 var dataFP = { - code: "", + code: "lwj/fpOperate", data: { fpIndex: info.index, lockerId: deviceinfo.deviceNum, - imei: deviceinfo.imei, lockerUserId: info.userPassword, keyId: info.userPassword, operateMode: 18, order: 6218, roomName: deviceinfo.roomName, - cardName: cardName, - startTime: passwordStartTime, - endTime: passwordEndTime, - action: 2 + startTime: personLi.startTime, + endTime: personLi.endTime, + action: 2, + cardName: personLi.name } } + console.log(dataFP); + WXAPI.sendCommand(dataFP).then(res => { + console.log(res, "获取索引"); + if(res.success){ + // fingerprintIndex = res.data.index + fingerprintIndex = JSON.parse(personLi.content).index + serialNumber = res.data.serialNumber + taskId = 72 + _this.initBluetooth() + }else{ + wx.hideLoading() + wx.showToast({ + title: res.msg, + mask: true, + icon: 'none', + duration: 2000 + }) + } + }) } else { wx.hideLoading() wx.showToast({ @@ -1543,6 +1561,15 @@ Page({ console.debug('bytes', bytes) that.sendBytes(bytes) }, + onDelFingerprint: function() { + var that = this + wx.showLoading({ + title: '删除指纹中', + }) + var bytes = plugin.delFingerprint(lockDevice.name, basecode, fingerprintIndex) + console.debug('bytes', bytes); + that.sendBytes(bytes) + }, onDelPincode: function () { var that = this wx.showLoading({ @@ -2892,7 +2919,7 @@ Page({ wx.hideLoading() if (data.code != 200) { var datacom = { - code: "lwj/c", + code: "lwj/cardOperate", data: { lockerId: that.data.deviceinfo.deviceNum, serialNumber: serialNumber, @@ -2903,7 +2930,7 @@ Page({ } } WXAPI.sendCommand(datacom).then(res2 => { - console.log(res2, '失败') + console.log(res2, '失败2933') }) wx.showModal({ title: '提示', @@ -2931,7 +2958,7 @@ Page({ }) } var datacom = { - code: "lwj/c", + code: "lwj/cardOperate", data: { lockerId: that.data.deviceinfo.deviceNum, serialNumber: serialNumber, @@ -2966,6 +2993,9 @@ Page({ }) } }) + that.setData({ + isRfCardAdd: false + }) rfCardId = -1 rfCardIndex = -1 break @@ -3109,6 +3139,20 @@ Page({ case 'delFingerprint': { wx.hideLoading() if (data.code != 200) { + var datacom = { + code: "lwj/fpOperate", + data: { + lockerId: that.data.deviceinfo.deviceNum, + serialNumber: serialNumber, + index: fingerprintIndex, + action: 2, + type: 18, + result: 0 + } + } + WXAPI.sendCommand(datacom).then(res2 => { + console.log(res2, '失败') + }) wx.showModal({ title: '提示', content: '删除指纹失败!', @@ -3123,6 +3167,43 @@ Page({ content: `删除指纹成功,序号${fingerprintIndex}!`, showCancel: false, }) + var datacom = { + code: "lwj/fpOperate", + data: { + lockerId: that.data.deviceinfo.deviceNum, + serialNumber: serialNumber, + index: fingerprintIndex, + action: 2, + type: 18, + result: 1 + } + } + WXAPI.sendCommand(datacom).then(res2 => { + if (res2.success) {} + }) + var data = { + ids: [passwordLiAll.id] + } + WXAPI.deleteCertificates(data).then(res1 => { + if (res1.success) { + that.getFp() + wx.hideLoading() + wx.showToast({ + title: '删除成功', + mask: true, + icon: 'none', + duration: 2000 + }) + } else { + wx.hideLoading() + wx.showToast({ + title: '删除失败', + mask: true, + icon: 'none', + duration: 2000 + }) + } + }) that.setData({ isFingerprintAdd: false }) diff --git a/pages/indexUser/indexUser.js b/pages/indexUser/indexUser.js index 2fbab89..f4dd77f 100644 --- a/pages/indexUser/indexUser.js +++ b/pages/indexUser/indexUser.js @@ -31,6 +31,7 @@ Page({ wx.getStorage({ key: "deviceinfoList", success: (res) => { + console.log(res); this.setData({ list:res.data, deviceList:res.data diff --git a/pages/login/login.js b/pages/login/login.js index 8d4fa7d..b7ad9f3 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -223,6 +223,7 @@ Page({ number:this.data.usernameOne } WXAPI.atCardUser(data).then(res => { + console.log(res); if(res.code==200){ let token={ access_token:signature diff --git a/pages/userbluetoothUnlock/userbluetoothUnlock.js b/pages/userbluetoothUnlock/userbluetoothUnlock.js index 8626c9c..423dbfb 100644 --- a/pages/userbluetoothUnlock/userbluetoothUnlock.js +++ b/pages/userbluetoothUnlock/userbluetoothUnlock.js @@ -12,6 +12,7 @@ var bleall = require('../../utils/bleall'); const emitter = app.globalData.emitter import moment from "../../utils/moment" const ADD_NFC_MODE=10 +var basecode = '' // ArrayBuffer转16进度字符串示例 function ab2hex(buffer) { var hexArr = Array.prototype.map.call( @@ -96,6 +97,21 @@ Page({ app.globalData.zgBlueStatus = false this.AddressPermissions() let deviceinfo = wx.getStorageSync('deviceinfo') + // if(deviceinfo){ + // let superAdmin = [] + // var superAdminIdlist = deviceinfo.bluetoothMac.slice(deviceinfo.bluetoothMac.length - 11, deviceinfo.bluetoothMac.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"); + // } if(deviceinfo.manufactureId==201||deviceinfo.manufactureId == 221){ var data3 = { code: "zg/bleRegisterInfo", @@ -121,9 +137,11 @@ Page({ this.getApartmentCardInfoMethods() this.getPassWordMehods() app.globalData.deviceNum = deviceinfo.deviceNum - app.watch(this.getcartcount, 'backdata') - app.watch(this.fingerprintFun, 'fingerprintId') - app.watch(this.openlockfun, 'openlock') + if(deviceinfo.manufactureId == 101){ + app.watch(this.getcartcount, 'backdata') + app.watch(this.fingerprintFun, 'fingerprintId') + app.watch(this.openlockfun, 'openlock') + } }, // 获取合同信息 getApartmentCardInfoMethods(){ diff --git a/pagesA/facepeople/facepeople.js b/pagesA/facepeople/facepeople.js index 1c256b1..8f27685 100644 --- a/pagesA/facepeople/facepeople.js +++ b/pagesA/facepeople/facepeople.js @@ -132,7 +132,22 @@ Page({ show2: true }) } - this.getFace() + if(deviceinfo.bluetoothMac){ + let superAdmin = [] + var superAdminIdlist = deviceinfo.bluetoothMac.slice(deviceinfo.bluetoothMac.length - 11, deviceinfo.bluetoothMac.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"); + } + this.getFace(); }, // 获取已录入人脸数据 getFace() {