tizhong.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. function queryList3(page,pageSize) {
  2. //显示进度条
  3. // plus.nativeUI.showWaiting();
  4. //发送请求
  5. queryListByType(3,page, pageSize, queryListSuccesss2,begindate,enddate);
  6. }
  7. /**
  8. * 健康指标图表查询成功处理方法
  9. */
  10. function queryListSuccesss2(res) {
  11. if (res.status == 200) {
  12. d.close();
  13. if (res.list.length > 0) {
  14. //成功
  15. showList2(res.list);
  16. if(res.list.length<10){
  17. $("#view_more3").hide();
  18. }else{
  19. $("#view_more3").show();
  20. }
  21. }else{
  22. //无更多数据
  23. $("#view_more3").hide();
  24. }
  25. } else {
  26. //非200则为失败
  27. queryListFailed(res);
  28. }
  29. // plus.nativeUI.closeWaiting();
  30. }
  31. /**
  32. * 显示查询结果
  33. * @param {Object} list
  34. */
  35. function showList2(list) {
  36. page = page+1;
  37. for (var i = 0; i < list.length; i++) {
  38. var data = list[i];
  39. if (!data) {
  40. continue;
  41. }
  42. addRow2(data.date.substr(5, 5), toIntValue(data.value1));
  43. }
  44. setTimeout(function () {
  45. scroller1.myScroll.refresh();
  46. }, 1000);
  47. }
  48. /**
  49. * 体重
  50. * tbody添加一行tr
  51. * @param {Object} dateStr
  52. * @param {Object} value1
  53. * @param {Object} value2
  54. */
  55. function addRow2(dateStr, value1) {
  56. if (dateStr.length > 5) {
  57. dateStr = dateStr.substr(5, 5);
  58. }
  59. if(dateStr){
  60. dateStr = dateStr.replace("-",".");
  61. }
  62. var tb = document.querySelector("#item2");
  63. var tr = document.createElement("tr");
  64. var html = '<td class="width-30 c-color">' + dateStr + '</td>';
  65. html += '<td class="width-70 c-color">' + value1 + '</td>';
  66. tr.innerHTML = html;
  67. tb.appendChild(tr);
  68. }