From a97023535f603162f12bc6907baff1739ec00348 Mon Sep 17 00:00:00 2001 From: xiaohei <11674173+xiaohei102908@user.noreply.gitee.com> Date: Wed, 15 Nov 2023 18:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=9B=BE=E5=83=8F=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagesA/faceinfo/faceinfo.js | 69 ++++++++++++++++++++++++++--------------- pagesA/faceinfo/faceinfo.wxml | 35 ++++++++------------- pagesA/facepeople/facepeople.js | 17 +++++++++- 3 files changed, 73 insertions(+), 48 deletions(-) diff --git a/pagesA/faceinfo/faceinfo.js b/pagesA/faceinfo/faceinfo.js index e0fc3f1..a5326a7 100644 --- a/pagesA/faceinfo/faceinfo.js +++ b/pagesA/faceinfo/faceinfo.js @@ -10,18 +10,26 @@ Page({ enddate: moment().format('YYYY-MM-DD HH:mm:ss'), minDate: new Date().getTime(), currentDate: new Date().getTime(), - imgList:["https://img.yzcdn.cn/vant/cat.jpeg"], selectDateStatus:false, selectDateStatus1:false, dateIndex:1, - currentDate1:new Date().getTime() + currentDate1:new Date().getTime(), + facemessage: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var facemessage = wx.getStorageSync('facemessage') + if(facemessage){ + let info = JSON.parse(facemessage.content) + this.setData({ + facemessage, + startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'), + enddate: moment(info.passwordEndTime * 1000).format('YYYY-MM-DD HH:mm:ss'), + }) + } }, // 时间选择 selectTimeMethods(event){ @@ -38,29 +46,8 @@ Page({ }) } }, - // 查看图片大图 - preview(event) { - console.log(event.currentTarget.dataset.src) - let currentUrl = event.currentTarget.dataset.src - wx.previewImage({ - current: currentUrl, // 当前显示图片的http链接 - urls: this.data.imgList // 需要预览的图片http链接列表 - }) - }, + // 选择凭证有效期 confirmMethods(event){ - this.setData({ - selectDateStatus: false, - selectDateStatus1:false - }); - }, - cancelMethods(event){ - this.setData({ - selectDateStatus: false, - selectDateStatus1:false - }); - }, - // 选择图像有效期 - onInput(event) { let time = moment(event.detail).format("YYYY-MM-DD HH:mm:ss") if(this.data.dateIndex == 1){ this.setData({ @@ -74,6 +61,38 @@ Page({ currentDate1: event.detail, }) } + this.setData({ + selectDateStatus: false, + selectDateStatus1:false + }); + }, + cancelMethods(event){ + this.setData({ + selectDateStatus: false, + selectDateStatus1:false + }); + }, + + // 确定修改人脸时间 + sendface() { + 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 + } + + }, + onChange(e) { + this.data.facemessage.pzname = e.detail }, /** * 生命周期函数--监听页面初次渲染完成 diff --git a/pagesA/faceinfo/faceinfo.wxml b/pagesA/faceinfo/faceinfo.wxml index a6025bf..1054eee 100644 --- a/pagesA/faceinfo/faceinfo.wxml +++ b/pagesA/faceinfo/faceinfo.wxml @@ -2,49 +2,40 @@ - 锁名称 - 1 + 锁号 + {{facemessage.deviceNum}} 图像信息 - + 生效时间 - {{ startdate }} + {{ startdate }} - + 失效时间 {{ enddate }} - + - 图像信息 - 哇,贞德是梨啊 + + - 确定 + 确定 - + - - - + + \ No newline at end of file diff --git a/pagesA/facepeople/facepeople.js b/pagesA/facepeople/facepeople.js index d5e78ca..26f4b85 100644 --- a/pagesA/facepeople/facepeople.js +++ b/pagesA/facepeople/facepeople.js @@ -254,6 +254,7 @@ Page({ }, // 跳转详情页 gotoinfo() { + wx.setStorageSync('facemessage', this.data.facemessage) wx.navigateTo({ url: '/pagesA/faceinfo/faceinfo', }) @@ -379,14 +380,28 @@ Page({ }, // 删除人脸 delFace() { + console.log(this.data.facemessage); + var facemessage = this.data.facemessage + var content = JSON.parse(facemessage.content) wx.showModal({ title: '提示', content: "此操作将删除该人脸信息,确定删除吗?", success(res) { if(res.confirm){ let dataface = { - + code: "lwj/faceOperate", + data: { + action: 2, + endTime: content.passwordEndTime, + faceData: content.faceData, + lockerId: facemessage.deviceNum, + lockerUserId: content.userPassword, + startTime: content.passwordStartTime + } } + WXAPI.sendCommand(dataface).then(res => { + console.log(res); + }) }else if(res.cancel) { wx.showToast({ title: '取消删除该图像信息',