diff --git a/pages/Bluetooth/Bluetooth.js b/pages/Bluetooth/Bluetooth.js index 6855544..cae9792 100644 --- a/pages/Bluetooth/Bluetooth.js +++ b/pages/Bluetooth/Bluetooth.js @@ -1751,8 +1751,8 @@ Page({ }) var that = this var lockMac = this.data.lock.mac - var superAdminIdlist = this.data.lock.mac.slice(this.data.lock.mac.length - 11, this.data.lock.mac.length).split(":").join("") - var superAdmin = [] + // var superAdminIdlist = this.data.lock.mac.slice(this.data.lock.mac.length - 11, this.data.lock.mac.length).split(":").join("") + // var superAdmin = [] var superAdminId var deviceimei console.log(that.data.lock); @@ -1765,16 +1765,16 @@ Page({ 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 { - let adminid = superAdminIdlist.charCodeAt(i) - superAdmin.push(adminid) - } - } - superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) - console.log(lockMac, superAdminIdlist, superAdminId); + // 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) + // } + // } + // 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++) { @@ -1786,7 +1786,7 @@ Page({ // } // } // let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) - basecode = superAdminId + // basecode = superAdminId console.log("123123123123", basecode, superAdminId, deviceimei); let data = { code: 'lwj/registerDevice', @@ -1955,7 +1955,7 @@ Page({ deviceId: _this.data.deviceInfo.id, }] WXAPI.bindDeviceSite(data2).then(res2 => { - console.log(data2); + console.log(res2); if (res2.success) { _this.getdevice() wx.showToast({ diff --git a/pagesA/facepeople/facepeople.js b/pagesA/facepeople/facepeople.js index 87f4526..d5e78ca 100644 --- a/pagesA/facepeople/facepeople.js +++ b/pagesA/facepeople/facepeople.js @@ -104,6 +104,7 @@ Page({ deviceinfo: {}, personLi: {}, faceList: [], + facemessage: {}, // 删除人的信息 }, /** @@ -131,7 +132,39 @@ Page({ show2: true }) } + this.getFace() }, + // 获取已录入人脸数据 + getFace() { + var data = { + pageNum: 0, + pageSize: 0, + q: JSON.stringify({ + // cardId: this.data.personLi.cardId, + deviceNum: this.data.deviceinfo.deviceNum, + types: "0", + inStatus: '0,1,702' + }) + } + WXAPI.getCertificates(data).then(res => { + var dataOne = util.zlib_unzip(res.data) + console.log("人脸", res, dataOne); + if (res.success) { + dataOne.map(li => { + let content = JSON.parse(li.content) + li['pzname'] = content.pzname + li['password'] = '' + li['facepic'] = content.faceData + li['startTime'] = moment(li['startTime'] * 1000).format('YYYY-MM-DD') + li['endTime'] = moment(li['endTime'] * 1000).format('YYYY-MM-DD') + }) + console.log(dataOne); + this.setData({ + faceList: dataOne + }) + } + }) + }, CurentTime() { var now = new Date(); var year = now.getFullYear(); //年 @@ -207,9 +240,10 @@ Page({ }) }, // 弹出框 - changeshow() { + changeshow(e) { this.setData({ - show: true + show: true, + facemessage: e.currentTarget.dataset.item }) }, onClose() { @@ -251,6 +285,12 @@ Page({ var time2 = new Date(_this.data.datetimerange[1].replace(/-/g, '/')) var passwordStartTime = time1.getTime() / 1000 var passwordEndTime = time2.getTime() / 1000 + var facename + if(_this.data.facename == ''){ + facename = "人脸" + _this.data.faceList.length + }else { + facename = _this.data.facename + } // let facepicture = wx.getFileSystemManager().readFileSync(_this.data.avatarPath, "base64") // facepic = `data:image/jpg;base64, ${facepicture}` var dataface = { @@ -264,30 +304,99 @@ Page({ startTime: passwordStartTime, } } + var str = { + // cardId: this.personInfo.cardId, + imei: _this.data.deviceinfo.imei || "", + pzname: facename, + password: '', + faceData: _this.data.avatarPath, + userTelephone: JSON.parse(_this.data.personLi.info).userTelephone, + operateMode: '', + userPassword: JSON.parse(_this.data.personLi.info).userPassword, + passwordStartTime: passwordStartTime, + passwordEndTime: passwordEndTime, + is: false, + pass: true + } console.log(_this.data.avatarPath, dataface); WXAPI.sendCommand(dataface).then(res => { console.log(res); if (res.success) { faceaddIndex = res.data.index serialNumber = res.data.serialNumber + var datalist = { + cardId: _this.data.personLi.cardId, + content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1 + type: 10, + startTime: passwordStartTime, + endTime: passwordEndTime + }; + WXAPI.addCertificates(datalist).then(res6 => { + console.log("res6", res6); + }) + var data1 = { + cardId: _this.data.personLi.cardId, + content: JSON.stringify(str), //operateMode:NFC-10、把人员添加到凭证-1 + deviceNum: _this.data.deviceinfo.deviceNum, + type: 0, + imei: _this.data.deviceinfo.imei, + serial: serialNumber, + startTime: passwordStartTime, + endTime: passwordEndTime, + } + WXAPI.addCertificates(data1).then(res2 => { + console.log("res2", res2); + var updatedata = { + id: res2.data, + status: 1 + }; + WXAPI.updateCertificates(updatedata).then((res3) => { + console.log("res3", res3); + }); + }) this.setData({ show2: false }) wx.showToast({ - title: '添加人脸凭证成功', - icon: 'none', - duration: 2000 + title: '添加人脸成功', + icon: 'none', + duration: 2000 }) + this.getFace() }else{ + this.setData({ + show2: false + }) wx.showToast({ title: res.msg, icon: 'none', duration: 2000 }) + this.getFace() } }) } }, + // 删除人脸 + delFace() { + wx.showModal({ + title: '提示', + content: "此操作将删除该人脸信息,确定删除吗?", + success(res) { + if(res.confirm){ + let dataface = { + + } + }else if(res.cancel) { + wx.showToast({ + title: '取消删除该图像信息', + icon: "none", + duration: 2000 + }) + } + } + }) + }, sendBytes(bytes) { setTimeout(() => { wx.writeBLECharacteristicValue({ diff --git a/pagesA/facepeople/facepeople.wxml b/pagesA/facepeople/facepeople.wxml index aca0aab..ee59ab6 100644 --- a/pagesA/facepeople/facepeople.wxml +++ b/pagesA/facepeople/facepeople.wxml @@ -14,14 +14,14 @@ - - + + - - 哇,贞德是梨啊 + + {{item.pzname}} - {{ date }} + {{ item.startTime }} - {{ item.endTime }} @@ -30,14 +30,14 @@ 修改图像信息 - 删除图像信息 + 删除该图像信息 取消 - +