Browse Source

版本1.0.6 2023-12-13 ljd

1、增加了人脸锁的录入、修改删除功能
2、优化了人脸详情页面的排版展示,将图像管理放在相应的人员里面
master
xiaohei 1 year ago
parent
commit
bb8b04e7a3
11 changed files with 199 additions and 106 deletions
  1. +1
    -0
      app.js
  2. +4
    -0
      pages/personManger/personManger.js
  3. +1
    -0
      pages/personManger/personManger.wxml
  4. +4
    -0
      pages/roomDetail/roomDetail.js
  5. +2
    -2
      pages/roomDetail/roomDetail.wxml
  6. +19
    -5
      pagesA/faceinfo/faceinfo.js
  7. +2
    -2
      pagesA/faceinfo/faceinfo.wxml
  8. +158
    -90
      pagesA/facepeople/facepeople.js
  9. +3
    -3
      pagesA/facepeople/facepeople.wxml
  10. +2
    -2
      project.config.json
  11. +3
    -2
      utils/util.js

+ 1
- 0
app.js View File

@ -10,6 +10,7 @@ App({
onLaunch() { onLaunch() {
this.globalData.sysinfo = wx.getSystemInfoSync() this.globalData.sysinfo = wx.getSystemInfoSync()
// wx885b65d99da00084 // wx885b65d99da00084
// wx20de9fe5943934a1 公寓
plugin.init('wx20de9fe5943934a1', '458f9df0-3405-66a9-1cdb-49d5f4197e6a') plugin.init('wx20de9fe5943934a1', '458f9df0-3405-66a9-1cdb-49d5f4197e6a')
.then(function(res){ .then(function(res){
console.log('res', res) console.log('res', res)


+ 4
- 0
pages/personManger/personManger.js View File

@ -929,6 +929,10 @@ Page({
} }
} }
}) })
}else if(current == 3){
wx.navigateTo({
url: '/pagesA/facepeople/facepeople',
})
} }
} }
}, },


+ 1
- 0
pages/personManger/personManger.wxml View File

@ -9,6 +9,7 @@
<view class="personli" wx:for="{{personList}}" wx:for-item="data" wx:key="{{index}}"> <view class="personli" wx:for="{{personList}}" wx:for-item="data" wx:key="{{index}}">
<view class="name">{{data.name}}</view> <view class="name">{{data.name}}</view>
<view class="operation"> <view class="operation">
<view class="delete green" bindtap="addperson1" data-current="3" data-index="{{index}}" wx:if="{{deviceinfo.manufactureId == '1241'}}">图像管理</view>
<view class="delete green" bindtap="addperson1" data-current="1" data-index="{{index}}">管理凭证</view> <view class="delete green" bindtap="addperson1" data-current="1" data-index="{{index}}">管理凭证</view>
<view class="delete red" bindtap="addperson1" data-current="2" data-index="{{index}}">删除</view> <view class="delete red" bindtap="addperson1" data-current="2" data-index="{{index}}">删除</view>
</view> </view>


+ 4
- 0
pages/roomDetail/roomDetail.js View File

