my-doctor-advice.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. mui.plusReady(function() {
  2. // mui(".c-list").on("tap", "li", function() {
  3. // openWebview("my-doctor-advice-detail.html");
  4. // });
  5. //查询列表
  6. //queryList();
  7. });
  8. function queryList() {
  9. plus.nativeUI.showWaiting();
  10. //拼请求内容
  11. var params = {};
  12. params.page = 1;
  13. params.pageSize = 10;
  14. //发送ajax请求
  15. sendPost("patient/doctor_orders/doctot_list", params, "json", "post", queryListFailed, queryListSuccesss);
  16. }
  17. function queryListFailed(res) {
  18. console.log(res.status);
  19. if (res && res.msg) {
  20. plus.nativeUI.toast(res.msg);
  21. } else {
  22. plus.nativeUI.toast("数据加载失败");
  23. }
  24. plus.nativeUI.closeWaiting();
  25. }
  26. function queryListSuccesss(res) {
  27. if (res.status == 200) {
  28. //成功
  29. showList(res.data.list);
  30. } else {
  31. //非200则为失败
  32. queryListFailed(res);
  33. }
  34. plus.nativeUI.closeWaiting();
  35. }
  36. /**
  37. * 显示查询结果
  38. * @param {Object} list
  39. */
  40. function showList(list) {
  41. var _html = "";
  42. for (var i = 0; i < list.length; i++) {
  43. var data = list[i];
  44. if (!data) {
  45. continue;
  46. }
  47. //addRow(data.content, data.czrq);
  48. _html+="<li class='c-list-cover' attr_content='"+data.doc_code+"'>";
  49. _html+="<div class='c-avatar-m'>";
  50. _html+="<img class='c-images-cycle' src='../../../images/d-default.png'>";
  51. _html+="</div>";
  52. _html+="<div class='c-list-info ptb10'>";
  53. _html+="<h4 class='c-nowrap'>";
  54. _html+=data.doc_name;
  55. _html+="<span class='title'>"+data.job+"</span>";
  56. _html+="<span class='ml5 c-666 c-f12'>"+data.dept+"</span>";
  57. _html+="</h4>";
  58. _html+="<p>"+data.hospital+"</p>";
  59. _html+="</div>";
  60. // _html+="<div class='c-list-value' style='margin-right:10px; '>"+data.time.substring(0, 10)+"</div>";
  61. _html+="</li>";
  62. }
  63. $("#ul_order").html(_html);
  64. $("#ul_order").on("click","li",function(){
  65. var content = $(this).attr('attr_content');
  66. mui.openWindow({
  67. url: "my-doctor-advice_1.html",
  68. extras: {
  69. doctor: content
  70. },
  71. });
  72. })
  73. }
  74. function li_click(content){
  75. mui.openWindow({
  76. url: "my-doctor-advice-detail.html",
  77. extras: {
  78. content: content
  79. },
  80. });
  81. }
  82. function addRow(content, czrq) {
  83. var ul = document.querySelector("#item");
  84. var li = document.createElement("li");
  85. li.className = "c-list-text";
  86. li.onclick = function() {
  87. mui.openWindow({
  88. url: "my-doctor-advice-detail.html",
  89. extras: {
  90. content: content
  91. },
  92. });
  93. };
  94. var html = '<div class="c-list-info">';
  95. html += '<h4 class="c-nowrap">' + content + '</h4></div>'
  96. html += '<div class="c-list-value">' + czrq.substring(0, 10) + '</div>';
  97. li.innerHTML = html;
  98. ul.appendChild(li);
  99. }