暫無描述

tab.js 4.6KB

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