| 
															
																@@ -28,40 +28,61 @@ Page({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   onLoad: function (options) { 
															 | 
															
															 | 
															
																   onLoad: function (options) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let date = options.beginDate; 
															 | 
															
															 | 
															
																     let date = options.beginDate; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if (date) { 
															 | 
															
															 | 
															
																     if (date) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      this.setData({ bd: date }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        bd: date 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     const urls = urlDef.urls; 
															 | 
															
															 | 
															
																     const urls = urlDef.urls; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let stu = wx.getStorageSync('student'); 
															 | 
															
															 | 
															
																     let stu = wx.getStorageSync('student'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if (stu) { 
															 | 
															
															 | 
															
																     if (stu) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      this.setData({ 'curStu': stu }); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        'curStu': stu 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																       util.apiPost(urls.get_sys_params + '&q.orgId=' + stu.orgId + '&q.id=1000_2').then((rs) => { 
															 | 
															
															 | 
															
																       util.apiPost(urls.get_sys_params + '&q.orgId=' + stu.orgId + '&q.id=1000_2').then((rs) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
															
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-          this.setData({ leaveTime: parseInt(rs[0].sysVal, 10) }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            leaveTime: parseInt(rs[0].sysVal, 10) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       }); 
															 | 
															
															 | 
															
																       }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       // this.leaveDay = 14; // 允许提前()天请假 
															 | 
															
															 | 
															
																       // this.leaveDay = 14; // 允许提前()天请假 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       util.apiPost(urls.get_sys_params + '&q.orgId=' + stu.orgId + '&q.id=1000_1').then((rs) => { 
															 | 
															
															 | 
															
																       util.apiPost(urls.get_sys_params + '&q.orgId=' + stu.orgId + '&q.id=1000_1').then((rs) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
															
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-          this.setData({ leaveDay: parseInt(rs[0].sysVal, 10) }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            leaveDay: parseInt(rs[0].sysVal, 10) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       }); 
															 | 
															
															 | 
															
																       }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      util.apiPost(urls.get_sys_params, { 'q.orgId': stu.orgId, 'q.id': 'f8158acabeeb44ec9ff651aade6b295f' }).then((rs) => { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      util.apiPost(urls.get_sys_params, { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        'q.orgId': stu.orgId, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        'q.id': 'f8158acabeeb44ec9ff651aade6b295f' 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }).then((rs) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
															
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																           // 将分钟转为毫秒 
															 | 
															
															 | 
															
																           // 将分钟转为毫秒 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-          this.setData({ 'aheadTime': parseInt(rs[0].sysVal, 10) * 60 * 1000 }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            'aheadTime': parseInt(rs[0].sysVal, 10) * 60 * 1000 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       }); 
															 | 
															
															 | 
															
																       }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      util.apiPost(urls.leave_get_classes_info, { 'q.studentId': stu.studentId }).then((rs) => { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      util.apiPost(urls.leave_get_classes_info, { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        'q.studentId': stu.studentId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }).then((rs) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
															
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-          this.setData({ 'eventList': rs }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            'eventList': rs 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       }); 
															 | 
															
															 | 
															
																       }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      util.apiPost(urls.get_holidays, { 'q.companyId': stu.orgId }).then((rs) => { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      util.apiPost(urls.get_holidays, { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        'q.companyId': stu.orgId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }).then((rs) => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
															
															 | 
															
																         if (rs && rs.length > 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-          this.setData({ 'holidayList': rs }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            'holidayList': rs 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+          }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       }); 
															 | 
															
															 | 
															
																       }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -81,8 +102,11 @@ Page({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let date = this.data.bd 
															 | 
															
															 | 
															
																     let date = this.data.bd 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if (date) { 
															 | 
															
															 | 
															
																     if (date) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       let t = this; 
															 | 
															
															 | 
															
																       let t = this; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      setTimeout(() => { t.selectDate(date) }, 500) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      setTimeout(() => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        t.selectDate(date) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }, 500) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }, 
															 | 
															
															 | 
															
																   }, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																   /** 
															 | 
															
															 | 
															
																   /** 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -120,37 +144,53 @@ Page({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }, 
															 | 
															
															 | 
															
																   }, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   selectDate: function (v) { 
															 | 
															
															 | 
															
																   selectDate: function (v) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    this.setData({ curDate: v }) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    this.setData({  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      curDate: v 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let vd = new Date(v); 
															 | 
															
															 | 
															
																     let vd = new Date(v); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let week = this.data.weekMap[vd.getDay()]; 
															 | 
															
															 | 
															
																     let week = this.data.weekMap[vd.getDay()]; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let list = this.data.eventList.filter(o => { 
															 | 
															
															 | 
															
																     let list = this.data.eventList.filter(o => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       return o.attenceDate == v; 
															 | 
															
															 | 
															
																       return o.attenceDate == v; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     }); 
															 | 
															
															 | 
															
																     }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    if(list.length<=0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      setTimeout(() => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        this.selectDate(v) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }, 1000); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     list.map(o => { 
															 | 
															
															 | 
															
																     list.map(o => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       o.bt = o.beginTime.substring(0, 5); 
															 | 
															
															 | 
															
																       o.bt = o.beginTime.substring(0, 5); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       o.et = o.endTime.substring(0, 5); 
															 | 
															
															 | 
															
																       o.et = o.endTime.substring(0, 5); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       o.leaveFlag = this.canLeave(o) 
															 | 
															
															 | 
															
																       o.leaveFlag = this.canLeave(o) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     }) 
															 | 
															
															 | 
															
																     }) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    this.setData({ 'date': v, 'week': week, 'dateList': [{ items: list, date: v, week: week }] }); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    this.setData({ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      'date': v, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      'week': week, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      'dateList': [{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        items: list, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        date: v, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        week: week 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      }] 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }, 
															 | 
															
															 | 
															
																   }, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   callSelectDate: function (d) { 
															 | 
															
															 | 
															
																   callSelectDate: function (d) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     let v = d.detail.dateString; 
															 | 
															
															 | 
															
																     let v = d.detail.dateString; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     this.selectDate(v); 
															 | 
															
															 | 
															
																     this.selectDate(v); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   }, 
															 | 
															
															 | 
															
																   }, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																   canLeave(item) { 
															 | 
															
															 | 
															
																   canLeave(item) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let timeCheck = (item.attenceDate > this.data.curDate); // 默认要大于当前时间,就是不能请当天的假 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    let dateCheck = (item.attenceDate > this.data.curDate); // 默认要大于当前时间,就是不能请当天的假 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    let timeCheck = (item.attenceDate.replace(/-/g, '/') > this.data.curDate.replace(/-/g, '/')); // 默认要大于当前时间,就是不能请当天的假 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    let dateCheck = (item.attenceDate.replace(/-/g, '/') > this.data.curDate.replace(/-/g, '/')); // 默认要大于当前时间,就是不能请当天的假 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if (this.data.leaveTime > 0) { // 允许上课前()分钟请假 
															 | 
															
															 | 
															
																     if (this.data.leaveTime > 0) { // 允许上课前()分钟请假 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       // 判断当前时间是否跟上课时间相差  leaveTime 分钟 
															 | 
															
															 | 
															
																       // 判断当前时间是否跟上课时间相差  leaveTime 分钟 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      let attenceTime = new Date(item.attenceDate + ' ' + item.beginTime) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      let attenceTime = new Date(item.attenceDate.replace(/-/g, '/') + ' ' + item.beginTime) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       timeCheck = Math.floor((attenceTime.getTime() - new Date().getTime()) / 60000) >= this.data.leaveTime; 
															 | 
															
															 | 
															
																       timeCheck = Math.floor((attenceTime.getTime() - new Date().getTime()) / 60000) >= this.data.leaveTime; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     if (this.data.leaveDay > 0) { // 允许提前()天请假 
															 | 
															
															 | 
															
																     if (this.data.leaveDay > 0) { // 允许提前()天请假 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      let attenceTime = new Date(item.attenceDate + ' 00:00:00') 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      let attenceTime = item.attenceDate + ' 00:00:00' 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       const temDate = new Date(); 
															 | 
															
															 | 
															
																       const temDate = new Date(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																       temDate.setDate(temDate.getDate() + this.data.leaveDay); 
															 | 
															
															 | 
															
																       temDate.setDate(temDate.getDate() + this.data.leaveDay); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-      dateCheck = (temDate >= attenceTime); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      const curTemDate = temDate.getFullYear()+ "-" + (temDate.getMonth() + 1) + "-" + temDate.getDate() + ' 00:00:00'; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+      dateCheck = (curTemDate.replace(/-/g, '/') >= attenceTime.replace(/-/g, '/')); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     return (item.isAttend === 0 && item.leaveCount > 0 && timeCheck && dateCheck && (item.status === 0 || item.status === 4)); 
															 | 
															
															 | 
															
																     return (item.isAttend === 0 && item.leaveCount > 0 && timeCheck && dateCheck && (item.status === 0 || item.status === 4)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-  } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+  }, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 }) 
															 | 
															
															 | 
															
																 }) 
															 |