农燊高科官方网站
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

policy.js 7.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "policyApi", "paging"], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //政策法规
  9. policyInformationList:'',
  10. //交易规则
  11. ruleInformationList:'',
  12. //资料下载
  13. downloadInformationList:'',
  14. //页码
  15. pageNum: 1,
  16. //页码集合
  17. pageList: [],
  18. //每页数量
  19. pageSize: 50,
  20. //总页数
  21. pageCount:0
  22. },
  23. };
  24. var tools = new Tools();
  25. module.init = function (page) {
  26. var type = getQueryVariable('type');
  27. if(type != undefined && type != ''){
  28. console.log('搜索进入')
  29. tabList(type);
  30. //政策法规
  31. tools.doGet(newList, {number:3,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  32. //交易规则
  33. tools.doGet(newList, {number:4,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  34. //资料下载
  35. tools.doGet(newList, {number:5,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  36. }else{
  37. console.log('正常进入')
  38. //政策法规
  39. tools.doGet(newList, {number:3,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  40. //交易规则
  41. tools.doGet(newList, {number:4,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  42. //资料下载
  43. tools.doGet(newList, {number:5,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  44. }
  45. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  46. tools.getWebConfig();
  47. };
  48. //获取地址栏参数
  49. function getQueryVariable(variable){
  50. var query = window.location.search.substring(1);
  51. var vars = query.split("&");
  52. for (var i=0;i<vars.length;i++) {
  53. var pair = vars[i].split("=");
  54. if(pair[0] == variable){return pair[1];}
  55. }
  56. return(false);
  57. }
  58. //政策法规数据
  59. module.policyInformation = function (data) {
  60. if (data.code == 200) {
  61. var content = data.rows;
  62. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  63. if (pageCount < 1){
  64. pageCount = 1;
  65. }
  66. if(module.data.policyInformationList == ''){
  67. // 初始化 分页器
  68. var page_s1=createPage('.page_s1');
  69. // 设置分页
  70. setPage(page_s1,{
  71. pageTotal: data.total, // 数据总条数
  72. pageSize: module.data.pageSize, // 每页显示条数
  73. pageCurrent: 1, // 当前页
  74. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  75. })
  76. $('#page_s1').html('共'+pageCount+'页')
  77. }
  78. module.data.pageCount = pageCount;
  79. module.data.policyInformationList = content;
  80. var policyInformationData = template('policyInformationData', module.data);
  81. $("#policyInformationContent").html(policyInformationData);
  82. }
  83. }
  84. //交易规则数据
  85. module.ruleInformation = function (data) {
  86. if (data.code == 200) {
  87. var content = data.rows;
  88. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  89. if (pageCount < 1){
  90. pageCount = 1;
  91. }
  92. if(module.data.ruleInformationList == ''){
  93. // 初始化 分页器
  94. var page_s1=createPage('.page_s2');
  95. // 设置分页
  96. setPage(page_s1,{
  97. pageTotal: data.total, // 数据总条数
  98. pageSize: module.data.pageSize, // 每页显示条数
  99. pageCurrent: 1, // 当前页
  100. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  101. })
  102. $('#page_s2').html('共'+pageCount+'页')
  103. }
  104. module.data.pageCount = pageCount;
  105. module.data.ruleInformationList = content;
  106. var ruleInformationData = template('ruleInformationData', module.data);
  107. $("#ruleInformationContent").html(ruleInformationData);
  108. }
  109. }
  110. //交易规则数据
  111. module.downloadInformation = function (data) {
  112. if (data.code == 200) {
  113. var content = data.rows;
  114. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  115. if (pageCount < 1){
  116. pageCount = 1;
  117. }
  118. if(module.data.downloadInformationList == ''){
  119. // 初始化 分页器
  120. var page_s1=createPage('.page_s3');
  121. // 设置分页
  122. setPage(page_s1,{
  123. pageTotal: data.total, // 数据总条数
  124. pageSize: module.data.pageSize, // 每页显示条数
  125. pageCurrent: 1, // 当前页
  126. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  127. })
  128. $('#page_s3').html('共'+pageCount+'页')
  129. }
  130. module.data.pageCount = pageCount;
  131. module.data.downloadInformationList = content;
  132. var downloadInformationData = template('downloadInformationData', module.data);
  133. $("#downloadInformationContent").html(downloadInformationData);
  134. }
  135. }
  136. tabList = function(type){
  137. console.log(type)
  138. document.getElementById('policyInformationContent').style.display = 'none';
  139. document.getElementById('ruleInformationContent').style.display = 'none';
  140. document.getElementById('downloadInformationContent').style.display = 'none';
  141. document.getElementById(type+'InformationContent').style.display = 'block';
  142. document.getElementById('policy').className = '';
  143. document.getElementById('rule').className = '';
  144. document.getElementById('download').className = '';
  145. document.getElementById(type).className = 'active';
  146. document.getElementById('policyNum').style.display = 'none';
  147. document.getElementById('ruleNum').style.display = 'none';
  148. document.getElementById('downloadNum').style.display = 'none';
  149. document.getElementById(type+'Num').style.display = 'block';
  150. module.data.clickType = type;
  151. module.data.pageNum = 1 ;
  152. }
  153. turnThePage = function (pageNum) {
  154. module.data.pageNum = pageNum ;
  155. if(module.data.clickType == 'policy'){
  156. tools.doGet(newList, {number:3,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  157. }
  158. if(module.data.clickType == 'rule'){
  159. tools.doGet(newList, {number:4,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  160. }
  161. if(module.data.clickType == 'download'){
  162. tools.doGet(newList, {number:5,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  163. }
  164. }
  165. return module;
  166. });