var Request = GetRequest(); var scroller1 = null; var render = function(tmpl, data){ return tmpl.replace(/\{\{(\w+)\}\}/g, function(m, $1){ return data[$1]; }); }, //根据sd获取n天前的时间 getBeforeDate = function ( sd, n) { var n = n; var d = new Date(sd.replace(/\-/g, "/")); var year = d.getFullYear(); var mon=d.getMonth()+1; var day=d.getDate(); if(day <= n){ if(mon>1) { mon=mon-1; } else { year = year-1; mon = 12; } } d.setDate(d.getDate()-n); year = d.getFullYear(); mon=d.getMonth()+1; day=d.getDate(); s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day); return s; }, //半年前 halfYear = 365 / 2 * 24 * 3600 * 1000; $(function () { var $duringList = $('#duringList'), $qushiView = $('#qushiView'), $liebiaoView = $('#liebiaoView'), $xtEdit = $('.xt-edit'), $btns = $('.btns'), $cancelBtn = $('.cancel-btn'), $okBtn = $('.ok-btn'), $popMain = $('.pop-main'), $xtAdd = $('.xt-add'), $popBtns = $('.pop-btns'), $popEditBtn = $('.pop-edit-btn'), $popDelBtn = $('.pop-del-btn'), $popCancelBtn = $('.pop-cancel-btn'), isTrue = false, page = 0, pagesize = 10, $xyList = $('.xy-list-con'), $xyTmp = $('#xyTmp'); var begindate = '', enddate = ''; var charts = []; //判断最后的日期 sendPost("patient/health_record/recent", {}, "json", "get", function(){ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show(); }, function(res){ if(res.status == 200){ var d0 = decodeURIComponent(Request["dateT"]); if(res.data.diet){ var d1 = res.data.diet.recordDate var d2 = Date.parse(new Date(d0)) var d3 = Date.parse(new Date(d1)) if(d2 0) { $xyList.append(template('xyTmp',{data:data.list})); scroller1.myScroll.refresh(); } else { if(!isTrue) { dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'暂无数据'}).show(); $xtEdit.unbind('click'); } else { dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'暂无更多数据'}).show(); } } isTrue = true; }) .catch(function(e) { console && console.error(e) }); } })