Browse Source

bug修改

yanym 5 years ago
parent
commit
5b5620f382
1 changed files with 19 additions and 2 deletions
  1. 19 2
      dorm-manager-wx/pages/teacher/pass/pass.js

+ 19 - 2
dorm-manager-wx/pages/teacher/pass/pass.js

@@ -23,8 +23,8 @@ Page({
     deviceIndex: 2,
     deviceArray: [],
     deviceList: '',
-    startDate: '2019-10-29',
-    endDate: '2019-10-29',
+    startDate: '',
+    endDate: '',
     list: []
   },
 
@@ -148,12 +148,14 @@ Page({
     this.setData({
       startDate: e.detail.value
     })
+    this.getPassInfo();
   },
 
   bindendDateChange: function(e) {
     this.setData({
       endDate: e.detail.value
     })
+    this.getPassInfo();
   },
 
   getDeviceInfo: function(e) {
@@ -210,6 +212,20 @@ Page({
     return date;
   },
 
+  getCurrentDate: function(e) {
+    let date = new Date();
+    let year = date.getFullYear();
+    let month = date.getMonth() + 1;
+    let day = date.getDate();
+    month = month < 10 ? "0" + month : month;
+    day = day < 10 ? "0" + day : day;
+    date = year + '-' + month + '-' + day
+    this.setData({
+      startDate: date,
+      endDate: date
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */
@@ -218,6 +234,7 @@ Page({
     that.setData({
       apiTotal: api.total.substring(0, api.total.length - 4)
     })
+    that.getCurrentDate();
     that.data.userInfo = wx.getStorageSync('user');
     that.getCollegeInfo();
     that.getDeviceInfo();