网站
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

index.js 5.8 KiB

4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
4 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, template, Tools, echarts, swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusList: [],
  10. //新闻资讯数据
  11. newsInformationList: [],
  12. //政策法规数据
  13. policiesRegulationsList: [],
  14. //交易规则数据
  15. tradingRulesList: []
  16. },
  17. //柱状图参数
  18. option: {
  19. xAxis: {
  20. type: 'category',
  21. axisLine: {
  22. show: true,
  23. lineStyle: {
  24. width: 1,
  25. type: "solid"
  26. }
  27. },
  28. axisLabel: { //设置x轴的字
  29. show: true,
  30. interval: 0,//使x轴横坐标全部显示
  31. textStyle: {//x轴字体样式
  32. margin: 15
  33. }
  34. },
  35. data: ['2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021']
  36. },
  37. yAxis: {
  38. type: 'value',
  39. min: 400,
  40. max: 1000,
  41. splitNumber: 7,
  42. splitLine: {
  43. lineStyle: {
  44. type: 'dashed'
  45. }
  46. },
  47. axisLine: {
  48. show: true,
  49. lineStyle: {
  50. width: 1,
  51. type: "solid"
  52. }
  53. },
  54. },
  55. series: [{
  56. data: [490, 520, 650, 600, 700, 640, 680, 600, 660],//实际值减300
  57. type: 'bar',
  58. itemStyle: {
  59. color: '#007b76'
  60. }
  61. }],
  62. grid: {
  63. height: 200,
  64. width: 280,
  65. top: '-5px'
  66. },
  67. }
  68. };
  69. var tools = new Tools();
  70. module.init = function (page) {
  71. //获取焦点图信息
  72. tools.doGet(websiteNew + '/1/4', {}, module.focusNews);
  73. //新闻资讯
  74. tools.doGet(websiteNew + '/2/6', {}, module.NewsInformation);
  75. //政策法规
  76. tools.doGet(websiteNew + '/3/6', {}, module.policiesRegulations);
  77. //交易规则
  78. tools.doGet(websiteNew + '/4/6', {}, module.tradingRules);
  79. //竞价大厅-滚动
  80. module.hallRolling();
  81. // 柱状图绘制
  82. var chartDom = document.getElementById('chart');
  83. var myChart = echarts.init(chartDom);
  84. module.option && myChart.setOption(module.option);
  85. };
  86. //焦点图数据
  87. module.focusNews = function (data) {
  88. if (data.code == 200) {
  89. var content = data.data;
  90. var focusList = [];
  91. for (var i = 0; i < content.length; i++) {
  92. var imgStrs = content[i].content.match(/<img.*?>/g)
  93. if (imgStrs != null && imgStrs != '') {
  94. focusList.push(imgStrs[0])
  95. }
  96. }
  97. module.data.focusList = focusList;
  98. var bannerFocusData = template('bannerFocusData', module.data);
  99. $("#bannerFocusContent").html(bannerFocusData);
  100. new Swiper('#bannerFocusWrap', {
  101. pagination: '.page-pagination',
  102. paginationClickable: true
  103. })
  104. }
  105. }
  106. //新闻资讯数据
  107. module.NewsInformation = function (data) {
  108. if (data.code == 200) {
  109. var content = data.data;
  110. module.data.newsInformationList = content;
  111. var NewsInformationData = template('NewsInformationData', module.data);
  112. $("#NewsInformationContent").html(NewsInformationData);
  113. }
  114. }
  115. //政策法规
  116. module.policiesRegulations = function (data) {
  117. if (data.code == 200) {
  118. var content = data.data;
  119. module.data.policiesRegulationsList = content;
  120. var policiesRegulationsData = template('policiesRegulationsData', module.data);
  121. $("#policiesRegulationsContent").html(policiesRegulationsData);
  122. }
  123. }
  124. //交易规则
  125. module.tradingRules = function (data) {
  126. if (data.code == 200) {
  127. var content = data.data;
  128. module.data.tradingRulesList = content;
  129. var tradingRulesData = template('tradingRulesData', module.data);
  130. $("#tradingRulesContent").html(tradingRulesData);
  131. }
  132. }
  133. ///竞价大厅-滚动
  134. module.hallRolling = function () {
  135. var divScroll = document.getElementById('tableList');
  136. window.onmousewheel = divScroll.onmousewheel = function () { return false }
  137. module.timeInter(divScroll);
  138. divScroll.onmouseover = function () {
  139. clearInterval(time);
  140. }
  141. divScroll.onmouseout = function () {
  142. module.timeInter(divScroll);
  143. }
  144. module.tabCheck('supply');
  145. }
  146. module.timeInter = function (divScroll) {
  147. time = setInterval(function () {
  148. var oldTop = divScroll.scrollTop;
  149. var newTop = oldTop + 1;
  150. divScroll.scrollTop = newTop;
  151. var counst = divScroll.scrollHeight - divScroll.scrollTop - divScroll.clientHeight;
  152. if (1 > counst) {
  153. divScroll.scrollTop = 0;
  154. }
  155. }, 30)
  156. }
  157. //切换
  158. module.tabCheck = function (type) {
  159. document.getElementById('supply').style.display = 'none';
  160. document.getElementById('demand').style.display = 'none';
  161. document.getElementById(type).style.display = 'inline-table';
  162. }
  163. return module;
  164. });