yunjianjihua.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. var self,
  2. doctorCode,
  3. patiCode;
  4. var $body = $('.yj-main');
  5. var saveData;
  6. mui.plusReady(function(){
  7. self = plus.webview.currentWebview();
  8. doctorCode = self.doctorCode;
  9. patiCode = self.patiCode;
  10. plus.nativeUI.showWaiting();
  11. sendPost("doctor/prenatalnspector/prenatalInspectorList",{patient:patiCode}, function(){
  12. plus.nativeUI.closeWaiting();
  13. mui.toast("请求失败");
  14. }, function(res){
  15. plus.nativeUI.closeWaiting();
  16. if(res.status == 200){
  17. if(res.list.length>0){
  18. saveData = res.list;
  19. var html = template('nav_tmp',{list:res.list});
  20. $body.html(html)
  21. bindEvent()
  22. bindEvent1()
  23. }else{
  24. $('#noChildSec').show();
  25. }
  26. }else{
  27. mui.toast("数据加载失败");
  28. }
  29. })
  30. })
  31. function bindEvent(){
  32. changeContent(0)
  33. //切换内容
  34. function changeContent(num){
  35. $('.yj-nav').find('li').eq(num).addClass('active').siblings().removeClass('active');
  36. var childPage = template('msg_tmp',{data:saveData[num],first:saveData[0].pregnancyStatus});
  37. $('#message').html(childPage)
  38. }
  39. //切换
  40. $('.yj-nav').on('tap','li',function(){
  41. var $this = $(this)
  42. if(!$this.hasClass('active')){
  43. $this.addClass('active').siblings().removeClass('active')
  44. changeContent($this.index())
  45. bindEvent1()
  46. }
  47. })
  48. //区域滚动
  49. mui('.j-nav-select').scroll({
  50. scrollY: false, //是否竖向滚动
  51. scrollX: true, //是否横向滚动
  52. })
  53. $body.on("tap", ".uncheck-remind", function(e) {
  54. var prenatalId = $(this).attr("data-code");
  55. remindResident(prenatalId);
  56. });
  57. $body.on("tap", ".remindAgain", function(e) {
  58. var prenatalId = $(this).attr("data-code");
  59. remindResident(prenatalId,true);
  60. });
  61. }
  62. function remindResident(prenatalId,remindAgain){
  63. plus.nativeUI.showWaiting();
  64. sendPost("/doctor/prenatalnspector/sendPrenatal", {prenatalId: prenatalId,patient:patiCode,doctor:doctorCode}, null, function(res){
  65. plus.nativeUI.closeWaiting();
  66. if(res.status == 200){
  67. if(remindAgain){
  68. $(".remindAgain").removeClass("remind-true").html("已提醒").addClass("remind-false");
  69. }else{
  70. $(".uncheck-remind").removeClass("remind-true").html("已提醒").addClass("remind-false");
  71. }
  72. mui.toast(res.msg);
  73. }
  74. else {
  75. mui.toast(res.msg);
  76. }
  77. })
  78. }
  79. function bindEvent1(){
  80. //结果
  81. $('.check_result').on('tap',function(){
  82. mui.openWindow({
  83. id: "chanjianjieguo",
  84. url: "chanjianjieguo.html",
  85. extras: {
  86. pregnancyNo:$(this).attr('data-id'),
  87. patient:patiCode
  88. }
  89. })
  90. })
  91. //展开和关闭
  92. $('.j-up').on('tap',function(){
  93. var $this = $(this).parent()
  94. if($this.hasClass('active')){
  95. $this.removeClass('active')
  96. }else{
  97. $this.addClass('active')
  98. }
  99. })
  100. $('.yj-section').find('li').eq(0).addClass('active')
  101. }