js.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. //响应式布局
  2. $(window).load(function() {
  3. $(".loading").fadeOut()
  4. })
  5. $(document).ready(function() {
  6. var whei = $(window).width()
  7. $("html").css({
  8. fontSize: whei / 20
  9. })
  10. $(window).resize(function() {
  11. var whei = $(window).width()
  12. $("html").css({
  13. fontSize: whei / 20
  14. })
  15. });
  16. });
  17. //试验次数
  18. function chart1(data) {
  19. let myChart = echarts.init(document.getElementById('chart1'));
  20. let option = {
  21. tooltip: {
  22. trigger: 'axis',
  23. axisPointer: {
  24. type: "shadow"
  25. }
  26. },
  27. grid: {
  28. left: '5%',
  29. top: '20%',
  30. right: '5%',
  31. bottom: '3%',
  32. containLabel: true
  33. },
  34. color: ['#23abca'],
  35. xAxis: [{
  36. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'],
  37. axisLine: options().yAxis.axisLine
  38. }],
  39. yAxis: options().yAxis,
  40. series: [{
  41. type: 'bar',
  42. data: [1235, 2300, 1221, 3420, 2321, 1036, 2567, 1700],
  43. barWidth: '35%', //柱子宽度
  44. itemStyle: {
  45. normal: {
  46. opacity: 1,
  47. barBorderRadius: [5, 5, 0, 0],
  48. label: {
  49. show: true,
  50. position: 'top',
  51. textStyle: {
  52. color: 'rgba(255,255,255,.6)'
  53. }
  54. }
  55. }
  56. }
  57. }
  58. ]
  59. };
  60. myChart.setOption(option);
  61. window.addEventListener("resize", function() {
  62. myChart.resize();
  63. });
  64. }
  65. //渠道占比
  66. function chart2(data) {
  67. let myChart = echarts.init(document.getElementById('chart2'));
  68. let option = {
  69. tooltip: {
  70. trigger: 'axis',
  71. axisPointer: {
  72. type: "shadow"
  73. }
  74. },
  75. series: [{
  76. type: 'pie',
  77. radius: ['40%', '70%'],
  78. label: {
  79. normal: {
  80. show: true,
  81. formatter: '{b}: {d}%',
  82. fontSize: '14',
  83. textStyle: {
  84. color: 'rgba(255,255,255,.6)'
  85. }
  86. }
  87. },
  88. data: [{
  89. value: 1048,
  90. name: '已完成'
  91. }, {
  92. value: 735,
  93. name: '未完成'
  94. }]
  95. }
  96. ]
  97. };
  98. myChart.setOption(option);
  99. window.addEventListener("resize", function() {
  100. myChart.resize();
  101. });
  102. }
  103. //样机信息
  104. function chart3(data) {
  105. let myChart = echarts.init(document.getElementById('chart3'));
  106. data = [35, 23, 21, 23, 21, 36, 7, 17, 9];
  107. let option = {
  108. tooltip: {
  109. trigger: 'axis',
  110. axisPointer: {
  111. type: "shadow"
  112. }
  113. },
  114. grid: {
  115. left: '5%',
  116. top: '20%',
  117. right: '5%',
  118. bottom: '3%',
  119. containLabel: true
  120. },
  121. color: ['#23abca'],
  122. xAxis: [{
  123. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'],
  124. axisLine: options().yAxis.axisLine
  125. }],
  126. yAxis: options().yAxis,
  127. series: [{
  128. type: 'bar',
  129. data: [1235, 2300, 1221, 3420, 2321, 1036, 2567, 1700],
  130. barWidth: '35%', //柱子宽度
  131. itemStyle: {
  132. normal: {
  133. opacity: 1,
  134. barBorderRadius: [5, 5, 0, 0],
  135. label: {
  136. show: true,
  137. position: 'top',
  138. textStyle: {
  139. color: 'rgba(255,255,255,.6)'
  140. }
  141. }
  142. }
  143. }
  144. }
  145. ]
  146. };
  147. myChart.setOption(option);
  148. window.addEventListener("resize", function() {
  149. myChart.resize();
  150. });
  151. }
  152. //样机改装信息
  153. function chart4(data) {
  154. let myChart = echarts.init(document.getElementById('chart4'));
  155. data = [35, 23, 21, 23, 21, 36, 7, 17, 9];
  156. let option = {
  157. tooltip: {
  158. trigger: 'axis',
  159. axisPointer: {
  160. type: "shadow"
  161. }
  162. },
  163. grid: {
  164. left: '5%',
  165. top: '20%',
  166. right: '5%',
  167. bottom: '3%',
  168. containLabel: true
  169. },
  170. color: ['#23abca'],
  171. xAxis: [{
  172. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'],
  173. axisLine: options().yAxis.axisLine
  174. }],
  175. yAxis: options().yAxis,
  176. series: [{
  177. type: 'bar',
  178. data: [1235, 2300, 1221, 3420, 2321, 1036, 2567, 1700],
  179. barWidth: '35%', //柱子宽度
  180. itemStyle: {
  181. normal: {
  182. opacity: 1,
  183. barBorderRadius: [5, 5, 0, 0],
  184. label: {
  185. show: true,
  186. position: 'top',
  187. textStyle: {
  188. color: 'rgba(255,255,255,.6)'
  189. }
  190. }
  191. }
  192. }
  193. }
  194. ]
  195. };
  196. myChart.setOption(option);
  197. window.addEventListener("resize", function() {
  198. myChart.resize();
  199. });
  200. }
  201. //设备资产
  202. function chart5(data) {
  203. let myChart = echarts.init(document.getElementById('chart5'));
  204. data = [35, 23, 21, 23, 21, 36, 7, 17, 9];
  205. let option = {
  206. tooltip: {
  207. trigger: 'axis',
  208. axisPointer: {
  209. type: "shadow"
  210. }
  211. },
  212. grid: {
  213. left: '5%',
  214. top: '20%',
  215. right: '5%',
  216. bottom: '3%',
  217. containLabel: true
  218. },
  219. color: ['#23abca'],
  220. xAxis: [{
  221. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'],
  222. axisLine: options().yAxis.axisLine
  223. }],
  224. yAxis: options().yAxis,
  225. series: [{
  226. type: 'bar',
  227. data: [1235, 2300, 1221, 3420, 2321, 1036, 2567, 1700],
  228. barWidth: '35%', //柱子宽度
  229. itemStyle: {
  230. normal: {
  231. opacity: 1,
  232. barBorderRadius: [5, 5, 0, 0],
  233. label: {
  234. show: true,
  235. position: 'top',
  236. textStyle: {
  237. color: 'rgba(255,255,255,.6)'
  238. }
  239. }
  240. }
  241. }
  242. }
  243. ]
  244. };
  245. myChart.setOption(option);
  246. window.addEventListener("resize", function() {
  247. myChart.resize();
  248. });
  249. }
  250. //能源管理
  251. function chart6(data) {
  252. let myChart = echarts.init(document.getElementById('chart6'));
  253. data = [35, 23, 21, 23, 21, 36, 7, 17, 9];
  254. let option = {
  255. tooltip: {
  256. trigger: 'axis',
  257. axisPointer: {
  258. type: "shadow"
  259. }
  260. },
  261. grid: {
  262. left: '5%',
  263. top: '20%',
  264. right: '5%',
  265. bottom: '3%',
  266. containLabel: true
  267. },
  268. color: ['#23abca'],
  269. xAxis: [{
  270. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022'],
  271. axisLine: options().yAxis.axisLine
  272. }],
  273. yAxis: options().yAxis,
  274. series: [{
  275. type: 'bar',
  276. data: [1235, 2300, 1221, 3420, 2321, 1036, 2567, 1700],
  277. barWidth: '35%', //柱子宽度
  278. itemStyle: {
  279. normal: {
  280. opacity: 1,
  281. barBorderRadius: [5, 5, 0, 0],
  282. label: {
  283. show: true,
  284. position: 'top',
  285. textStyle: {
  286. color: 'rgba(255,255,255,.6)'
  287. }
  288. }
  289. }
  290. }
  291. }
  292. ]
  293. };
  294. myChart.setOption(option);
  295. window.addEventListener("resize", function() {
  296. myChart.resize();
  297. });
  298. }
  299. //向上滚动
  300. function roll(t) {
  301. //滚动排行1
  302. let ul1 = document.getElementById("comment1");
  303. let ul2 = document.getElementById("comment2");
  304. let ulbox = document.getElementById("marquee-view");
  305. ul2.innerHTML = ul1.innerHTML;
  306. ulbox.scrollTop = 0; // 开始无滚动时设为0
  307. let timer = setInterval(rollStart, t, 1); // 设置定时器,参数t用在这为间隔时间(单位毫秒),参数t越小,滚动速度越快
  308. // 鼠标移入div时暂停滚动
  309. ulbox.onmouseover = function() {
  310. clearInterval(timer);
  311. }
  312. // 鼠标移出div后继续滚动
  313. ulbox.onmouseout = function() {
  314. timer = setInterval(rollStart, t, 1);
  315. }
  316. //滚动排行2
  317. var a2_ul1 = document.getElementById("a2_comment1");
  318. var a2_ul2 = document.getElementById("a2_comment2");
  319. var a2_ulbox = document.getElementById("a2_marquee-view");
  320. a2_ul2.innerHTML = a2_ul1.innerHTML;
  321. a2_ulbox.scrollTop = 0; // 开始无滚动时设为0
  322. var timer2 = setInterval(rollStart, t, 2); // 设置定时器,参数t用在这为间隔时间(单位毫秒),参数t越小,滚动速度越快
  323. // 鼠标移入div时暂停滚动
  324. a2_ulbox.onmouseover = function() {
  325. clearInterval(timer2);
  326. }
  327. // 鼠标移出div后继续滚动
  328. a2_ulbox.onmouseout = function() {
  329. timer2 = setInterval(rollStart, t, 2);
  330. }
  331. }
  332. // 开始滚动函数
  333. function rollStart(index) {
  334. if (index == 1) {
  335. // 上面声明的DOM对象为局部对象需要再次声明
  336. let ul1 = document.getElementById("comment1");
  337. let ul2 = document.getElementById("comment2");
  338. let ulbox = document.getElementById("marquee-view");
  339. // 正常滚动不断给scrollTop的值+1,当滚动高度大于列表内容高度时恢复为0
  340. if (ulbox.scrollTop >= ul1.scrollHeight) {
  341. ulbox.scrollTop = 0;
  342. } else {
  343. ulbox.scrollTop++;
  344. }
  345. }
  346. if (index == 2) {
  347. let a2_ul1 = document.getElementById("a2_comment1");
  348. let a2_ul2 = document.getElementById("a2_comment2");
  349. let a2_ulbox = document.getElementById("a2_marquee-view");
  350. // 正常滚动不断给scrollTop的值+1,当滚动高度大于列表内容高度时恢复为0
  351. if (a2_ulbox.scrollTop >= a2_ul1.scrollHeight) {
  352. a2_ulbox.scrollTop = 0;
  353. } else {
  354. a2_ulbox.scrollTop++;
  355. }
  356. }
  357. }