网站
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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