Browse Source

图像管理页面可以正常获取到人脸图像,修复了增加人脸平台没有记录问题

master
xiaohei 1 year ago
parent
commit
1343eedd7c
3 changed files with 135 additions and 26 deletions
  1. +14
    -14
      pages/Bluetooth/Bluetooth.js
  2. +114
    -5
      pagesA/facepeople/facepeople.js
  3. +7
    -7
      pagesA/facepeople/facepeople.wxml

+ 14
- 14
pages/Bluetooth/Bluetooth.js View File

@ -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({


+ 114
- 5
pagesA/facepeople/facepeople.js View File

@ -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({


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

@ -14,14 +14,14 @@
</view>
</view>
<!-- 个人数据 -->
<view class="facepeople-list">
<view class="facepeople-item" bindtap="changeshow">
<view class="facepeople-list" wx:for="{{faceList}}" wx:key="{{index}}">
<view class="facepeople-item" bindtap="changeshow" data-item="{{item}}">
<view class="facepeople-left">
<van-image round width="100rpx" height="100rpx" src="https://img.yzcdn.cn/vant/cat.jpeg" />
<span class="name">哇,贞德是梨啊</span>
<van-image round width="100rpx" height="100rpx" src="{{item.facepic}}" />
<span class="name">{{item.pzname}}</span>
</view>
<view class="facepeople-right">
<span class="facepeople-date">{{ date }}</span>
<span class="facepeople-date">{{ item.startTime }} - {{ item.endTime }}</span>
<van-icon name="arrow" class="arrow" />
</view>
</view>
@ -30,14 +30,14 @@
<van-popup show="{{ show }}" bind:close="onClose" round>
<view class="popup-face">
<view class="face-item" bindtap="gotoinfo">修改图像信息</view>
<view class="face-item">删除图像信息</view>
<view class="face-item" bindtap="delFace">删除图像信息</view>
<view class="face-item" bindtap="onClose">取消</view>
</view>
</van-popup>
<!-- 影响弹出框 -->
<van-popup show="{{ show2 }}" bind:close="onClose" round>
<view class="addfaces">
<!-- <van-field value="{{ facename }}" placeholder="请输入图像名称" label="人脸" border="{{ true }}" bind:change="onChange2" maxlength="8" /> -->
<van-field value="{{ facename }}" placeholder="请输入图像名称" label="人脸" border="{{ true }}" bind:change="onChange2" maxlength="8" />
<picker mode="date" value="{{starttime}}" start="{{minDate}}" end="{{ minDate1 }}" bindchange="bindDateChange">
<van-field value="{{ starttime }}" placeholder="请选择开始时间" label="开始时间" border="{{ true }}" readonly />
</picker>


Loading…
Cancel
Save