diff --git a/pages/addperson/addperson.js b/pages/addperson/addperson.js index ade84f5..1ffbbed 100644 --- a/pages/addperson/addperson.js +++ b/pages/addperson/addperson.js @@ -261,6 +261,21 @@ Page({ app.watch(this.getcartcount, 'backdata') app.watch(this.fingerprintFun, 'fingerprintId') } + if(deviceinfo.bluetoothMac){ + let superAdmin = [] + var superAdminIdlist = deviceinfo.bluetoothMac.slice(deviceinfo.bluetoothMac.length - 11, deviceinfo.bluetoothMac.length).split(":").join("") + 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) + } + } + let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) + basecode = superAdminId + console.log(basecode, "basecode"); + } }, // 指纹选择 radioChange(e) { @@ -908,7 +923,7 @@ Page({ var _this = this this.getNFCIndexLwj(index, function (data) { if (data.length > 0) { - let passwordIndex = JSON.parse(data[0].content).index || '' + let passwordIndex = info.index var dataPasswod = { code: "lwj/cardOperate", data: { @@ -1083,6 +1098,7 @@ Page({ var info = JSON.parse(personLi.content) var person = this.data.personLi var _this = this + console.log(personLi, "personLi"); this.getFpIndex(index, function (data) { if (data.length > 0) { var FPindex = data[0].face @@ -1090,19 +1106,17 @@ Page({ var dataFP = { code: "", data: { + fpIndex: info.index, lockerId: deviceinfo.deviceNum, imei: deviceinfo.imei, lockerUserId: info.userPassword, keyId: info.userPassword, - fingerType: 0, - order: 6216, - fingerId: '', + operateMode: 18, + order: 6218, roomName: deviceinfo.roomName, cardName: cardName, startTime: passwordStartTime, endTime: passwordEndTime, - file: '', - type: 1, action: 2 } } @@ -2159,6 +2173,7 @@ Page({ cardName: cardName, } } + console.log(dataPasswod); WXAPI.sendCommand(dataPasswod).then(res => { console.log(res, '获取索引') if (res.success) { @@ -4193,7 +4208,9 @@ Page({ type: 1 } } + console.log(dataPasswod); WXAPI.sendCommand(dataPasswod).then(res => { + console.log(res); if (res.success) { fingerprintIndex = res.data.index serialNumber = res.data.serialNumber diff --git a/pages/personManger/personManger.js b/pages/personManger/personManger.js index 8106738..dd62bdb 100644 --- a/pages/personManger/personManger.js +++ b/pages/personManger/personManger.js @@ -565,18 +565,16 @@ Page({ } WXAPI.getSiteTenant(data2).then(res1 => { if (res1.data.list.length > 0) { - let minDate = res1.data.list[0].startTime - let minDate1 = res1.data.list[0].endTime - let starttime = moment(minDate).format('YYYY-MM-DD HH:mm:ss') - let endtime = moment(minDate1).format('YYYY-MM-DD HH:mm:ss') - wx.setStorageSync('minDate',starttime) - wx.setStorageSync('minDate1',endtime) + let starttime = moment().format('YYYY-MM-DD HH:mm:ss') + let endtime = moment().add(30,'days').format('YYYY-MM-DD HH:mm:ss') + // wx.setStorageSync('minDate',starttime) + // wx.setStorageSync('minDate1',endtime) this.setData({ personList: res1.data.list, roomId: roomId, starttime, endtime, - minDate,minDate1 + // minDate,minDate1 }) } else { this.setData({ diff --git a/pages/roomDetail/roomDetail.js b/pages/roomDetail/roomDetail.js index c82c508..884827a 100644 --- a/pages/roomDetail/roomDetail.js +++ b/pages/roomDetail/roomDetail.js @@ -174,6 +174,21 @@ Page({ app.globalData.deviceNum = deviceinfo.deviceNum var userInfo1 = wx.getStorageSync('userInfo') let deviceinfoData = JSON.parse(JSON.stringify(deviceinfo)) + console.log(deviceinfoData); + if(deviceinfoData.bluetoothMac){ + let superAdmin = [] + var superAdminIdlist = deviceinfoData.bluetoothMac.slice(deviceinfoData.bluetoothMac.length - 11, deviceinfoData.bluetoothMac.length).split(":").join("") + 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) + } + } + let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length) + basecode = superAdminId + } if (deviceinfo.manufactureId == 201 || deviceinfo.manufactureId == 221) { var data3 = { code: "zg/bleRegisterInfo", diff --git a/pagesA/faceinfo/faceinfo.js b/pagesA/faceinfo/faceinfo.js index a5326a7..4de6ec7 100644 --- a/pagesA/faceinfo/faceinfo.js +++ b/pagesA/faceinfo/faceinfo.js @@ -78,18 +78,54 @@ Page({ console.log(this.data.facemessage) var face = this.data.facemessage var content = JSON.parse(face.content) - var passwordStartTime = moment(this.data.startdate).format('YYYYMMDDHHmmss') - var passwordEndTime = moment(this.data.enddate).format('YYYYMMDDHHmmss') - content.pzname = this.data.facemessage.pzname - content.passwordStartTime = passwordStartTime - content.passwordEndTime = passwordEndTime - var updatedata = { - id: this.data.facemessage.id, - content: JSON.stringify(content), - startTime: moment(this.data.startdate).format('x') / 1000, - endTime: moment(this.data.enddate).format('x') / 1000 + var startTime = moment(this.data.startdate).format('x') / 1000 + var endTime = moment(this.data.enddate).format('x') / 1000 + var dataface = { + code: "lwj/faceOperate", + data: { + faceIndex: content.index, + action: 3, + endTime: endTime, + faceData: lt.contentJSON.faceData, + lockerId: deviceinfo.deviceNum, + lockerUserId: lt.contentJSON.userPassword, + startTime: startTime, + operateMode: 21, + order: 6221 + } } - + 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 + content.passwordEndTime = endTime + let data1 = { + id: face.id, + content: JSON.stringify(content), + startTime: startTime, + endTime: endTime + } + WXAPI.sendCommand(data1).then(res1 => { + console.log(res1); + if(res1.success){ + wx.showToast({ + title: '修改凭证成功', + icon: 'none', + duration: 2000 + }) + }else{ + wx.showToast({ + title: '修改凭证失败', + icon: "none", + duration: 2000 + }) + } + }) + } + }) }, onChange(e) { this.data.facemessage.pzname = e.detail diff --git a/pagesA/faceinfo/faceinfo.wxml b/pagesA/faceinfo/faceinfo.wxml index 1054eee..a00b4d5 100644 --- a/pagesA/faceinfo/faceinfo.wxml +++ b/pagesA/faceinfo/faceinfo.wxml @@ -29,7 +29,7 @@ - + 确定 diff --git a/pagesA/facepeople/facepeople.js b/pagesA/facepeople/facepeople.js index 26f4b85..1c256b1 100644 --- a/pagesA/facepeople/facepeople.js +++ b/pagesA/facepeople/facepeople.js @@ -281,6 +281,7 @@ Page({ var _this = this var deviceinfo = this.data.deviceinfo var info = JSON.parse(this.data.personLi.info) + console.log(deviceinfo, info, this.data.personLi); if (deviceinfo.manufactureId == 1241) { var time1 = new Date(_this.data.datetimerange[0].replace(/-/g, '/')) var time2 = new Date(_this.data.datetimerange[1].replace(/-/g, '/')) @@ -303,6 +304,8 @@ Page({ lockerId: deviceinfo.deviceNum, lockerUserId: info.userPassword, startTime: passwordStartTime, + operateMode: 20, + order: 6220 } } var str = { @@ -312,18 +315,21 @@ Page({ password: '', faceData: _this.data.avatarPath, userTelephone: JSON.parse(_this.data.personLi.info).userTelephone, - operateMode: '', + operateMode: 20, + order: 6220, userPassword: JSON.parse(_this.data.personLi.info).userPassword, passwordStartTime: passwordStartTime, passwordEndTime: passwordEndTime, is: false, - pass: true + 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) { - faceaddIndex = res.data.index + str.faceaddIndex = res.data.index serialNumber = res.data.serialNumber var datalist = { cardId: _this.data.personLi.cardId, @@ -344,6 +350,8 @@ Page({ serial: serialNumber, startTime: passwordStartTime, endTime: passwordEndTime, + order: 6220, + operateMode: 20 } WXAPI.addCertificates(data1).then(res2 => { console.log("res2", res2); @@ -391,16 +399,45 @@ Page({ let dataface = { code: "lwj/faceOperate", data: { + faceIndex: content.index, action: 2, endTime: content.passwordEndTime, faceData: content.faceData, lockerId: facemessage.deviceNum, lockerUserId: content.userPassword, - startTime: content.passwordStartTime + startTime: content.passwordStartTime, + operateMode: 22, + order: 6222 } } WXAPI.sendCommand(dataface).then(res => { console.log(res); + content.operateMode = 22 + content.order = 6222 + if(res.success){ + let updatedata = { + id: facemessage.id, + status: 0, + serial: res.data.serialNumber, + content: JSON.stringify(content) + } + WXAPI.updateCertificates(updatedata).then(res1 => { + console.log(res1); + if(res1.success){ + wx.showToast({ + title: '删除人脸成功', + icon: 'none', + duration: 2000 + }) + }else{ + wx.showToast({ + title: '删除人脸失败', + icon: "none", + duration: 2000 + }) + } + }) + } }) }else if(res.cancel) { wx.showToast({