网站
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.
 
 
 

232 linhas
9.1 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "policyApi", "paging", 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. //政策法规
  11. policyInformationList:'',
  12. //交易规则
  13. ruleInformationList:'',
  14. //资料下载
  15. downloadInformationList:'',
  16. //页码
  17. pageNum: 1,
  18. //页码集合
  19. pageList: [],
  20. //每页数量
  21. pageSize: 50,
  22. //总页数
  23. pageCount:0
  24. },
  25. };
  26. var tools = new Tools();
  27. module.init = function (page) {
  28. //获取焦点图信息
  29. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  30. //底部友情链接
  31. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  32. var type = getQueryVariable('type');
  33. if(type != undefined && type != ''){
  34. console.log('搜索进入')
  35. tabList(type);
  36. //政策法规
  37. tools.doGet(newList, {number:3,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  38. //交易规则
  39. tools.doGet(newList, {number:4,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  40. //资料下载
  41. tools.doGet(newList, {number:5,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  42. }else{
  43. console.log('正常进入')
  44. //政策法规
  45. tools.doGet(newList, {number:3,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  46. //交易规则
  47. tools.doGet(newList, {number:4,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  48. //资料下载
  49. tools.doGet(newList, {number:5,deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  50. }
  51. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  52. tools.getWebConfig();
  53. };
  54. //焦点图数据
  55. module.focusNewsTop = function (data) {
  56. if (data.code == 200) {
  57. let focusArray = [];
  58. if(data.data.length<1){
  59. focusArray.push({
  60. picUrl:'../../../static/images/banner1.png'
  61. },{
  62. picUrl:'../../../static/images/banner2.png'
  63. },{
  64. picUrl:'../../../static/images/banner3.png'
  65. })
  66. }else{
  67. data.data.forEach(res=>{
  68. focusArray.push({
  69. picUrl:'/api'+res.picUrl
  70. })
  71. })
  72. }
  73. module.data.focusListTop = focusArray;
  74. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  75. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  76. new Swiper('#bannerFocusWrapTop', {
  77. paginationClickable: true,
  78. autoplay : 4000,
  79. loop:true
  80. })
  81. }
  82. }
  83. //获取地址栏参数
  84. function getQueryVariable(variable){
  85. var query = window.location.search.substring(1);
  86. var vars = query.split("&");
  87. for (var i=0;i<vars.length;i++) {
  88. var pair = vars[i].split("=");
  89. if(pair[0] == variable){return pair[1];}
  90. }
  91. return(false);
  92. }
  93. //底部友情链接
  94. module.bottomFriendsLinks = function (data) {
  95. if (data.code == 200) {
  96. var content = data.data;
  97. console.log(content)
  98. module.data.friendsLinksList = content;
  99. var friendsLinksData = template('friendsLinksData', module.data);
  100. $("#friendsLinksContent").html(friendsLinksData);
  101. }
  102. }
  103. //政策法规数据
  104. module.policyInformation = function (data) {
  105. if (data.code == 200) {
  106. var content = data.rows;
  107. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  108. if (pageCount < 1){
  109. pageCount = 1;
  110. }
  111. if(module.data.policyInformationList == ''){
  112. // 初始化 分页器
  113. var page_s1=createPage('.page_s1');
  114. // 设置分页
  115. setPage(page_s1,{
  116. pageTotal: data.total, // 数据总条数
  117. pageSize: module.data.pageSize, // 每页显示条数
  118. pageCurrent: 1, // 当前页
  119. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  120. })
  121. $('#page_s1').html('共'+pageCount+'页')
  122. }
  123. module.data.pageCount = pageCount;
  124. module.data.policyInformationList = content;
  125. var policyInformationData = template('policyInformationData', module.data);
  126. $("#policyInformationContent").html(policyInformationData);
  127. }
  128. }
  129. //交易规则数据
  130. module.ruleInformation = function (data) {
  131. if (data.code == 200) {
  132. var content = data.rows;
  133. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  134. if (pageCount < 1){
  135. pageCount = 1;
  136. }
  137. if(module.data.ruleInformationList == ''){
  138. // 初始化 分页器
  139. var page_s1=createPage('.page_s2');
  140. // 设置分页
  141. setPage(page_s1,{
  142. pageTotal: data.total, // 数据总条数
  143. pageSize: module.data.pageSize, // 每页显示条数
  144. pageCurrent: 1, // 当前页
  145. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  146. })
  147. $('#page_s2').html('共'+pageCount+'页')
  148. }
  149. module.data.pageCount = pageCount;
  150. module.data.ruleInformationList = content;
  151. var ruleInformationData = template('ruleInformationData', module.data);
  152. $("#ruleInformationContent").html(ruleInformationData);
  153. }
  154. }
  155. //交易规则数据
  156. module.downloadInformation = function (data) {
  157. if (data.code == 200) {
  158. var content = data.rows;
  159. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  160. if (pageCount < 1){
  161. pageCount = 1;
  162. }
  163. if(module.data.downloadInformationList == ''){
  164. // 初始化 分页器
  165. var page_s1=createPage('.page_s3');
  166. // 设置分页
  167. setPage(page_s1,{
  168. pageTotal: data.total, // 数据总条数
  169. pageSize: module.data.pageSize, // 每页显示条数
  170. pageCurrent: 1, // 当前页
  171. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  172. })
  173. $('#page_s3').html('共'+pageCount+'页')
  174. }
  175. module.data.pageCount = pageCount;
  176. module.data.downloadInformationList = content;
  177. var downloadInformationData = template('downloadInformationData', module.data);
  178. $("#downloadInformationContent").html(downloadInformationData);
  179. }
  180. }
  181. tabList = function(type){
  182. console.log(type)
  183. document.getElementById('policyInformationContent').style.display = 'none';
  184. document.getElementById('ruleInformationContent').style.display = 'none';
  185. document.getElementById('downloadInformationContent').style.display = 'none';
  186. document.getElementById(type+'InformationContent').style.display = 'block';
  187. document.getElementById('policy').className = '';
  188. document.getElementById('rule').className = '';
  189. document.getElementById('download').className = '';
  190. document.getElementById(type).className = 'active';
  191. document.getElementById('policyNum').style.display = 'none';
  192. document.getElementById('ruleNum').style.display = 'none';
  193. document.getElementById('downloadNum').style.display = 'none';
  194. document.getElementById(type+'Num').style.display = 'block';
  195. module.data.clickType = type;
  196. module.data.pageNum = 1 ;
  197. }
  198. turnThePage = function (pageNum) {
  199. module.data.pageNum = pageNum ;
  200. if(module.data.clickType == 'policy'){
  201. tools.doGet(newList, {number:3,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.policyInformation,true);
  202. }
  203. if(module.data.clickType == 'rule'){
  204. tools.doGet(newList, {number:4,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.ruleInformation,true);
  205. }
  206. if(module.data.clickType == 'download'){
  207. tools.doGet(newList, {number:5,deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.downloadInformation,true);
  208. }
  209. }
  210. return module;
  211. });