From bb8b04e7a3853b69aca7635b69f314e38e5c2222 Mon Sep 17 00:00:00 2001 From: xiaohei <11674173+xiaohei102908@user.noreply.gitee.com> Date: Wed, 13 Dec 2023 18:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC1.0.6=20=202023-12-13=20=20lj?= =?UTF-8?q?d=201=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BA=BA=E8=84=B8?= =?UTF-8?q?=E9=94=81=E7=9A=84=E5=BD=95=E5=85=A5=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=202=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E4=BA=BA=E8=84=B8=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E6=8E=92=E7=89=88=E5=B1=95=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E5=9B=BE=E5=83=8F=E7=AE=A1=E7=90=86=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E7=9B=B8=E5=BA=94=E7=9A=84=E4=BA=BA=E5=91=98=E9=87=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 1 + pages/personManger/personManger.js | 4 + pages/personManger/personManger.wxml | 1 + pages/roomDetail/roomDetail.js | 4 + pages/roomDetail/roomDetail.wxml | 4 +- pagesA/faceinfo/faceinfo.js | 24 +++- pagesA/faceinfo/faceinfo.wxml | 4 +- pagesA/facepeople/facepeople.js | 248 ++++++++++++++++++++++------------- pagesA/facepeople/facepeople.wxml | 6 +- project.config.json | 4 +- utils/util.js | 5 +- 11 files changed, 199 insertions(+), 106 deletions(-) diff --git a/app.js b/app.js index 4ae0d87..75fb6f9 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,7 @@ App({ onLaunch() { this.globalData.sysinfo = wx.getSystemInfoSync() // wx885b65d99da00084 + // wx20de9fe5943934a1 公寓 plugin.init('wx20de9fe5943934a1', '458f9df0-3405-66a9-1cdb-49d5f4197e6a') .then(function(res){ console.log('res', res) diff --git a/pages/personManger/personManger.js b/pages/personManger/personManger.js index 99a2e3e..21382b6 100644 --- a/pages/personManger/personManger.js +++ b/pages/personManger/personManger.js @@ -929,6 +929,10 @@ Page({ } } }) + }else if(current == 3){ + wx.navigateTo({ + url: '/pagesA/facepeople/facepeople', + }) } } }, diff --git a/pages/personManger/personManger.wxml b/pages/personManger/personManger.wxml index b296b5a..13949dd 100644 --- a/pages/personManger/personManger.wxml +++ b/pages/personManger/personManger.wxml @@ -9,6 +9,7 @@ {{data.name}} + 图像管理 管理凭证 删除 diff --git a/pages/roomDetail/roomDetail.js b/pages/roomDetail/roomDetail.js index 2758424..bb127a8 100644 --- a/pages/roomDetail/roomDetail.js +++ b/pages/roomDetail/roomDetail.js @@ -1193,6 +1193,10 @@ Page({ }) } else if (event == 11) { this.synchroPlatformTask() + }else if(event == 8){ + wx.navigateTo({ + url: '/pages/personManger/personManger', + }) } wx.hideLoading() } else { diff --git a/pages/roomDetail/roomDetail.wxml b/pages/roomDetail/roomDetail.wxml index 2ce41e5..73e92f6 100644 --- a/pages/roomDetail/roomDetail.wxml +++ b/pages/roomDetail/roomDetail.wxml @@ -54,10 +54,10 @@ 人员管理 - + 配网 diff --git a/pagesA/faceinfo/faceinfo.js b/pagesA/faceinfo/faceinfo.js index 4de6ec7..2eb67b5 100644 --- a/pagesA/faceinfo/faceinfo.js +++ b/pagesA/faceinfo/faceinfo.js @@ -1,11 +1,13 @@ // pagesA/faceinfo/faceinfo.js import moment from '../../utils/moment' +const WXAPI = require('../../utils/request') Page({ /** * 页面的初始数据 */ data: { + deviceinfo: {}, startdate: moment().format('YYYY-MM-DD HH:mm:ss'), enddate: moment().format('YYYY-MM-DD HH:mm:ss'), minDate: new Date().getTime(), @@ -22,10 +24,13 @@ Page({ */ onLoad: function (options) { var facemessage = wx.getStorageSync('facemessage') + var deviceinfo = wx.getStorageSync('deviceinfo') + console.log(facemessage); if(facemessage){ let info = JSON.parse(facemessage.content) this.setData({ facemessage, + deviceinfo, startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'), enddate: moment(info.passwordEndTime * 1000).format('YYYY-MM-DD HH:mm:ss'), }) @@ -80,15 +85,18 @@ Page({ var content = JSON.parse(face.content) var startTime = moment(this.data.startdate).format('x') / 1000 var endTime = moment(this.data.enddate).format('x') / 1000 + wx.showLoading({ + title: '修改凭证中...', + }) var dataface = { code: "lwj/faceOperate", data: { faceIndex: content.index, action: 3, endTime: endTime, - faceData: lt.contentJSON.faceData, - lockerId: deviceinfo.deviceNum, - lockerUserId: lt.contentJSON.userPassword, + faceData: content.faceData, + lockerId: this.data.deviceinfo.deviceNum, + lockerUserId: content.userPassword, startTime: startTime, operateMode: 21, order: 6221 @@ -97,7 +105,6 @@ Page({ WXAPI.sendCommand(dataface).then(res => { console.log(res); if(res.success){ - content.index = res.data.index content.operateMode = 21 content.order = 6221 content.passwordStartTime = startTime @@ -108,15 +115,22 @@ Page({ startTime: startTime, endTime: endTime } - WXAPI.sendCommand(data1).then(res1 => { + WXAPI.updateCertificates(data1).then(res1 => { console.log(res1); if(res1.success){ + wx.hideLoading() wx.showToast({ title: '修改凭证成功', icon: 'none', duration: 2000 }) + setTimeout(() => { + wx.navigateTo({ + url: '/pagesA/facepeople/facepeople', + }) + }, 500) }else{ + wx.hideLoading() wx.showToast({ title: '修改凭证失败', icon: "none", diff --git a/pagesA/faceinfo/faceinfo.wxml b/pagesA/faceinfo/faceinfo.wxml index a00b4d5..865aaa1 100644 --- a/pagesA/faceinfo/faceinfo.wxml +++ b/pagesA/faceinfo/faceinfo.wxml @@ -5,10 +5,10 @@ 锁号 {{facemessage.deviceNum}} - + diff --git a/pagesA/facepeople/facepeople.js b/pagesA/facepeople/facepeople.js index 93acacc..19c83e1 100644 --- a/pagesA/facepeople/facepeople.js +++ b/pagesA/facepeople/facepeople.js @@ -86,6 +86,7 @@ Page({ * 页面的初始数据 */ data: { + listshow: false, date: moment().format('YYYY-MM-DD HH:mm:ss'), show: false, value: '', @@ -114,8 +115,10 @@ Page({ var cgInfo = wx.getStorageSync('cgInfo') var deviceinfo = wx.getStorageSync('deviceinfo') var personLi = wx.getStorageSync('personLi') - let minDate = wx.getStorageSync('minDate') - let minDate1 = wx.getStorageSync('minDate1') + let minDate = moment().format('YYYY-MM-DD HH:mm:ss') + let minDate1 = moment().add(30, 'days').format('YYYY-MM-DD HH:mm:ss') + this.data.datetimerange[0] = minDate + this.data.datetimerange[1] = minDate1 console.log(cgInfo, deviceinfo, personLi, minDate, minDate1); this.setData({ isSearch: false, @@ -127,6 +130,7 @@ Page({ deviceinfo: deviceinfo, personLi: personLi, }) + console.log("131", this.data.datetimerange); if (this.data.avatarPath) { this.setData({ show2: true @@ -151,11 +155,12 @@ Page({ }, // 获取已录入人脸数据 getFace() { + var personLi = wx.getStorageSync('personLi') var data = { pageNum: 0, pageSize: 0, q: JSON.stringify({ - cardId: '1444', + cardId: personLi.cardId, deviceNum: this.data.deviceinfo.deviceNum, types: "0", inStatus: '0,1,702' @@ -171,13 +176,21 @@ Page({ 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') + li['startTimetext'] = moment(li['startTime'] * 1000).format('YYYY-MM-DD') + li['endTimetext'] = moment(li['endTime'] * 1000).format('YYYY-MM-DD') }) console.log(dataOne); - this.setData({ - faceList: dataOne - }) + if(dataOne.length > 0){ + this.setData({ + faceList: dataOne, + listshow: true + }) + }else{ + this.setData({ + faceList: dataOne, + listshow: false + }) + } } }) }, @@ -304,100 +317,130 @@ Page({ var passwordStartTime = time1.getTime() / 1000 var passwordEndTime = time2.getTime() / 1000 var facename + var faceeigenvalue 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 = { - code: "lwj/faceOperate", + let getfacedata = { + code: "lwj/getFeature", data: { - action: 1, - endTime: passwordEndTime, - faceData: _this.data.facepic, - lockerId: deviceinfo.deviceNum, - lockerUserId: info.userPassword, - startTime: passwordStartTime, - operateMode: 20, - order: 6220 + faceData: _this.data.facepic } } - 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: 20, - order: 6220, - userPassword: JSON.parse(_this.data.personLi.info).userPassword, - passwordStartTime: passwordStartTime, - passwordEndTime: passwordEndTime, - is: false, - pass: true, - cardName: this.data.personLi.name + '-' + pzname, - roomName: deviceinfo.roomName - } - console.log(_this.data.avatarPath, dataface); - WXAPI.sendCommand(dataface).then(res => { - console.log(res); - if (res.success) { - str.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 = { + WXAPI.sendCommand(getfacedata).then(res => { + console.log("319", res); + if(res.success){ + faceeigenvalue = res.data + var dataface = { + code: "lwj/faceOperate", + data: { + action: 1, + endTime: passwordEndTime, + faceData: faceeigenvalue, + lockerId: deviceinfo.deviceNum, + lockerUserId: info.userPassword, + startTime: passwordStartTime, + operateMode: 20, + order: 6220 + } + } + var str = { 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, + imei: _this.data.deviceinfo.imei || "", + pzname: facename, + password: '', + faceData: faceeigenvalue, + userTelephone: JSON.parse(_this.data.personLi.info).userTelephone, + operateMode: 20, order: 6220, - operateMode: 20 + userPassword: JSON.parse(_this.data.personLi.info).userPassword, + passwordStartTime: passwordStartTime, + passwordEndTime: passwordEndTime, + is: false, + pass: true, + type: 0, + cardName: _this.data.personLi.name + '-' + facename, + roomName: deviceinfo.roomName } - 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); - }); + WXAPI.sendCommand(dataface).then(res1 => { + console.log("res1", res1); + if(res1.success){ + str.index = res1.data.index + serialNumber = res.data.serialNumber + var datalist = { + cardId: _this.data.personLi.cardId, + content: JSON.stringify(str), + type: 10, + startTime: passwordStartTime, + endTime: passwordEndTime + } + WXAPI.addCertificates(datalist).then(res2 => { + console.log("res2", res2); + if(res2.success){ + 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, + order: 6220, + operateMode: 20 + } + WXAPI.addCertificates(data1).then(res3 => { + console.log("res3", res3); + var updatedata = { + id: res3.data, + status: 1 + }; + WXAPI.updateCertificates(updatedata).then((res4) => { + console.log("res4", res4); + _this.setData({ + show2: false + }) + wx.showToast({ + title: '添加人脸成功', + icon: 'none', + duration: 2000 + }) + _this.getFace() + }); + }) + }else{ + _this.setData({ + show2: false + }) + wx.showToast({ + title: '添加人脸失败', + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + _this.setData({ + show2: false + }) + wx.showToast({ + title: '添加人脸失败,请稍后重试', + icon: 'none', + duration: 2000 + }) + } }) - this.setData({ + }else{ + _this.setData({ show2: false }) wx.showToast({ - title: '添加人脸成功', + title: res.msg, icon: 'none', duration: 2000 }) - this.getFace() - }else{ - this.setData({ - show2: false - }) - wx.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - this.getFace() } }) } @@ -405,6 +448,7 @@ Page({ // 删除人脸 delFace() { console.log(this.data.facemessage); + var that = this var facemessage = this.data.facemessage var content = JSON.parse(facemessage.content) wx.showModal({ @@ -417,11 +461,11 @@ Page({ data: { faceIndex: content.index, action: 2, - endTime: content.passwordEndTime, + endTime: facemessage.endTime, faceData: content.faceData, lockerId: facemessage.deviceNum, lockerUserId: content.userPassword, - startTime: content.passwordStartTime, + startTime: facemessage.startTime, operateMode: 22, order: 6222 } @@ -440,12 +484,36 @@ Page({ WXAPI.updateCertificates(updatedata).then(res1 => { console.log(res1); if(res1.success){ - wx.showToast({ - title: '删除人脸成功', - icon: 'none', - duration: 2000 + let datadel = { + ids: [facemessage.id] + } + WXAPI.deleteCertificates(datadel).then(res2 => { + console.log("res2", res2); + if(res2.success){ + wx.showToast({ + title: '删除人脸成功', + icon: 'none', + duration: 2000 + }) + that.setData({ + show: false + }) + that.getFace() + }else{ + that.setData({ + show: false + }) + wx.showToast({ + title: '删除人脸失败', + icon: "none", + duration: 2000 + }) + } }) }else{ + that.setData({ + show: false + }) wx.showToast({ title: '删除人脸失败', icon: "none", diff --git a/pagesA/facepeople/facepeople.wxml b/pagesA/facepeople/facepeople.wxml index 6828d33..33af5e2 100644 --- a/pagesA/facepeople/facepeople.wxml +++ b/pagesA/facepeople/facepeople.wxml @@ -14,18 +14,18 @@ - + - {{item.pzname}} - {{ item.startTime }} - {{ item.endTime }} + {{ item.startTimetext }} - {{ item.endTimetext }} + diff --git a/project.config.json b/project.config.json index a5aa306..0a5e63b 100644 --- a/project.config.json +++ b/project.config.json @@ -37,7 +37,7 @@ "outputPath": "" }, "enableEngineNative": false, - "useIsolateContext": true, + "useIsolateContext": false, "userConfirmedBundleSwitch": false, "packNpmManually": false, "packNpmRelationList": [], @@ -49,7 +49,7 @@ }, "compileType": "miniprogram", "libVersion": "2.23.4", - "appid": "wx885b65d99da00084", + "appid": "wx20de9fe5943934a1", "projectname": "appltegy", "editorSetting": { "tabIndent": "insertSpaces", diff --git a/utils/util.js b/utils/util.js index 7435662..a40d89a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -9,6 +9,7 @@ const app = getApp(); // const emitter = app.globalData.emitter +var md5 = require("md5"); function formatTime(date) { const year = date.getFullYear() const month = date.getMonth() + 1 @@ -26,7 +27,6 @@ function formatNumber(n) { } - function uint8ArrayToString(fileData) { let dataString = ""; for (let i = 0; i < fileData.length; i++) { @@ -490,7 +490,8 @@ function throttle(fn, interval) { } var pako = require('pako'); var CryptoJS = require("crypto-js"); -var md5 = require("md5"); +// var md5 = require("md5"); +const moment = require('./moment'); function decrypt(word, keyStr) { let key = CryptoJS.enc.Utf8.parse(keyStr); let decrypt = CryptoJS.AES.decrypt(word, key, {