网站
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

demand.js 7.2 KiB

2 anos atrás
2 anos atrás
2 anos atrás
3 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
3 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
2 anos atrás
2 anos atrás
4 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. let focusArray = [];
  63. if(data.data.length<1){
  64. focusArray.push({
  65. picUrl:'../../../static/images/banner1.png'
  66. },{
  67. picUrl:'../../../static/images/banner2.png'
  68. },{
  69. picUrl:'../../../static/images/banner3.png'
  70. })
  71. }else{
  72. data.data.forEach(res=>{
  73. focusArray.push({
  74. picUrl:'/api'+res.picUrl
  75. })
  76. })
  77. }
  78. module.data.focusListTop = focusArray;
  79. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  80. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  81. new Swiper('#bannerFocusWrapTop', {
  82. paginationClickable: true,
  83. autoplay : 4000,
  84. loop:true
  85. })
  86. }
  87. }
  88. //底部友情链接
  89. module.bottomFriendsLinks = function (data) {
  90. if (data.code == 200) {
  91. var content = data.data;
  92. console.log(content)
  93. module.data.friendsLinksList = content;
  94. var friendsLinksData = template('friendsLinksData', module.data);
  95. $("#friendsLinksContent").html(friendsLinksData);
  96. }
  97. }
  98. //个人供求数据
  99. module.supplyInformation = function (data) {
  100. if (data.code == 200) {
  101. console.log(data)
  102. var content = data.rows;
  103. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  104. if (pageCount < 1){
  105. pageCount = 1;
  106. }
  107. if(module.data.supplyInformationList == ''){
  108. // 初始化 分页器
  109. var page_s1=createPage('.page_s1');
  110. // 设置分页
  111. setPage(page_s1,{
  112. pageTotal: data.total, // 数据总条数
  113. pageSize: module.data.pageSize, // 每页显示条数
  114. pageCurrent: 1, // 当前页
  115. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  116. })
  117. $('#page_s1').html('共'+pageCount+'页')
  118. }
  119. module.data.pageCount = pageCount;
  120. module.data.supplyInformationList = content;
  121. var supplyInformationData = template('supplyInformationData', module.data);
  122. $("#supply").html(supplyInformationData);
  123. }
  124. }
  125. //个人需求数据
  126. module.demandInformation = function (data) {
  127. if (data.code == 200) {
  128. var content = data.rows;
  129. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  130. if (pageCount < 1){
  131. pageCount = 1;
  132. }
  133. if(module.data.demandInformationList == ''){
  134. // 初始化 分页器
  135. var page_s1=createPage('.page_s2');
  136. // 设置分页
  137. setPage(page_s1,{
  138. pageTotal: data.total, // 数据总条数
  139. pageSize: module.data.pageSize, // 每页显示条数
  140. pageCurrent: 1, // 当前页
  141. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  142. })
  143. $('#page_s2').html('共'+pageCount+'页')
  144. }
  145. module.data.pageCount = pageCount;
  146. module.data.demandInformationList = content;
  147. var demandInformationData = template('demandInformationData', module.data);
  148. $("#demand").html(demandInformationData);
  149. }
  150. }
  151. tabCheck = function (type) {
  152. document.getElementById('supply').style.display = 'none';
  153. document.getElementById('demand').style.display = 'none';
  154. document.getElementById(type).style.display = 'inline-table';
  155. document.getElementById('supplyBtn').className = '';
  156. document.getElementById('demandBtn').className = '';
  157. document.getElementById(type+'Btn').className = 'active';
  158. module.data.clickType = type ;
  159. }
  160. turnThePage = function (pageNum) {
  161. module.data.pageNum = pageNum ;
  162. if(module.data.clickType == 'supply'){
  163. //个人供应
  164. tools.doGet(
  165. demandList,
  166. {
  167. deptId:100,
  168. pageNum:module.data.pageNum,
  169. pageSize:module.data.pageSize,
  170. supplyDemandType:1
  171. },
  172. module.supplyInformation,true
  173. );
  174. }
  175. if(module.data.clickType == 'demand'){
  176. //个人需求
  177. tools.doGet(
  178. demandList,
  179. {
  180. deptId:100,
  181. pageNum:module.data.pageNum,
  182. pageSize:module.data.pageSize,
  183. supplyDemandType:2
  184. },
  185. module.demandInformation,true
  186. );
  187. }
  188. }
  189. goUserDemand = function () {
  190. if(tools.getCookie('Admin-Token')){
  191. tools.skip('../user/user.html?type=goDemand')
  192. }else{
  193. tools.initDialog('登录提示', '登录后可参与发布,是否登录?', function () {
  194. tools.skip('../login/login.html')
  195. }, '登录', function () { }, "取消")
  196. }
  197. }
  198. return module;
  199. });