|
|
@ -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", |
|
|
|