index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. //自调用函数
  2. (function() {
  3. // 1、页面一加载就要知道页面宽度计算
  4. var setFont = function() {
  5. // 因为要定义变量可能和别的变量相互冲突,污染,所有用自调用函数
  6. var html = document.documentElement; // 获取html
  7. // 获取宽度
  8. var width = html.clientWidth;
  9. // 判断
  10. if (width < 1024) width = 1024
  11. if (width > 1920) width = 1920
  12. // 设置html的基准值
  13. var fontSize = width / 80 + 'px';
  14. // 设置给html
  15. html.style.fontSize = fontSize;
  16. }
  17. setFont();
  18. // 2、页面改变的时候也需要设置
  19. // 尺寸改变事件
  20. window.onresize = function() {
  21. setFont();
  22. }
  23. })();
  24. $.get('https://linggong.jinjianghc.com/mainapp.php/screen/index', (res) => {
  25. init(res.data)
  26. })
  27. $.get('https://aggadmin.jucai.gov.cn/admin/api/odd_job_other', (res) => {
  28. init_other(res)
  29. })
  30. function init(data) {
  31. $('.broker_total').text(data.broker_total);
  32. $('.comjobs_total').text(data.comjobs_total);
  33. $('.company_total').text(data.company_total);
  34. $('.people_man').text(data.people_man);
  35. $('.people_total').text(data.people_total);
  36. $('.people_woman').text(data.people_woman);
  37. $('.train').text(data.train);
  38. $('.train_join').text(data.train_join);
  39. this.geo(data);
  40. this.monitor(data);
  41. this.pieAge(data);
  42. this.pie(data);
  43. this.userType(data);
  44. this.user(data);
  45. this.order(data);
  46. this.sale(data);
  47. this.gauge(data);
  48. this.province(data);
  49. }
  50. function init_other(data) {
  51. $('.obb_job_deal_num').text(data.obb_job_deal_num);
  52. $('.obb_job_deal_money').text(data.obb_job_deal_money);
  53. $('.obb_job_service_num').text(data.obb_job_service_num);
  54. }
  55. function geo(data) {
  56. let community = data.community;
  57. let other = 0;
  58. let max = 0; //最大人数
  59. community = community.map((item) => {
  60. if (item.name == '其他') {
  61. other += item.count;
  62. } else if (item.count > max) {
  63. max = item.count;
  64. }
  65. return {
  66. name: item.name,
  67. value: item.count
  68. };
  69. });
  70. community.push({
  71. name: '泉州出口加工区',
  72. value: 0
  73. });
  74. community.push({
  75. name: '安平开发区',
  76. value: 0
  77. });
  78. var myecharts = echarts.init($('.map .geo')[0])
  79. // $.get('https://geo.datav.aliyun.com/areas_v3/bound/350582.json', result => {
  80. $.get('js/350582.json', result => {
  81. // 注册 echarts 地图
  82. echarts.registerMap('jinjiang', result);
  83. var option = {
  84. backgroundColor: '#080a20',
  85. title: {
  86. text: '其他地区:' + other + ' (人)',
  87. // subtext: '其他地区:' + community[community.length - 1].count,
  88. left: 'left',
  89. textStyle: {
  90. color: '#ffffff'
  91. }
  92. },
  93. tooltip: {
  94. trigger: 'item',
  95. formatter: '{b}<br/>{c} (人)'
  96. },
  97. visualMap: {
  98. min: 0,
  99. max: max,
  100. text: ['多', '少'],
  101. realtime: true,
  102. calculable: true,
  103. color: '#fff',
  104. inRange: {
  105. color: ['#142957', '#0b1c2d']
  106. },
  107. textStyle: {
  108. color: '#fff'
  109. }
  110. },
  111. series: [{
  112. type: 'map',
  113. map: 'jinjiang',
  114. zoom: 1.2,
  115. roam: true,
  116. coordinateSystem: 'geo',
  117. // rippleEffect: {
  118. // brushType: 'stroke'
  119. // },
  120. symbolSize: function(val, params) {
  121. return 8;
  122. },
  123. label: {
  124. show: true,
  125. color: '#fff'
  126. },
  127. itemStyle: {
  128. normal: {
  129. areaColor: '#142957',
  130. borderColor: '#0692a4'
  131. }
  132. },
  133. emphasis: {
  134. areaColor: '#0b1c2d'
  135. },
  136. data: community,
  137. nameMap: {
  138. '晋江市经济开发区': '经济开发区'
  139. }
  140. }]
  141. };
  142. myecharts.setOption(option);
  143. })
  144. }
  145. function monitor(data) {
  146. //事件委托
  147. $('.monitor').on('click', ' a', function () {
  148. //点击当前的a 加类名 active 他的兄弟删除类名
  149. $(this).addClass('active').siblings().removeClass('active');
  150. //获取一一对应的下标
  151. var index = $(this).index();
  152. //选取content 然后狗日对应下标的 显示 当前的兄弟.content隐藏
  153. $('.content').eq(index).show().siblings('.content').hide();
  154. });
  155. //填充数据
  156. let comjobs = data.comjobs;
  157. var html = '';
  158. comjobs.hot.forEach(function(item) {
  159. html += `<div class="row">`;
  160. html += `<span class="col">${item.title}</span>`;
  161. html += `<span class="col">${item.worker.ftitle}</span>`;
  162. html += `<span class="col">${item.bwagall || '面谈'}</span>`;
  163. html += `<span class="icon-dot"></span>`;
  164. html += `</div>`;
  165. });
  166. //渲染
  167. $('.monitor .marquee.hot').html(html);
  168. html = '';
  169. comjobs.new.forEach(function(item) {
  170. html += `<div class="row">`;
  171. html += `<span class="col">${item.title}</span>`;
  172. html += `<span class="col">${item.company}</span>`;
  173. html += `<span class="col">${item.salary || '面谈'}</span>`;
  174. html += `<span class="icon-dot"></span>`;
  175. html += `</div>`;
  176. });
  177. //渲染
  178. $('.monitor .marquee.new').html(html);
  179. //滚动
  180. //原理:把marquee下面的子盒子都复制一遍 加入到marquee中
  181. // 然后动画向上滚动,滚动到一半重新开始滚动
  182. //因为选取的是两个marquee 所以要遍历
  183. // $('.monitor .marquee').each(function (index, dom) {
  184. // //将每个 的所有子级都复制一遍
  185. // var rows = $(dom).children().clone();
  186. // //再将新的到的加入原来的
  187. // $(dom).append(rows);
  188. // });
  189. }
  190. function pieAge(data) {
  191. let eduction = data.user_age;
  192. let unknown = 0;
  193. let total = 0;
  194. eduction.map((item, index) => {
  195. if (item.name == '其他') {
  196. unknown += item.count;
  197. // eduction.splice(index, 1);
  198. //其他数据
  199. item.value = item.count;
  200. } else {
  201. total += item.count;
  202. item.value = item.count;
  203. }
  204. return item;
  205. });
  206. console.log(eduction)
  207. $('.age-unknown').text(unknown);
  208. $('.age-total').text(total);
  209. var myechartAge = echarts.init($('.pie.age')[0]);
  210. option = {
  211. // 控制提示
  212. tooltip: {
  213. // 非轴图形,使用item的意思是放到数据对应图形上触发提示
  214. trigger: 'item',
  215. // 格式化提示内容:
  216. // a 代表图表名称 b 代表数据名称 c 代表数据 d代表 当前数据/总数据的比例
  217. formatter: "{a} <br/>{b} : {c} ({d}%)"
  218. },
  219. // 控制图表
  220. series: [{
  221. // 图表名称
  222. name: '年龄',
  223. // 图表类型
  224. type: 'pie',
  225. // 南丁格尔玫瑰图 有两个圆 内圆半径10% 外圆半径70%
  226. // 百分比基于 图表DOM容器的半径
  227. radius: ['10%', '70%'],
  228. // 图表中心位置 left 50% top 50% 距离图表DOM容器
  229. center: ['50%', '50%'],
  230. // 半径模式,另外一种是 area 面积模式
  231. roseType: 'radius',
  232. // 数据集 value 数据的值 name 数据的名称
  233. data: eduction,
  234. //文字调整
  235. label: {
  236. fontSize: 10
  237. },
  238. //引导线
  239. labelLine: {
  240. length: 8,
  241. length2: 10
  242. }
  243. }],
  244. color: ['#006cff', '#9fe6b8', '#32c5e9', '#1d9dff', '#60cda0', '#ed8884', '#ff9f7f', '#0096ff']
  245. };
  246. myechartAge.setOption(option);
  247. }
  248. function pie(data) {
  249. let eduction = data.eduction;
  250. let unknown = 0;
  251. let total = 0;
  252. eduction.map((item, index) => {
  253. if (item.name == '未知') {
  254. unknown += item.count;
  255. eduction.splice(index, 1);
  256. } else {
  257. total += item.count;
  258. item.value = item.count;
  259. }
  260. return item;
  261. });
  262. $('.edu-unknown').text(unknown);
  263. $('.edu-total').text(total);
  264. var myechart = echarts.init($('.pie.edu')[0]);
  265. option = {
  266. // 控制提示
  267. tooltip: {
  268. // 非轴图形,使用item的意思是放到数据对应图形上触发提示
  269. trigger: 'item',
  270. // 格式化提示内容:
  271. // a 代表图表名称 b 代表数据名称 c 代表数据 d代表 当前数据/总数据的比例
  272. formatter: "{a} <br/>{b} : {c} ({d}%)"
  273. },
  274. // 控制图表
  275. series: [{
  276. // 图表名称
  277. name: '学历',
  278. // 图表类型
  279. type: 'pie',
  280. // 南丁格尔玫瑰图 有两个圆 内圆半径10% 外圆半径70%
  281. // 百分比基于 图表DOM容器的半径
  282. radius: ['10%', '70%'],
  283. // 图表中心位置 left 50% top 50% 距离图表DOM容器
  284. center: ['50%', '50%'],
  285. // 半径模式,另外一种是 area 面积模式
  286. roseType: 'radius',
  287. // 数据集 value 数据的值 name 数据的名称
  288. data: eduction,
  289. //文字调整
  290. label: {
  291. fontSize: 10
  292. },
  293. //引导线
  294. labelLine: {
  295. length: 8,
  296. length2: 10
  297. }
  298. }],
  299. color: ['#006cff', '#60cda0', '#ed8884', '#ff9f7f', '#0096ff', '#9fe6b8', '#32c5e9', '#1d9dff']
  300. };
  301. myechart.setOption(option);
  302. }
  303. // 用户
  304. function userType(data) {
  305. let cate = data.type;
  306. let titleArr = [];
  307. let countArr = [];
  308. let total = 0;
  309. let count = cate.length;
  310. // 中间省略的数据 准备三项
  311. var hiddenItem = {
  312. name: '',
  313. value: 10,
  314. // 柱子颜色
  315. itemStyle: {
  316. color: '#254065'
  317. },
  318. // 鼠标经过柱子颜色
  319. emphasis: {
  320. itemStyle: {
  321. color: '#254065'
  322. }
  323. },
  324. // 工具提示隐藏
  325. tooltip: {
  326. extraCssText: 'opacity:0'
  327. }
  328. };
  329. let titleAttr = {
  330. 1: '按月',
  331. 2: '按时',
  332. 3: '按件',
  333. 4: '按项目',
  334. 5: '其他',
  335. }
  336. cate.forEach((item, index) => {
  337. if (index < 5 || index + 5 >= count) {
  338. titleArr.push(titleAttr[item.wtype])
  339. countArr.push(item.count)
  340. } else if (count > 10 && index == 5) {
  341. //随机三个
  342. let arr = []
  343. for (let i = 5; i < count - 5; i++) {
  344. arr.push(i)
  345. }
  346. let randomArr = [];
  347. while (randomArr.length < 3) {
  348. let temp = (Math.random() * arr.length) >> 0;
  349. randomArr.push(arr.splice(temp, 1)[0]);
  350. }
  351. randomArr.forEach((randomIndex) => {
  352. titleArr.push(titleAttr[cate[randomIndex].wtype])
  353. countArr.push(cate[randomIndex].count)
  354. })
  355. }
  356. total += item.count
  357. });
  358. $('.type-count').text(count)
  359. $('.type-total').text(total)
  360. option = {
  361. // 工具提示
  362. tooltip: {
  363. // 触发类型 经过轴触发axis 经过轴触发item
  364. trigger: 'item',
  365. // 轴触发提示才有效
  366. axisPointer: {
  367. // 默认为直线,可选为:'line' 线效果 | 'shadow' 阴影效果
  368. type: 'shadow'
  369. }
  370. },
  371. // 图表边界控制
  372. grid: {
  373. // 距离 上右下左 的距离
  374. left: '0',
  375. right: '3%',
  376. bottom: '3%',
  377. top: '5%',
  378. // 大小是否包含文本【类似于boxsizing】
  379. containLabel: true,
  380. //显示边框
  381. show: true,
  382. //边框颜色
  383. borderColor: 'rgba(0, 240, 255, 0.3)'
  384. },
  385. // 控制x轴
  386. xAxis: [{
  387. // 使用类目,必须有data属性
  388. type: 'category',
  389. // 使用 data 中的数据设为刻度文字
  390. data: titleArr,
  391. // 刻度设置
  392. axisTick: {
  393. // true意思:图形在刻度中间
  394. // false意思:图形在刻度之间
  395. alignWithLabel: false,
  396. show: false
  397. },
  398. //文字
  399. axisLabel: {
  400. color: '#4c9bfd'
  401. }
  402. }],
  403. // 控制y轴
  404. yAxis: [{
  405. // 使用数据的值设为刻度文字
  406. type: 'value',
  407. axisTick: {
  408. // true意思:图形在刻度中间
  409. // false意思:图形在刻度之间
  410. alignWithLabel: false,
  411. show: false
  412. },
  413. //文字
  414. axisLabel: {
  415. color: '#4c9bfd'
  416. },
  417. splitLine: {
  418. lineStyle: {
  419. color: 'rgba(0, 240, 255, 0.3)'
  420. }
  421. },
  422. }],
  423. // 控制x轴
  424. series: [
  425. {
  426. // series配置
  427. // 颜色
  428. itemStyle: {
  429. // 提供的工具函数生成渐变颜色
  430. color: new echarts.graphic.LinearGradient(
  431. // (x1,y2) 点到点 (x2,y2) 之间进行渐变
  432. 0, 0, 0, 1,
  433. [{
  434. offset: 0,
  435. color: '#00fffb'
  436. }, // 0 起始颜色
  437. {
  438. offset: 1,
  439. color: '#0061ce'
  440. } // 1 结束颜色
  441. ]
  442. )
  443. },
  444. // 图表数据名称
  445. name: '岗位统计',
  446. // 图表类型
  447. type: 'bar',
  448. // 柱子宽度
  449. barWidth: '60%',
  450. // 数据
  451. data: countArr
  452. }
  453. ]
  454. };
  455. var myechart = echarts.init($('.users .bar.type')[0]);
  456. myechart.setOption(option);
  457. }
  458. // 用户
  459. function user(data) {
  460. let cate = data.cate;
  461. let titleArr = [];
  462. let countArr = [];
  463. let total = 0;
  464. let count = cate.length;
  465. // 中间省略的数据 准备三项
  466. var hiddenItem = {
  467. name: '',
  468. value: 10,
  469. // 柱子颜色
  470. itemStyle: {
  471. color: '#254065'
  472. },
  473. // 鼠标经过柱子颜色
  474. emphasis: {
  475. itemStyle: {
  476. color: '#254065'
  477. }
  478. },
  479. // 工具提示隐藏
  480. tooltip: {
  481. extraCssText: 'opacity:0'
  482. }
  483. };
  484. cate.forEach((item, index) => {
  485. if (index < 5 || index + 5 >= count) {
  486. titleArr.push(item.title)
  487. countArr.push(item.count)
  488. } else if (count > 10 && index == 5) {
  489. //随机三个
  490. let arr = []
  491. for (let i = 5; i < count - 5; i++) {
  492. arr.push(i)
  493. }
  494. let randomArr = [];
  495. while (randomArr.length < 3) {
  496. let temp = (Math.random() * arr.length) >> 0;
  497. randomArr.push(arr.splice(temp, 1)[0]);
  498. }
  499. randomArr.forEach((randomIndex) => {
  500. titleArr.push(cate[randomIndex].title)
  501. countArr.push(cate[randomIndex].count)
  502. })
  503. }
  504. total += item.count
  505. });
  506. $('.cate-count').text(count)
  507. $('.cate-total').text(total)
  508. option = {
  509. // 工具提示
  510. tooltip: {
  511. // 触发类型 经过轴触发axis 经过轴触发item
  512. trigger: 'item',
  513. // 轴触发提示才有效
  514. axisPointer: {
  515. // 默认为直线,可选为:'line' 线效果 | 'shadow' 阴影效果
  516. type: 'shadow'
  517. }
  518. },
  519. // 图表边界控制
  520. grid: {
  521. // 距离 上右下左 的距离
  522. left: '0',
  523. right: '3%',
  524. bottom: '3%',
  525. top: '5%',
  526. // 大小是否包含文本【类似于boxsizing】
  527. containLabel: true,
  528. //显示边框
  529. show: true,
  530. //边框颜色
  531. borderColor: 'rgba(0, 240, 255, 0.3)'
  532. },
  533. // 控制x轴
  534. xAxis: [{
  535. // 使用类目,必须有data属性
  536. type: 'category',
  537. // 使用 data 中的数据设为刻度文字
  538. data: titleArr,
  539. // 刻度设置
  540. axisTick: {
  541. // true意思:图形在刻度中间
  542. // false意思:图形在刻度之间
  543. alignWithLabel: false,
  544. show: false
  545. },
  546. //文字
  547. axisLabel: {
  548. color: '#4c9bfd'
  549. }
  550. }],
  551. // 控制y轴
  552. yAxis: [{
  553. // 使用数据的值设为刻度文字
  554. type: 'value',
  555. axisTick: {
  556. // true意思:图形在刻度中间
  557. // false意思:图形在刻度之间
  558. alignWithLabel: false,
  559. show: false
  560. },
  561. //文字
  562. axisLabel: {
  563. color: '#4c9bfd'
  564. },
  565. splitLine: {
  566. lineStyle: {
  567. color: 'rgba(0, 240, 255, 0.3)'
  568. }
  569. },
  570. }],
  571. // 控制x轴
  572. series: [
  573. {
  574. // series配置
  575. // 颜色
  576. itemStyle: {
  577. // 提供的工具函数生成渐变颜色
  578. color: new echarts.graphic.LinearGradient(
  579. // (x1,y2) 点到点 (x2,y2) 之间进行渐变
  580. 0, 0, 0, 1,
  581. [{
  582. offset: 0,
  583. color: '#00fffb'
  584. }, // 0 起始颜色
  585. {
  586. offset: 1,
  587. color: '#0061ce'
  588. } // 1 结束颜色
  589. ]
  590. )
  591. },
  592. // 图表数据名称
  593. name: '岗位统计',
  594. // 图表类型
  595. type: 'bar',
  596. // 柱子宽度
  597. barWidth: '60%',
  598. // 数据
  599. data: countArr
  600. }
  601. ]
  602. };
  603. var myechart = echarts.init($('.users .bar.cate')[0]);
  604. myechart.setOption(option);
  605. }
  606. //订单
  607. function order(data) {
  608. var data = {
  609. day365: {
  610. orders: '20,301,987',
  611. amount: '99834'
  612. },
  613. day90: {
  614. orders: '301,987',
  615. amount: '9834'
  616. },
  617. day30: {
  618. orders: '1,987',
  619. amount: '3834'
  620. },
  621. day1: {
  622. orders: '987',
  623. amount: '834'
  624. }
  625. }
  626. //点击事件
  627. $('.order').on('click', '.filter a', function() {
  628. //点击之后加类名
  629. $(this).addClass('active').siblings().removeClass('active');
  630. // 先获取点击a的 data-key自定义属性
  631. var key = $(this).attr('data-key');
  632. //获取自定义属性
  633. // data{}==>data.shuxing data['shuxing]
  634. key = data[key]; //
  635. $('.order .item h4:eq(0)').text(key.orders);
  636. $('.order .item h4:eq(1)').text(key.amount);
  637. });
  638. //定时器
  639. var index = 0;
  640. var aclick = $('.order a');
  641. setInterval(function() {
  642. index++;
  643. if (index > 3) {
  644. index = 0;
  645. }
  646. //每san秒调用点击事件
  647. aclick.eq(index).click();
  648. }, 3000);
  649. }
  650. //销售
  651. function sale(data) {
  652. let user_month = data.user_month;
  653. let titleArr = [];
  654. let countArr = [];
  655. user_month.forEach((item, index) => {
  656. titleArr.push(item.name)
  657. countArr.push(item.count)
  658. });
  659. var option = {
  660. //鼠标提示工具
  661. tooltip: {
  662. trigger: 'axis'
  663. },
  664. xAxis: {
  665. // 类目类型
  666. type: 'category',
  667. // x轴刻度文字
  668. data: titleArr,
  669. axisTick: {
  670. show: false //去除刻度线
  671. },
  672. axisLabel: {
  673. color: '#4c9bfd' //文本颜色
  674. },
  675. axisLine: {
  676. show: false //去除轴线
  677. },
  678. boundaryGap: false //去除轴内间距
  679. },
  680. yAxis: {
  681. // 数据作为刻度文字
  682. type: 'value',
  683. axisTick: {
  684. show: false //去除刻度线
  685. },
  686. axisLabel: {
  687. color: '#4c9bfd' //文本颜色
  688. },
  689. axisLine: {
  690. show: false //去除轴线
  691. },
  692. boundaryGap: false //去除轴内间距
  693. },
  694. //图例组件
  695. legend: {
  696. textStyle: {
  697. color: '#4c9bfd' // 图例文字颜色
  698. },
  699. right: '10%' //距离右边10%
  700. },
  701. // 设置网格样式
  702. grid: {
  703. show: true, // 显示边框
  704. top: '20%',
  705. left: '3%',
  706. right: '4%',
  707. bottom: '3%',
  708. borderColor: '#012f4a', // 边框颜色
  709. containLabel: true // 包含刻度文字在内
  710. },
  711. series: [{
  712. name: '注册用户',
  713. // 数据
  714. data: countArr,
  715. // 图表类型
  716. type: 'line',
  717. // 圆滑连接
  718. smooth: true,
  719. itemStyle: {
  720. color: '#00f2f1' // 线颜色
  721. }
  722. }]
  723. };
  724. var myechart = echarts.init($('.line')[0]);
  725. myechart.setOption(option);
  726. //点击效果
  727. var data = {
  728. year: [
  729. [24, 40, 101, 134, 90, 230, 210, 230, 120, 230, 210, 120],
  730. [40, 64, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79]
  731. ],
  732. quarter: [
  733. [23, 75, 12, 97, 21, 67, 98, 21, 43, 64, 76, 38],
  734. [43, 31, 65, 23, 78, 21, 82, 64, 43, 60, 19, 34]
  735. ],
  736. month: [
  737. [34, 87, 32, 76, 98, 12, 32, 87, 39, 36, 29, 36],
  738. [56, 43, 98, 21, 56, 87, 43, 12, 43, 54, 12, 98]
  739. ],
  740. week: [
  741. [43, 73, 62, 54, 91, 54, 84, 43, 86, 43, 54, 53],
  742. [32, 54, 34, 87, 32, 45, 62, 68, 93, 54, 54, 24]
  743. ]
  744. }
  745. $('.sales ').on('click', '.caption a', function() {
  746. $(this).addClass('active').siblings('a').removeClass('active');
  747. //option series data
  748. //获取自定义属性值
  749. var key = $(this).attr('data-type');
  750. //取出对应的值
  751. key = data[key];
  752. //将值设置到 图表中
  753. option.series[0].data = key[0];
  754. option.series[1].data = key[1];
  755. //再次调用才能在页面显示
  756. myechart.setOption(option);
  757. });
  758. //定时器
  759. var index = 0;
  760. var timer = setInterval(function() {
  761. index++;
  762. if (index > 4) {
  763. index = 0;
  764. };
  765. $('.sales .caption a').eq(index).click();
  766. }, 2000);
  767. }
  768. function gauge(data) {
  769. var option = {
  770. series: [{
  771. type: 'pie',
  772. radius: ['130%', '150%'], // 放大图形
  773. center: ['50%', '80%'], // 往下移动 套住75%文字
  774. label: {
  775. show: false,
  776. },
  777. startAngle: 180,
  778. hoverOffset: 0, // 鼠标经过不变大
  779. data: [{
  780. value: 100,
  781. itemStyle: { // 颜色渐变#00c9e0->#005fc1
  782. color: {
  783. type: 'linear',
  784. x: 0,
  785. y: 0,
  786. x2: 0,
  787. y2: 1,
  788. colorStops: [{
  789. offset: 0,
  790. color: '#00c9e0'
  791. },
  792. {
  793. offset: 1,
  794. color: '#005fc1'
  795. }
  796. ]
  797. }
  798. }
  799. },
  800. {
  801. value: 100,
  802. itemStyle: {
  803. color: '#12274d'
  804. }
  805. }, // 颜色#12274d
  806. {
  807. value: 200,
  808. itemStyle: {
  809. color: 'transparent'
  810. }
  811. } // 透明隐藏第三块区域
  812. ]
  813. }]
  814. };
  815. var myechart = echarts.init($('.gauge')[0]);
  816. myechart.setOption(option);
  817. }
  818. function province(data) {
  819. var data = [{
  820. name: '可爱多',
  821. num: '9,086'
  822. },
  823. {
  824. name: '娃哈哈',
  825. num: '8,341'
  826. },
  827. {
  828. name: '喜之郎',
  829. num: '7,407'
  830. },
  831. {
  832. name: '八喜',
  833. num: '6,080'
  834. },
  835. {
  836. name: '小洋人',
  837. num: '6,724'
  838. },
  839. {
  840. name: '好多鱼',
  841. num: '2,170'
  842. },
  843. ]
  844. $('.inner').on('mouseenter', '.sup li', function() {
  845. $(this).addClass('active').siblings().removeClass('active');
  846. //获取随机的值 sort方法 是给数组排序 a-b是从小到大
  847. //.5-随机0-1的数 可能为正可能为负 排序就会随机
  848. var radomData = data.sort(function(a, b) {
  849. return 0.5 - Math.random()
  850. });
  851. var html = '';
  852. radomData.forEach(function(item) {
  853. html +=
  854. `<li><span>${item.name}</span><span>${item.num} <s class="icon-up"></s></span></li>`;
  855. });
  856. //渲染
  857. $('.sub').html(html);
  858. });
  859. $('.province .sup li').eq(0).mouseenter();
  860. var index = 0;
  861. var timer = setInterval(() => {
  862. index++;
  863. if (index > 5) {
  864. index = 0;
  865. }
  866. $('.sup li').eq(index).mouseenter();
  867. }, 2000);
  868. }
  869. let second = 10;
  870. let set = null;
  871. function countdown() {
  872. set = setInterval(() => {
  873. second--;
  874. if (second == 0) {
  875. location.href = "/talent";
  876. }
  877. $('#countdown').text(second);
  878. },1000);
  879. }
  880. $(document).ready(() => {
  881. countdown();
  882. });
  883. $('#countdown').click(() => {
  884. if (set) {
  885. clearInterval(set);
  886. set = null;
  887. } else {
  888. countdown();
  889. }
  890. });