|
|
- // 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 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
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|