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

policy.js 7.8 KiB

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