| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 | 
							- var d = dialog({contentType:'load', skin:'bk-popup'});
 
- var Request = GetRequest(); 
 
- $(function(){
 
-     checkUserAgent();
 
-     
 
-     var isLoad=false,
 
- 		dayNum = 7,
 
-         page = 0,
 
-         pagesize = 10;
 
-         
 
-         
 
-     var scroller =  new IScrollPullUpDown('wrapper',{
 
-         probeType:2,
 
-         bounceTime: 250,
 
-         bounceEasing: 'quadratic',
 
-         mouseWheel:false,
 
-         scrollbars:true,
 
-         click:true,
 
-         fadeScrollbars:true,
 
-         interactiveScrollbars:false
 
-     },null,pullUpAction);
 
-     
 
-     
 
-     var norTime = decodeURIComponent(Request["dateT"]),
 
-         begindate = decodeURIComponent(Request["dateT"]),
 
-         enddate = getDateFromCurrentDate(begindate);
 
-     loadListPromise();
 
-     
 
-     //上拉加载数据 
 
-     function pullUpAction(theScrollerTemp) { 
 
-         $(".pullUp").show();
 
-         setTimeout(function () {    
 
-             loadListPromise();      
 
-         }, 1000);
 
-     }
 
-     template.helper('toStatus', function(v){
 
-         if(v==60){return 'waiting'}
 
-         if(v==65 || v==61 || v==62 || v==69){return 'transport'}
 
-         if(v==100){return 'finish'}
 
-     })
 
-     $(".div-add-btn").click(function(){
 
-    		window.open('health-index-add-weight.html?dateT='+norTime);
 
-     });
 
-     
 
- function queryInit(type,begindate,enddate,page,pagesize){
 
-     var data = {
 
-         type:type,
 
-         page:page,
 
-         pagesize:pagesize,
 
-         start :begindate+" 00:00:00",
 
-         end:enddate+" 23:59:59"
 
-     };
 
-     console.log(begindate);
 
-     console.log(enddate);
 
-     
 
-     return new Promise(function(resolve, reject) {
 
-         //发送ajax请求
 
-             sendPost("patient/health_index/list", data, "json", "post", queryListFailed, function (res) {
 
-                 d.close();
 
-                 if (res.status == 200) {
 
-                     resolve(res)
 
-                 } else {
 
-                     queryListFailed(res);
 
-                 }
 
-             });
 
-         })
 
- }
 
- function loadListPromise () { 
 
-         page++;
 
-         Promise.all([ 
 
-             queryInit(3, getDateFromCurrentDate(norTime),norTime,page,pagesize)
 
-         ])
 
-         .then(function(res) {
 
-             $(".pullUp").hide();
 
-             var data = res[0];
 
-             if (data.list.length > 0) { 
 
-                 $('#j-card-list').append(template('list_tmp',{data:data.list}));
 
-                 scroller.myScroll.refresh();
 
-             } else {
 
-                 if(!isLoad) {
 
-                     dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'暂无数据'}).show();
 
-                 } else {
 
-                     dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'暂无更多数据'}).show();
 
-                 }
 
-             }
 
-             isLoad = true;
 
-         })
 
-         .catch(function(e) {
 
-             console && console.error(e)
 
-         });
 
-     }
 
- //失败提示
 
- function queryListFailed(res){ 
 
-     d.close();
 
-     if (res && res.msg) {
 
-         dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();      
 
-     } else {
 
-         dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show(); 
 
-     }
 
- }
 
- })
 
- //根据sd获取n天前的时间;
 
- function getDateFromCurrentDate(fromDate){
 
-     var curDate = new Date(Date.parse(fromDate.replace(/-/g,"/")));
 
-     curDate.setDate(curDate.getDate());
 
-     var year = curDate.getFullYear()-1;
 
-     var month = (curDate.getMonth()+1)<10?"0"+(curDate.getMonth()+1):(curDate.getMonth()+1);
 
-     var day = curDate.getDate()<10?"0"+curDate.getDate():curDate.getDate();
 
-     console.log(year+"-"+month+"-"+day);
 
-     return year+"-"+month+"-"+day; 
 
- }; 
 
 
  |