my_work_team.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. mui.plusReady(function() {
  2. // mui(".c-list").on("tap", "li", function() {
  3. // openWebview("my-doctor-advice-detail.html");
  4. // });
  5. //查询列表
  6. // clearHTML();
  7. queryList();
  8. });
  9. function queryList() {
  10. plus.nativeUI.showWaiting();
  11. //拼请求内容
  12. var params = {};
  13. //发送ajax请求
  14. sendPost("doctor/team/list", params,queryListFailed, queryListSuccesss);
  15. }
  16. function queryListFailed(res) {
  17. if (res && res.msg) {
  18. plus.nativeUI.toast(res.msg);
  19. } else {
  20. plus.nativeUI.toast("数据加载失败");
  21. }
  22. plus.nativeUI.closeWaiting();
  23. }
  24. function queryListSuccesss(res) {
  25. if (res.status == 200) {
  26. //成功
  27. showList(res.list);
  28. } else {
  29. //非200则为失败
  30. queryListFailed(res);
  31. }
  32. plus.nativeUI.closeWaiting();
  33. }
  34. /**
  35. * 清空tbody
  36. */
  37. function clearHTML() {
  38. $("#my_work_team").html("");
  39. }
  40. /**
  41. * 显示查询结果
  42. * @param {Object} list
  43. */
  44. function showList(list) {
  45. // clearHTML();
  46. var _html = "";
  47. var arry1=[];
  48. for (var i = 0; i < list.length; i++) {
  49. var data = list[i];
  50. _html+="<div class='patient-list'>"
  51. _html+= "<div class='patient-type'>"
  52. _html+= "<div class='arrow'> <i class='ui-arrow ui-arrow-b'></i></div>"
  53. _html+= "<h3 class='t c-f14'>"+data.name+"<em class='c-ccc ml10 c-f10'><!--(3人)--></em></h3>"
  54. _html+= "</div>"
  55. _html+= "<ul id='doc_ul' class='n-list'></ul>"
  56. _html+="</div>"
  57. arry1.push(_html);
  58. }
  59. $("#my_work_team").html(_html);
  60. for (var i=0;i<list.length;i++){
  61. var data1 = list[i];
  62. var _html2 = "";
  63. var my_work_team_ul=$("#my_work_team>div:eq("+i+")>ul:eq(0)");
  64. for(var j=0;j<data1.doctors.length;j++){
  65. var data_doc=data1.doctors[j];
  66. var data_doc_type="";
  67. switch(data_doc.type)
  68. {
  69. case 1:
  70. data_doc_type="专科医生";
  71. break;
  72. case 2:
  73. data_doc_type="全科医生";
  74. break;
  75. case 3:
  76. data_doc_type="健康管理师";
  77. break;
  78. }
  79. if(data_doc.photo==null ||data_doc.photo==""){
  80. data_doc.photo="../images/d-default.png";
  81. }
  82. _html2+="<li class='n-list-link' attr_code='"+data_doc.code+"' list-arrow-r n-list-cover' >"
  83. _html2+= "<div class='patient-face'><img src='"+data_doc.photo+"' /></div>"
  84. _html2+= "<div class='n-list-info'>"
  85. _html2+= "<h4 class='c-nowrap c-f14'>"+data_doc.name+"<em class='ml5 c-f12 c-909090'><!--男45岁--></em></h4>"
  86. _html2+= "<p class='c-f12 c-909090 pt5'>"+data_doc_type+"</p>"
  87. _html2+= "<em class='red-point'></em> </div>"
  88. _html2+= "<div class='n-list-info c-t-right c-909090'><!--16-02-15--></div>"
  89. _html2+="</li>"
  90. }
  91. my_work_team_ul.html(_html2);
  92. }
  93. /* 展开居民列表 */
  94. $(".patient-type").on('click', function() {
  95. var $this = $(this);
  96. if ($this.parent('.patient-list').hasClass("current")) {
  97. $this.find('.arrow').removeClass('open');
  98. $this.next(".n-list").hide().parent('.patient-list').removeClass("current");
  99. $this.siblings().find('.n-list').hide();
  100. $this.siblings().find('.patient-list').removeClass('current');
  101. $this.siblings().find('.arrow').removeClass('open');
  102. } else {
  103. $this.find('.arrow').addClass('open');
  104. $this.next(".n-list").show().parent('.patient-list').addClass("current");
  105. };
  106. })
  107. mui("body").on("tap",".n-list-link",function () {
  108. var doc_code=$(this).attr("attr_code");
  109. mui.openWindow({
  110. url: "zuyuanziliao.html",
  111. id:"zuyuanziliao",
  112. extras: {
  113. code:doc_code,
  114. },
  115. });
  116. })
  117. }
  118. // $("#Id_work_team").html(_html);
  119. //
  120. // $("#Id_work_team").on("click","li",function(){
  121. // var attr_code = $(this).attr('attr_code');
  122. // var attr_first_doc = $(this).attr('attr_first_doc');
  123. // var attr_icon = $(this).attr('attr_icon');
  124. // var attr_name = $(this).attr('attr_name');
  125. //
  126. // mui.openWindow({
  127. // url: "../../message/html/qunzu_duihua.html",
  128. // id:"qunzu_duihua",
  129. // extras: {
  130. // code:attr_code,
  131. // first_doc:attr_first_doc,
  132. // icon:attr_icon,
  133. // name:attr_name,
  134. // }
  135. // });
  136. //
  137. // });
  138. //
  139. //添加数据添加监听
  140. window.addEventListener("update_info", function(e) {
  141. clearHTML();
  142. //刷新列表
  143. queryList();
  144. });