xufangxiaoxi.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. var postUrl = "doctor/message/getPrescriptionMessage";
  2. var pagesize = 10;
  3. var curpage = 1;
  4. var type;
  5. mui.plusReady(function() {
  6. backParent();
  7. plus.nativeUI.showWaiting();
  8. self = plus.webview.currentWebview();
  9. type = self.type;
  10. queryData();
  11. })
  12. function queryData() {
  13. sendGet(postUrl, {
  14. page: curpage,
  15. pagesize: pagesize,
  16. type: type
  17. }, null, function(res) {
  18. if(res.status == 200) {
  19. console.log(res)
  20. plus.nativeUI.closeWaiting();
  21. if(res.list.length < pagesize) { //加载更多按钮显示隐藏
  22. $("#load_more").closest(".view-more").hide();
  23. }
  24. if(res.list.length == 0) {
  25. $("#wushuju").removeClass("c-hide");
  26. return;
  27. }
  28. if(!$("#wushuju").hasClass("c-hide")) {
  29. !$("#wushuju").addClass("c-hide");
  30. }
  31. var cont = template("sign_tmpl", res);
  32. $("#sign_list").html(cont);
  33. $("#load_more").removeClass("c-hide");
  34. } else {
  35. mui.toast("加载消息出错!");
  36. }
  37. })
  38. }
  39. function backParent() {
  40. var old_back = mui.back;
  41. mui.back = function() {
  42. var self = plus.webview.currentWebview();
  43. if(self.opener && self.opener()) {
  44. mui.fire(self.opener(), "refresh");
  45. }
  46. old_back();
  47. }
  48. }
  49. $("#load_more").click(function() {
  50. var $this = $(this);
  51. var id = $("#sign_list").children("ul").last().attr("data-id");
  52. curpage++;
  53. sendGet(postUrl, {
  54. page: curpage,
  55. pagesize: pagesize,
  56. type: type
  57. }, null, function(res) {
  58. if(res.status == 200) {
  59. if(res.list.length < pagesize) {
  60. $this.text("无更多记录");
  61. $("#load_more").off('click')
  62. }
  63. var cont = template("sign_tmpl", res);
  64. $("#sign_list").append(cont);
  65. }
  66. })
  67. })
  68. mui("#sign_list").on("tap", "ul", function() {
  69. var type = this.getAttribute("data-type");
  70. var code = this.getAttribute("data-sessionId");
  71. var name = this.getAttribute("data-sessionName");
  72. var pcode = this.getAttribute("data-pcode");
  73. var tcode = this.getAttribute("data-tcode");
  74. if(type == 6) {
  75. var Url = '../../message/html/xufangzixun.html';
  76. mui.openWindow(Url, 'xufangzixun', {
  77. extras: {
  78. type: type,
  79. sessionId: code,
  80. sessionName: name
  81. }
  82. });
  83. }
  84. if(type == 7) {
  85. var Url = 'dingdangenzong.html';
  86. mui.openWindow(Url, 'dingdangenzong', {
  87. extras: {
  88. prescriptionCode: pcode,
  89. teamCode: tcode
  90. }
  91. })
  92. }
  93. })
  94. window.addEventListener("refreshPage", function() {
  95. curpage = 1
  96. $("#sign_list").empty()
  97. queryData()
  98. });