You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

181 lines
4.4 KiB

// pagesA/faceinfo/faceinfo.js
import moment from '../../utils/moment'
Page({
/**
* 页面的初始数据
*/
data: {
startdate: moment().format('YYYY-MM-DD HH:mm:ss'),
enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
minDate: new Date().getTime(),
currentDate: new Date().getTime(),
selectDateStatus:false,
selectDateStatus1:false,
dateIndex:1,
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){
console.log(event)
if(event.currentTarget.dataset.index == 1){
this.setData({
dateIndex:event.currentTarget.dataset.index,
selectDateStatus:true
})
}else if(event.currentTarget.dataset.index == 2){
this.setData({
dateIndex:event.currentTarget.dataset.index,
selectDateStatus1:true
})
}
},
// 选择凭证有效期
confirmMethods(event){
let time = moment(event.detail).format("YYYY-MM-DD HH:mm:ss")
if(this.data.dateIndex == 1){
this.setData({
startdate:time,
currentDate: event.detail,
minDate:event.detail
})
}else if(this.data.dateIndex == 2){
this.setData({
enddate:time,
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 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
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})