暫無描述

tab.js 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. $.ajax({
  34. url: huayi.config.callcenter_url + '/AddressBook/GetAppModelList',
  35. data: {
  36. token: token,
  37. keywords: keyw,
  38. pageindex: page,
  39. pagesize: pageSize
  40. },
  41. dataType: 'json', //服务器返回json格式数据
  42. type: 'get', //HTTP请求类型
  43. timeout: 10000, //超时时间设置为10秒;
  44. headers: {
  45. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  46. },
  47. success: function(data) {
  48. if (data.state = "success") {
  49. var html = "";
  50. //$(".orderLi").remove();
  51. //alert(JSON.stringify(data))
  52. if (data.length > 0) {
  53. for (var i = 0; i < data.length; i++) {
  54. html = '<li data-group="' + data[i].code + '" data-value="' + data[i].NameOneCode + '" data-tags="' +
  55. data[i].NameOneCode +
  56. '" class="mui-table-view-cell mui-indexed-list-item orderLi">' +
  57. '<div class="mui-slider-cell">' +
  58. '<a href="tel:' + data[i].F_Mobile + '">' +
  59. '<div class="oa-contact-cell mui-table">' +
  60. '<div class="oa-contact-avatar mui-table-cell">' +
  61. '<img src="img/2.png"/>' +
  62. '</div>' +
  63. '<div class="oa-contact-content mui-table-cell">' +
  64. '<h4 class="oa-contact-name size-14">' + data[i].F_Name +
  65. '<span class="oa-contact-position mui-h6">' + data[i].F_Area + "-" + data[i].F_Offce + "-" + data[i].F_Position +
  66. '</span></h4>' +
  67. '<h4 class="oa-contact-email mui-h5">' + data[i].F_Mobile + '</h4>' +
  68. '</div>' +
  69. '</div>' +
  70. '</a>' +
  71. '</div>' +
  72. '</li>';
  73. $(html).appendTo($(".tabalList"));
  74. }
  75. }
  76. }
  77. },
  78. error: function(xhr, type, errorThrown) {}
  79. })
  80. }, 1000);
  81. }
  82. function Ajax() {
  83. var role = localStorage.getItem("F_RoleCode");
  84. if(['XTGLY', 'ZR'].includes(role)) {
  85. console.log(role, 'RoleCode')
  86. $('.statics-icon').css('display', '')
  87. }
  88. $(".tabli").remove()
  89. page = 1;
  90. pageSize = 10;
  91. $.ajax({
  92. url: huayi.config.callcenter_url + '/AddressBook/GetAppModelList',
  93. data: {
  94. token: localStorage.getItem('token'),
  95. keywords: keyw,
  96. pageindex: 1,
  97. pagesize: 10
  98. },
  99. dataType: 'json', //服务器返回json格式数据
  100. type: 'post', //HTTP请求类型
  101. timeout: 10000, //超时时间设置为10秒
  102. success: function(data) {
  103. if (data.state = "success") {
  104. var html = "";
  105. if (data.length == 0) {
  106. $(".noWork").show();
  107. }
  108. if (data.length > 0) {
  109. for (var i = 0; i < data.length; i++) {
  110. html = '<li data-group="' + data[i].code + '" data-value="' + data[i].NameOneCode + '" data-tags="' + data[
  111. i].NameOneCode +
  112. '" class="mui-table-view-cell mui-indexed-list-item tabli">' +
  113. '<div class="mui-slider-cell">' +
  114. '<a href="tel:' + data[i].F_Mobile + '">' +
  115. '<div class="oa-contact-cell mui-table">' +
  116. '<div class="oa-contact-avatar mui-table-cell">' +
  117. '<img src="img/2.png"/>' +
  118. '</div>' +
  119. '<div class="oa-contact-content mui-table-cell">' +
  120. '<h4 class="oa-contact-name size-14">' + data[i].F_Name +
  121. '<span class="oa-contact-position mui-h6">' + data[i].F_Area + "-" + data[i].F_Offce + "-" + data[i].F_Position +
  122. '</span></h4>' +
  123. '<h4 class="oa-contact-email mui-h5">' + data[i].F_Mobile + '</h4>' +
  124. '</div>' +
  125. '</div>' +
  126. '</a>' +
  127. '</div>' +
  128. '</li>';
  129. $(html).appendTo($(".tabalList"));
  130. }
  131. }
  132. }
  133. },
  134. error: function(xhr, type, errorThrown) {}
  135. });
  136. }