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