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.

144 lines
3.5 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. // pagesA/faceinfo/faceinfo.js
  2. import moment from '../../utils/moment'
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. startdate: moment().format('YYYY-MM-DD HH:mm:ss'),
  9. enddate: moment().format('YYYY-MM-DD HH:mm:ss'),
  10. minDate: new Date().getTime(),
  11. currentDate: new Date().getTime(),
  12. selectDateStatus:false,
  13. selectDateStatus1:false,
  14. dateIndex:1,
  15. currentDate1:new Date().getTime(),
  16. facemessage: {}
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. var facemessage = wx.getStorageSync('facemessage')
  23. if(facemessage){
  24. let info = JSON.parse(facemessage.content)
  25. this.setData({
  26. facemessage,
  27. startdate: moment(info.passwordStartTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
  28. enddate: moment(info.passwordEndTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
  29. })
  30. }
  31. },
  32. // 时间选择
  33. selectTimeMethods(event){
  34. console.log(event)
  35. if(event.currentTarget.dataset.index == 1){
  36. this.setData({
  37. dateIndex:event.currentTarget.dataset.index,
  38. selectDateStatus:true
  39. })
  40. }else if(event.currentTarget.dataset.index == 2){
  41. this.setData({
  42. dateIndex:event.currentTarget.dataset.index,
  43. selectDateStatus1:true
  44. })
  45. }
  46. },
  47. // 选择凭证有效期
  48. confirmMethods(event){
  49. let time = moment(event.detail).format("YYYY-MM-DD HH:mm:ss")
  50. if(this.data.dateIndex == 1){
  51. this.setData({
  52. startdate:time,
  53. currentDate: event.detail,
  54. minDate:event.detail
  55. })
  56. }else if(this.data.dateIndex == 2){
  57. this.setData({
  58. enddate:time,
  59. currentDate1: event.detail,
  60. })
  61. }
  62. this.setData({
  63. selectDateStatus: false,
  64. selectDateStatus1:false
  65. });
  66. },
  67. cancelMethods(event){
  68. this.setData({
  69. selectDateStatus: false,
  70. selectDateStatus1:false
  71. });
  72. },
  73. // 确定修改人脸时间
  74. sendface() {
  75. console.log(this.data.facemessage)
  76. var face = this.data.facemessage
  77. var content = JSON.parse(face.content)
  78. var passwordStartTime = moment(this.data.startdate).format('YYYYMMDDHHmmss')
  79. var passwordEndTime = moment(this.data.enddate).format('YYYYMMDDHHmmss')
  80. content.pzname = this.data.facemessage.pzname
  81. content.passwordStartTime = passwordStartTime
  82. content.passwordEndTime = passwordEndTime
  83. var updatedata = {
  84. id: this.data.facemessage.id,
  85. content: JSON.stringify(content),
  86. startTime: moment(this.data.startdate).format('x') / 1000,
  87. endTime: moment(this.data.enddate).format('x') / 1000
  88. }
  89. },
  90. onChange(e) {
  91. this.data.facemessage.pzname = e.detail
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面隐藏
  105. */
  106. onHide: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面卸载
  110. */
  111. onUnload: function () {
  112. },
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh: function () {
  117. },
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom: function () {
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. onShareAppMessage: function () {
  127. }
  128. })