暫無描述

tab0430.js 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. window.onload = function() {
  2. mui.plusReady(function() {
  3. var token = localStorage.getItem("token");
  4. var page = 1; //页数
  5. var pageSize = 10; //每页显示条目
  6. var keyw="";
  7. plus.nativeUI.closeWaiting();
  8. //显示当前页面
  9. mui.currentWebview.show();
  10. Ajax();
  11. $('.go_search').on('input focus', function() {
  12. keyw = $(this).val();
  13. page = 1;
  14. Ajax(keyw);
  15. });
  16. mui.init({
  17. swipeBack: false,
  18. pullRefresh: {
  19. container: '#pullrefresh',
  20. up: {
  21. contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
  22. contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
  23. callback: pullupRefresh
  24. }
  25. },
  26. beforeback: function() {
  27. var list = plus.webview.currentWebview().opener();    
  28. //refresh是A页面自定义事件
  29. mui.fire(list, 'refreshPer');
  30. //返回true,继续页面关闭逻辑
  31. return true;
  32. }
  33. });
  34. function pullupRefresh() {
  35. setTimeout(function() {
  36. mui('#pullrefresh').pullRefresh().endPullupToRefresh((page++ >= Math.ceil(total / 10)));
  37. mui.ajax(huayi.config.callcenter_url + '/AddressBook/GetAppModelList', {
  38. data: {
  39. token: token,
  40. pageindex:page,
  41. pagesize:pageSize
  42. },
  43. dataType: 'json', //服务器返回json格式数据
  44. type: 'get', //HTTP请求类型
  45. timeout: 10000, //超时时间设置为10秒;
  46. headers: {
  47. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  48. },
  49. success: function(data) {
  50. if (data.state = "success") {
  51. var html="";
  52. //$(".orderLi").remove();
  53. //alert(JSON.stringify(data))
  54. if (data.length > 0) {
  55. total = data.length;
  56. for (var i=0; i<data.length; i++) {
  57. html = '<li data-group="' + data[i].code + '" data-value="' + data[i].NameOneCode + '" data-tags="' + data[i].NameOneCode +
  58. '" class="mui-table-view-cell mui-indexed-list-item orderLi">' +
  59. '<div class="mui-slider-cell">' +
  60. '<a href="tel:' + data[i].F_Mobile + '">' +
  61. '<div class="oa-contact-cell mui-table">' +
  62. '<div class="oa-contact-avatar mui-table-cell">' +
  63. '<img src="img/2.png"/>' +
  64. '</div>' +
  65. '<div class="oa-contact-content mui-table-cell">' +
  66. '<h4 class="oa-contact-name size-14">' + data[i].F_Name +
  67. '<span class="oa-contact-position mui-h6">' + data[i].F_Area + "-" + data[i].F_Offce + "-" + data[i].F_Position +
  68. '</span></h4>' +
  69. '<h4 class="oa-contact-email mui-h5">' + data[i].F_Mobile + '</h4>' +
  70. '</div>' +
  71. '</div>' +
  72. '</a>' +
  73. '</div>' +
  74. '</li>';
  75. $(html).appendTo($(".tabalList"));
  76. }
  77. }
  78. }
  79. },
  80. error: function(xhr, type, errorThrown) {}
  81. })
  82. }, 1000);
  83. }
  84. function Ajax() {
  85. page=1;
  86. pageSize=10;
  87. mui.ajax(huayi.config.callcenter_url + '/AddressBook/GetAppModelList', {
  88. data: {
  89. token: localStorage.getItem('token'),
  90. pageindex:1,
  91. pagesize:10
  92. },
  93. dataType: 'json', //服务器返回json格式数据
  94. type: 'post', //HTTP请求类型
  95. timeout: 10000, //超时时间设置为10秒
  96. success: function(data) {
  97. if (data.state = "success") {
  98. var html="";
  99. if(data.length==0) {
  100. $(".noWork").show();
  101. }
  102. if (data.length > 0) {
  103. total = data.length;
  104. for (var i=0; i<data.length; i++) {
  105. html = '<li data-group="' + data[i].code + '" data-value="' + data[i].NameOneCode + '" data-tags="' + data[i].NameOneCode +
  106. '" class="mui-table-view-cell mui-indexed-list-item">' +
  107. '<div class="mui-slider-cell">' +
  108. '<a href="tel:' + data[i].F_Mobile + '">' +
  109. '<div class="oa-contact-cell mui-table">' +
  110. '<div class="oa-contact-avatar mui-table-cell">' +
  111. '<img src="img/2.png"/>' +
  112. '</div>' +
  113. '<div class="oa-contact-content mui-table-cell">' +
  114. '<h4 class="oa-contact-name size-14">' + data[i].F_Name +
  115. '<span class="oa-contact-position mui-h6">' + data[i].F_Area + "-" + data[i].F_Offce + "-" + data[i].F_Position +
  116. '</span></h4>' +
  117. '<h4 class="oa-contact-email mui-h5">' + data[i].F_Mobile + '</h4>' +
  118. '</div>' +
  119. '</div>' +
  120. '</a>' +
  121. '</div>' +
  122. '</li>';
  123. $(html).appendTo($(".tabalList"));
  124. }
  125. }
  126. }
  127. },
  128. error: function(xhr, type, errorThrown) {}
  129. });
  130. }
  131. });
  132. }