@ -1193,6 +1193,10 @@ Page({
}) })
} else if (event == 11) { } else if (event == 11) {
this.synchroPlatformTask() this.synchroPlatformTask()
}else if(event == 8){
wx.navigateTo({
url: '/pages/personManger/personManger',
})
} }
wx.hideLoading() wx.hideLoading()
} else { } else {


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

@ -54,10 +54,10 @@
<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>
</view> </view>
<view class="actionli" bindtap="gotofaceadd" wx:if="{{(deviceinfo.manufactureId ==1201 || deviceinfo.manufactureId == 1241) && authority}}">
<!-- <view class="actionli" bindtap="gotofaceadd" wx:if="{{(deviceinfo.manufactureId ==1201 || deviceinfo.manufactureId == 1241) && authority}}">
<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" 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>


+ 19
- 5
pagesA/faceinfo/faceinfo.js View File

@ -1,11 +1,13 @@
// pagesA/faceinfo/faceinfo.js // pagesA/faceinfo/faceinfo.js
import moment from '../../utils/moment' import moment from '../../utils/moment'
const WXAPI = require('../../utils/request')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
deviceinfo: {},
startdate: moment().format('YYYY-MM-DD HH:mm:ss'), startdate: moment().format('YYYY-MM-DD HH:mm:ss'),
enddate: moment().format('YYYY-MM-DD HH:mm:ss'), enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
minDate: new Date().getTime(), minDate: new Date().getTime(),
@ -22,10 +24,13 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
var facemessage = wx.getStorageSync('facemessage') var facemessage = wx.getStorageSync('facemessage')
var deviceinfo = wx.getStorageSync('deviceinfo')
console.log(facemessage);
if(facemessage){ if(facemessage){
let info = JSON.parse(facemessage.content) let info = JSON.parse(facemessage.content)
this.setData({ this.setData({
facemessage, facemessage,
deviceinfo,
startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'), startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
enddate: moment(info.passwordEndTime * 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 content = JSON.parse(face.content)
var startTime = moment(this.data.startdate).format('x') / 1000 var startTime = moment(this.data.startdate).format('x') / 1000
var endTime = moment(this.data.enddate).format('x') / 1000 var endTime = moment(this.data.enddate).format('x') / 1000
wx.showLoading({
title: '修改凭证中...',
})
var dataface = { var dataface = {
code: "lwj/faceOperate", code: "lwj/faceOperate",
data: { data: {
faceIndex: content.index, faceIndex: content.index,
action: 3, action: 3,
endTime: endTime, 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, startTime: startTime,
operateMode: 21, operateMode: 21,
order: 6221 order: 6221
@ -97,7 +105,6 @@ Page({
WXAPI.sendCommand(dataface).then(res => { WXAPI.sendCommand(dataface).then(res => {
console.log(res); console.log(res);
if(res.success){ if(res.success){
content.index = res.data.index
content.operateMode = 21 content.operateMode = 21
content.order = 6221 content.order = 6221
content.passwordStartTime = startTime content.passwordStartTime = startTime
@ -108,15 +115,22 @@ Page({
startTime: startTime, startTime: startTime,
endTime: endTime endTime: endTime
} }
WXAPI.sendCommand(data1).then(res1 => {
WXAPI.updateCertificates(data1).then(res1 => {
console.log(res1); console.log(res1);
if(res1.success){ if(res1.success){
wx.hideLoading()
wx.showToast({ wx.showToast({
title: '修改凭证成功', title: '修改凭证成功',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
setTimeout(() => {
wx.navigateTo({
url: '/pagesA/facepeople/facepeople',
})
}, 500)
}else{ }else{
wx.hideLoading()
wx.showToast({ wx.showToast({
title: '修改凭证失败', title: '修改凭证失败',
icon: "none", icon: "none",


+ 2
- 2
pagesA/faceinfo/faceinfo.wxml View File

@ -5,10 +5,10 @@
<view class="item-title">锁号</view> <view class="item-title">锁号</view>
<view class="item-value">{{facemessage.deviceNum}}</view> <view class="item-value">{{facemessage.deviceNum}}</view>
</view> </view>
<view class="lock-message-item">
<!-- <view class="lock-message-item">
<view class="item-title">图像信息</view> <view class="item-title">图像信息</view>
<van-image width="100rpx" height="100rpx" data-src="{{facemessage.facepic}}" src="{{facemessage.facepic}}" class="item-value" /> <van-image width="100rpx" height="100rpx" data-src="{{facemessage.facepic}}" src="{{facemessage.facepic}}" class="item-value" />
</view>
</view> -->
</view> </view>
<view class="start-end-date"> <view class="start-end-date">
<view class="date-item" bindtap="selectTimeMethods" data-index='1'> <view class="date-item" bindtap="selectTimeMethods" data-index='1'>


+ 158
- 90
pagesA/facepeople/facepeople.js View File

@ -86,6 +86,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
listshow: false,
date: moment().format('YYYY-MM-DD HH:mm:ss'), date: moment().format('YYYY-MM-DD HH:mm:ss'),
show: false, show: false,
value: '', value: '',
@ -114,8 +115,10 @@ Page({
var cgInfo = wx.getStorageSync('cgInfo') var cgInfo = wx.getStorageSync('cgInfo')
var deviceinfo = wx.getStorageSync('deviceinfo') var deviceinfo = wx.getStorageSync('deviceinfo')
var personLi = wx.getStorageSync('personLi') 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); console.log(cgInfo, deviceinfo, personLi, minDate, minDate1);
this.setData({ this.setData({
isSearch: false, isSearch: false,
@ -127,6 +130,7 @@ Page({
deviceinfo: deviceinfo, deviceinfo: deviceinfo,
personLi: personLi, personLi: personLi,
}) })
console.log("131", this.data.datetimerange);
if (this.data.avatarPath) { if (this.data.avatarPath) {
this.setData({ this.setData({
show2: true show2: true
@ -151,11 +155,12 @@ Page({
}, },
// 获取已录入人脸数据 // 获取已录入人脸数据
getFace() { getFace() {
var personLi = wx.getStorageSync('personLi')
var data = { var data = {
pageNum: 0, pageNum: 0,
pageSize: 0, pageSize: 0,
q: JSON.stringify({ q: JSON.stringify({
cardId: '1444',
cardId: personLi.cardId,
deviceNum: this.data.deviceinfo.deviceNum, deviceNum: this.data.deviceinfo.deviceNum,
types: "0", types: "0",
inStatus: '0,1,702' inStatus: '0,1,702'
@ -171,13 +176,21 @@ Page({
li['pzname'] = content.pzname li['pzname'] = content.pzname
li['password'] = '' li['password'] = ''
li['facepic'] = content.faceData 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); 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 passwordStartTime = time1.getTime() / 1000
var passwordEndTime = time2.getTime() / 1000 var passwordEndTime = time2.getTime() / 1000
var facename var facename
var faceeigenvalue
if(_this.data.facename == ''){ if(_this.data.facename == ''){
facename = "人脸" + _this.data.faceList.length facename = "人脸" + _this.data.faceList.length
}else { }else {
facename = _this.data.facename 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: { 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, 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, 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 show2: false
}) })
wx.showToast({ wx.showToast({
title: '添加人脸成功',
title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 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() { delFace() {
console.log(this.data.facemessage); console.log(this.data.facemessage);
var that = this
var facemessage = this.data.facemessage var facemessage = this.data.facemessage
var content = JSON.parse(facemessage.content) var content = JSON.parse(facemessage.content)
wx.showModal({ wx.showModal({
@ -417,11 +461,11 @@ Page({
data: { data: {
faceIndex: content.index, faceIndex: content.index,
action: 2, action: 2,
endTime: content.passwordEndTime,
endTime: facemessage.endTime,
faceData: content.faceData, faceData: content.faceData,
lockerId: facemessage.deviceNum, lockerId: facemessage.deviceNum,
lockerUserId: content.userPassword, lockerUserId: content.userPassword,
startTime: content.passwordStartTime,
startTime: facemessage.startTime,
operateMode: 22, operateMode: 22,
order: 6222 order: 6222
} }
@ -440,12 +484,36 @@ Page({
WXAPI.updateCertificates(updatedata).then(res1 => { WXAPI.updateCertificates(updatedata).then(res1 => {
console.log(res1); console.log(res1);
if(res1.success){ 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{ }else{
that.setData({
show: false
})
wx.showToast({ wx.showToast({
title: '删除人脸失败', title: '删除人脸失败',
icon: "none", icon: "none",


+ 3
- 3
pagesA/facepeople/facepeople.wxml View File

@ -14,18 +14,18 @@
</view> </view>
</view> </view>
<!-- 个人数据 --> <!-- 个人数据 -->
<view class="facepeople-list" wx:for="{{faceList}}" wx:key="{{index}}">
<view class="facepeople-list" wx:if="{{listshow}}" wx:for="{{faceList}}" wx:key="{{index}}">
<view class="facepeople-item" bindtap="changeshow" data-item="{{item}}"> <view class="facepeople-item" bindtap="changeshow" data-item="{{item}}">
<view class="facepeople-left"> <view class="facepeople-left">
<!-- <van-image round width="100rpx" height="100rpx" src="{{item.facepic}}" /> -->
<span class="name">{{item.pzname}}</span> <span class="name">{{item.pzname}}</span>
</view> </view>
<view class="facepeople-right"> <view class="facepeople-right">
<span class="facepeople-date">{{ item.startTime }} - {{ item.endTime }}</span>
<span class="facepeople-date">{{ item.startTimetext }} - {{ item.endTimetext }}</span>
<van-icon name="arrow" class="arrow" /> <van-icon name="arrow" class="arrow" />
</view> </view>
</view> </view>
</view> </view>
<van-empty image="search" description="暂无人脸数据" wx:if="{{!listshow}}"/>
<!-- 个人数据弹出框 --> <!-- 个人数据弹出框 -->
<van-popup show="{{ show }}" bind:close="onClose" round> <van-popup show="{{ show }}" bind:close="onClose" round>
<view class="popup-face"> <view class="popup-face">


+ 2
- 2
project.config.json View File

@ -37,7 +37,7 @@
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false, "enableEngineNative": false,
"useIsolateContext": true,
"useIsolateContext": false,
"userConfirmedBundleSwitch": false, "userConfirmedBundleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
@ -49,7 +49,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.23.4", "libVersion": "2.23.4",
"appid": "wx885b65d99da00084",
"appid": "wx20de9fe5943934a1",
"projectname": "appltegy", "projectname": "appltegy",
"editorSetting": { "editorSetting": {
"tabIndent": "insertSpaces", "tabIndent": "insertSpaces",


+ 3
- 2
utils/util.js View File

@ -9,6 +9,7 @@
const app = getApp(); const app = getApp();
// const emitter = app.globalData.emitter // const emitter = app.globalData.emitter
var md5 = require("md5");
function formatTime(date) { function formatTime(date) {
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
@ -26,7 +27,6 @@ function formatNumber(n) {
} }
function uint8ArrayToString(fileData) { function uint8ArrayToString(fileData) {
let dataString = ""; let dataString = "";
for (let i = 0; i < fileData.length; i++) { for (let i = 0; i < fileData.length; i++) {
@ -490,7 +490,8 @@ function throttle(fn, interval) {
} }
var pako = require('pako'); var pako = require('pako');
var CryptoJS = require("crypto-js"); var CryptoJS = require("crypto-js");
var md5 = require("md5");
// var md5 = require("md5");
const moment = require('./moment');
function decrypt(word, keyStr) { function decrypt(word, keyStr) {
let key = CryptoJS.enc.Utf8.parse(keyStr); let key = CryptoJS.enc.Utf8.parse(keyStr);
let decrypt = CryptoJS.AES.decrypt(word, key, { let decrypt = CryptoJS.AES.decrypt(word, key, {


Loading…
Cancel
Save