网站
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

demand.js 6.3 KiB

2 년 전
2 년 전
2 년 전
4 년 전
2 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "demandApi", "paging", 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. //公告列表
  11. demandInformationList:'',
  12. //鉴证列表
  13. supplyInformationList:'',
  14. //页码
  15. pageNum: 1,
  16. //页码集合
  17. pageList: [],
  18. //每页数量
  19. pageSize: 50,
  20. //总页数
  21. pageCount:0,
  22. //选中卡ID
  23. clickType:'supply',
  24. //供求类型 1:供应 2:求购 (不传值获取两种类型混合数据)
  25. demandType:1
  26. },
  27. };
  28. var tools = new Tools();
  29. module.init = function (page) {
  30. //获取焦点图信息
  31. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  32. //底部友情链接
  33. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  34. //个人供应
  35. tools.doGet(
  36. demandList,
  37. {
  38. deptId:100,
  39. pageNum:module.data.pageNum,
  40. pageSize:module.data.pageSize,
  41. supplyDemandType:1
  42. },
  43. module.supplyInformation,true
  44. );
  45. //个人需求
  46. tools.doGet(
  47. demandList,
  48. {
  49. deptId:100,
  50. pageNum:module.data.pageNum,
  51. pageSize:module.data.pageSize,
  52. supplyDemandType:2
  53. },
  54. module.demandInformation,true
  55. );
  56. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  57. tools.getWebConfig();
  58. };
  59. //焦点图数据
  60. module.focusNewsTop = function (data) {
  61. if (data.code == 200) {
  62. module.data.focusListTop = data.data;
  63. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  64. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  65. new Swiper('#bannerFocusWrapTop', {
  66. paginationClickable: true,
  67. autoplay : 4000,
  68. loop:true
  69. })
  70. }
  71. }
  72. //底部友情链接
  73. module.bottomFriendsLinks = function (data) {
  74. if (data.code == 200) {
  75. var content = data.data;
  76. console.log(content)
  77. module.data.friendsLinksList = content;
  78. var friendsLinksData = template('friendsLinksData', module.data);
  79. $("#friendsLinksContent").html(friendsLinksData);
  80. }
  81. }
  82. //个人供求数据
  83. module.supplyInformation = function (data) {
  84. if (data.code == 200) {
  85. console.log(data)
  86. var content = data.rows;
  87. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  88. if (pageCount < 1){
  89. pageCount = 1;
  90. }
  91. if(module.data.supplyInformationList == ''){
  92. // 初始化 分页器
  93. var page_s1=createPage('.page_s1');
  94. // 设置分页
  95. setPage(page_s1,{
  96. pageTotal: data.total, // 数据总条数
  97. pageSize: module.data.pageSize, // 每页显示条数
  98. pageCurrent: 1, // 当前页
  99. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  100. })
  101. $('#page_s1').html('共'+pageCount+'页')
  102. }
  103. module.data.pageCount = pageCount;
  104. module.data.supplyInformationList = content;
  105. var supplyInformationData = template('supplyInformationData', module.data);
  106. $("#supply").html(supplyInformationData);
  107. }
  108. }
  109. //个人需求数据
  110. module.demandInformation = function (data) {
  111. if (data.code == 200) {
  112. var content = data.rows;
  113. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  114. if (pageCount < 1){
  115. pageCount = 1;
  116. }
  117. if(module.data.demandInformationList == ''){
  118. // 初始化 分页器
  119. var page_s1=createPage('.page_s2');
  120. // 设置分页
  121. setPage(page_s1,{
  122. pageTotal: data.total, // 数据总条数
  123. pageSize: module.data.pageSize, // 每页显示条数
  124. pageCurrent: 1, // 当前页
  125. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  126. })
  127. $('#page_s2').html('共'+pageCount+'页')
  128. }
  129. module.data.pageCount = pageCount;
  130. module.data.demandInformationList = content;
  131. var demandInformationData = template('demandInformationData', module.data);
  132. $("#demand").html(demandInformationData);
  133. }
  134. }
  135. tabCheck = function (type) {
  136. document.getElementById('supply').style.display = 'none';
  137. document.getElementById('demand').style.display = 'none';
  138. document.getElementById(type).style.display = 'inline-table';
  139. document.getElementById('supplyBtn').className = '';
  140. document.getElementById('demandBtn').className = '';
  141. document.getElementById(type+'Btn').className = 'active';
  142. module.data.clickType = type ;
  143. }
  144. turnThePage = function (pageNum) {
  145. module.data.pageNum = pageNum ;
  146. if(module.data.clickType == 'supply'){
  147. //个人供应
  148. tools.doGet(
  149. demandList,
  150. {
  151. deptId:100,
  152. pageNum:module.data.pageNum,
  153. pageSize:module.data.pageSize,
  154. supplyDemandType:1
  155. },
  156. module.supplyInformation,true
  157. );
  158. }
  159. if(module.data.clickType == 'demand'){
  160. //个人需求
  161. tools.doGet(
  162. demandList,
  163. {
  164. deptId:100,
  165. pageNum:module.data.pageNum,
  166. pageSize:module.data.pageSize,
  167. supplyDemandType:2
  168. },
  169. module.demandInformation,true
  170. );
  171. }
  172. }
  173. goUserDemand = function () {
  174. tools.skip('../user/user.html?type=goDemand')
  175. }
  176. return module;
  177. });