driving-window.php 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('components/screen-contain', __DIR__);
  4. ComponentHelper::loadComponentView('components/header-time', __DIR__);
  5. ?>
  6. <style>
  7. .screen-container {
  8. min-width: 100%;
  9. }
  10. .el-main {
  11. padding: 0;
  12. }
  13. .president-driving-window {
  14. position: relative;
  15. min-width: 1420px;
  16. min-height: 100%;
  17. background: url('/resources/img/dirve/dirve_bg.png') no-repeat;
  18. background-size: 100% 100%;
  19. color: #fff;
  20. }
  21. /* 头部 start */
  22. .sub-title {
  23. font-size: 22px;
  24. color: #F8F8F8;
  25. }
  26. .sub-title-text {
  27. padding: 0 30px;
  28. }
  29. /* 头部 end */
  30. /* 仪表盘部分 start */
  31. .president-driving-content {
  32. position: relative;
  33. margin-top: 20px;
  34. height: 440px;
  35. }
  36. /* 1 中间的样式 */
  37. .president-digital {
  38. position: absolute;
  39. left: 50%;
  40. transform: translateX(-50%);
  41. height: 440px;
  42. z-index: 2;
  43. }
  44. #middle-canvas {
  45. width: 172px;
  46. height: 172px;
  47. }
  48. .digital-content {
  49. text-align: center;
  50. color: #F8F8F8;
  51. }
  52. .digital-title {
  53. font-size: 20px;
  54. padding-bottom: 10px;
  55. }
  56. .digital-up-percent {
  57. font-size: 40px;
  58. padding-right: 10px;
  59. font-weight: 700;
  60. }
  61. .digital-all {
  62. position: absolute;
  63. left: 50%;
  64. transform: translateX(-50%);
  65. bottom: -60px;
  66. }
  67. .all-items {
  68. width: 50%;
  69. color: #F8F8F8;
  70. }
  71. .all-items-amount {
  72. font-size: 30px;
  73. }
  74. .all-items-name {
  75. font-size: 20px;
  76. }
  77. /* 2 大的仪表盘样式 */
  78. .dash-board-big {
  79. position: absolute;
  80. width: 1100px;
  81. top: 0;
  82. left: 50%;
  83. transform: translateX(-50%);
  84. height: 440px;
  85. }
  86. .dash-board-lf,
  87. .dash-board-rg {
  88. position: relative;
  89. width: 440px;
  90. height: 440px;
  91. background: #030319;
  92. box-shadow: 0px 3px 40px rgba(0, 52, 228, 0.7);
  93. border-radius: 50%;
  94. }
  95. .dash-board-lf::before,
  96. .dash-board-rg::before {
  97. position: absolute;
  98. content: "";
  99. width: 390px;
  100. height: 390px;
  101. background: #030319;
  102. box-shadow: 0px 3px 40px rgba(0, 52, 228, 0.5);
  103. border-radius: 50%;
  104. top: 50%;
  105. left: 50%;
  106. transform: translate(-50%, -50%);
  107. }
  108. #dashBoardLeft,
  109. #dashBoardRight {
  110. position: absolute;
  111. top: 50%;
  112. left: 50%;
  113. transform: translate(-50%, -50%);
  114. width: 100%;
  115. height: 100%;
  116. }
  117. .dash-new-today {
  118. position: absolute;
  119. bottom: 25px;
  120. right: 60px;
  121. width: 140px;
  122. height: 140px;
  123. border: 3px solid #00186A;
  124. background: linear-gradient(320deg, #0D0D10 0%, #2F2F54 100%);
  125. box-shadow: -10px 10px 10px #050814;
  126. border-radius: 50%;
  127. color: #fff;
  128. }
  129. .dash-new-today .today-num {
  130. font-size: 32px;
  131. }
  132. .dash-new-today .today-title {
  133. font-size: 14px;
  134. }
  135. .dash-board-rg .dash-new-today {
  136. left: 60px;
  137. background: linear-gradient(19deg, #070709 0%, #292947 100%);
  138. box-shadow: 10px 10px 10px #050814;
  139. }
  140. /* 3 小的仪表盘样式 */
  141. .dash-board-small {
  142. position: absolute;
  143. top: 0;
  144. width: calc(100% - 160px);
  145. height: 440px;
  146. margin: 0 80px;
  147. }
  148. .dash-board-small-lf,
  149. .dash-board-small-rg {
  150. position: relative;
  151. width: 113px;
  152. height: 440px;
  153. }
  154. #dashSmallBoardLeft,
  155. #dashSmallBoardRight {
  156. position: absolute;
  157. width: 100%;
  158. height: 100%;
  159. z-index: 2;
  160. }
  161. .small-content {
  162. position: absolute;
  163. color: #fff;
  164. width: 175px;
  165. padding: 10px 0px;
  166. background-size: 100% 100%;
  167. text-align: right;
  168. padding-right: 40px;
  169. }
  170. .small-lf-bg {
  171. background: url('/resources/img/dirve/dirve_small_bg.png') no-repeat;
  172. bottom: 20px;
  173. left: 80px;
  174. }
  175. .small-rg-bg {
  176. background: url('/resources/img/dirve/dirve_small_bg_back.png') no-repeat;
  177. bottom: 20px;
  178. right: 80px;
  179. z-index: 1;
  180. }
  181. .small-cont-num {
  182. font-size: 30px;
  183. color: #fff;
  184. }
  185. .small-cont-title {
  186. font-size: 20px;
  187. color: #F8F8F8;
  188. padding-top: 5px;
  189. }
  190. /* 仪表盘部分 end */
  191. /* 列表 */
  192. .drives-list-boxs {
  193. width: 100%;
  194. padding: 30px 40px 0;
  195. height: 400px;
  196. }
  197. .drives-list {
  198. position: relative;
  199. width: 200px;
  200. height: 240px;
  201. /* background: linear-gradient(137deg, #1947E4 0%, #14141A 25%, rgba(7, 7, 9, 0.89) 68%, rgba(20, 101, 255, 0.32) 100%);
  202. border-radius: 16px;
  203. border: 2px solid #001C7C; */
  204. background: url('/resources/img/dirve/data_bg.png') no-repeat;
  205. background-size: 100% 100%;
  206. overflow: hidden;
  207. cursor: pointer;
  208. }
  209. .drives-item {
  210. background: linear-gradient(137deg, #1947E4 0%, #14141A 25%, rgba(7, 7, 9, 0.89) 68%, rgba(20, 101, 255, 0.32) 100%);
  211. width: 196px;
  212. height: 236px;
  213. border-radius: 16px;
  214. }
  215. .drives-list-img {
  216. width: 60px;
  217. height: 60px;
  218. }
  219. .drives-list-text {
  220. font-size: 20px;
  221. color: #fff;
  222. }
  223. </style>
  224. <div id="app" v-cloak>
  225. <screen-contain text-left="总裁驾驶窗" >
  226. <template v-slot:right>
  227. <!-- <div class="sub-title" flex>
  228. <div class="sub-title-text">总线下门店:562310</div>
  229. <div class="sub-title-text">总线上门店:31235</div>
  230. </div> -->
  231. <header-time :is-display="isDisplay"></header-time>
  232. </template>
  233. <div class="president-driving-window" flex="dir:top">
  234. <!-- 仪表盘部分 -->
  235. <div class="president-driving-content">
  236. <!-- 中间 -->
  237. <div class="president-digital">
  238. <div id="middle-canvas"></div>
  239. <div class="digital-content">
  240. <div class="digital-title">总订单量(单)</div>
  241. <div class="digital-up" flex="main:center cross:center">
  242. <div class="digital-up-percent">{{echartsData.total_orders || 0}}</div>
  243. <img class="digital-up-img" src="/resources/img/dirve/up.png" alt="">
  244. </div>
  245. </div>
  246. <div class="digital-all">
  247. <div flex style="padding: 0 50px;">
  248. <div class="all-items" flex="dir:top main:center cross:center">
  249. <div class="all-items-amount">{{echartsData.today_new_users || 0}}</div>
  250. <div class="all-items-name">今日新增会员</div>
  251. </div>
  252. <div class="all-items" flex="dir:top main:center cross:center">
  253. <div class="all-items-amount">{{echartsData.today_total_pay_money || 0}}</div>
  254. <div class="all-items-name">今日交易额</div>
  255. </div>
  256. </div>
  257. <img src="/resources/img/dirve/dirve-bottom.png" alt="">
  258. </div>
  259. </div>
  260. <!-- 大的仪表盘 -->
  261. <div class="dash-board-big" flex="main:justify">
  262. <div class="dash-board-lf">
  263. <div id="dashBoardLeft"></div>
  264. <div class="dash-new-today" flex="dir:top main:center cross:center">
  265. <div class="today-num">{{numSystemVal(echartsData.total_users) || 0}}</div>
  266. <div class="today-title">总会员数</div>
  267. </div>
  268. </div>
  269. <div class="dash-board-rg">
  270. <div id="dashBoardRight"></div>
  271. <div class="dash-new-today" flex="dir:top main:center cross:center">
  272. <div class="today-num">{{numSystemVal(echartsData.total_pay_money) || 0}}</div>
  273. <div class="today-title">总交易额(元)</div>
  274. </div>
  275. </div>
  276. </div>
  277. <!-- 小的仪表盘 -->
  278. <div class="dash-board-small" flex="main:justify">
  279. <div class="dash-board-small-lf">
  280. <div id="dashSmallBoardLeft"></div>
  281. <div class="small-content small-lf-bg">
  282. <div class="small-cont-num">{{echartsData.total_views || 0}}</div>
  283. <div class="small-cont-title">今日浏览量</div>
  284. </div>
  285. </div>
  286. <div class="dash-board-small-rg">
  287. <div id="dashSmallBoardRight"></div>
  288. <div class="small-content small-rg-bg">
  289. <div class="small-cont-num">{{echartsData.today_total_visitors || 0}}</div>
  290. <div class="small-cont-title">今日访客量</div>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. <!-- 列表 -->
  296. <div class="drives-list-boxs" flex="main:around cross:center">
  297. <div class="drives-list" v-for="(item, index) in list" :key="index" flex="dir:top main:center cross:center" @click="item.router">
  298. <div class="drives-item" flex="dir:top main:center cross:center">
  299. <img class="drives-list-img" :src="item.img" alt="">
  300. <div class="drives-list-text">{{ item.name }}</div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </screen-contain>
  306. </div>
  307. <!-- <script src="/resources/js/echarts.min.js"></script> -->
  308. <!-- <script src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/echarts.min.js"></script> -->
  309. <script src="/resources/unpkg/echarts@5.2.2/dist/echarts.min.js"></script>
  310. <script>
  311. const app = new Vue({
  312. el: '#app',
  313. data() {
  314. return {
  315. isDisplay: 1,
  316. list: [{
  317. // name: '用户数据',
  318. name: '流量分析',
  319. img: '/resources/img/dirve/user_data.png',
  320. router:() => {
  321. this.$navigate({r: 'mall/data-census/flowan-alyse'})
  322. }
  323. },
  324. {
  325. // name: '交易数据',
  326. name: '商品数据',
  327. img: '/resources/img/dirve/transaction_data.png',
  328. router:() => {
  329. this.$navigate({r: 'mall/data-census/goods-statistics'})
  330. }
  331. },
  332. {
  333. // name: '数字平台',
  334. name: '会员分析',
  335. img: '/resources/img/dirve/digital_platform.png',
  336. router:() => {
  337. this.$navigate({r: 'mall/statistics/car-user-data'})
  338. }
  339. },
  340. /* {
  341. name: '直播平台',
  342. img: '/resources/img/dirve/live_data.png',
  343. router:() => {
  344. this.$navigate({r: 'mall/overview/sales-data'})
  345. }
  346. }, */
  347. {
  348. // name: '商家数据',
  349. name: '交易数据',
  350. img: '/resources/img/dirve/business_data.png',
  351. router:() => {
  352. this.$navigate({r: 'mall/statistics/car-user-trad-data'})
  353. }
  354. },
  355. {
  356. name: '价值分析',
  357. img: '/resources/img/dirve/conversion_analysis.png',
  358. router:() => {
  359. this.$navigate({r: 'mall/statistics/car-analysis'})
  360. }
  361. },
  362. ],
  363. echartsData: {}
  364. }
  365. },
  366. created() {
  367. this.isDisplay = "<?php echo $is_display?>"
  368. },
  369. mounted() {
  370. this.getEhartsData();
  371. // this.startHeight()
  372. },
  373. methods: {
  374. getEhartsData(){
  375. let that = this;
  376. request({
  377. params: {
  378. r: 'mall/data-census/driving-window',
  379. },
  380. method: 'get'
  381. }).then(e => {
  382. if (e.data.code === 0) {
  383. console.info(e.data.data);
  384. // navigateTo({r: 'mall/user/index', page: getQuery('page')});
  385. this.echartsData = e.data.data;
  386. } else {
  387. this.$message.error(e.data.msg);
  388. }
  389. that.getEharts()
  390. });
  391. },
  392. startHeight() {
  393. const clientWidth = this.$refs.clientHeight.clientWidth;
  394. const vNode = this.$refs.clientHeight
  395. vNode.style.height = this.getHeight(clientWidth) + "px"
  396. },
  397. getHeight(width) {
  398. return width / (448 / 108)
  399. },
  400. handleChartData(data) {
  401. let obj = {
  402. type: data.type || 'pie',
  403. radius: data.radius || '20%',
  404. center: data.center || ['50%', '50%'],
  405. z: data.center || -1,
  406. itemStyle: {
  407. normal: {
  408. borderColor: data.itemStyle.borderColor || '',
  409. width: data.itemStyle.width || '',
  410. color: data.itemStyle.color || 'transparent',
  411. label: {
  412. show: false
  413. },
  414. labelLine: {
  415. show: false
  416. }
  417. },
  418. },
  419. hoverAnimation: false,
  420. label: {
  421. show: false,
  422. },
  423. tooltip: {
  424. show: false
  425. },
  426. data: [100],
  427. animationType: "scale",
  428. }
  429. return obj
  430. },
  431. getEharts() {
  432. // 中间左右部分
  433. this.echartCenter();
  434. // 外层部分
  435. this.echartOuter();
  436. var middleCanvas = echarts.init(document.getElementById('middle-canvas'))
  437. middleCanvas.setOption({
  438. series: [{
  439. name: '下一层',
  440. type: 'gauge',
  441. startAngle: 90,
  442. endAngle: -270,
  443. min: 0,
  444. max: this.getNumMax(this.echartsData.total_orders,100),
  445. splitNumber: 12,
  446. z: 0,
  447. zlevel: 0,
  448. progress: {
  449. show: true,
  450. width: 18,
  451. itemStyle: {
  452. color: {
  453. type: 'linear',
  454. x: 0,
  455. y: 0,
  456. x2: 0,
  457. y2: 1,
  458. colorStops: [{
  459. offset: 1,
  460. color: '#45ECFA' // 0% 处的颜色
  461. }, {
  462. offset: 0.49,
  463. color: '#003DE8' // 100% 处的颜色
  464. }, {
  465. offset: 0,
  466. color: '#000735' // 100% 处的颜色
  467. }],
  468. global: false // 缺省为 false
  469. }
  470. }
  471. },
  472. axisLine: {
  473. lineStyle: {
  474. width: 18,
  475. color: [
  476. [1, '#001A72']
  477. ]
  478. }
  479. },
  480. axisTick: {
  481. show: false
  482. },
  483. splitLine: {
  484. show: false
  485. },
  486. axisLabel: {
  487. show: false
  488. },
  489. pointer: {
  490. width: 10,
  491. icon: 'triangle',
  492. itemStyle: {
  493. color: {
  494. type: 'linear',
  495. x: 0,
  496. y: 0,
  497. x2: 0,
  498. y2: 1,
  499. colorStops: [{
  500. offset: 1,
  501. color: '#070709' // 0% 处的颜色
  502. }, {
  503. offset: 0.45,
  504. color: '#0034E4' // 100% 处的颜色
  505. }, {
  506. offset: 0.07,
  507. color: '#09F7FA' // 100% 处的颜色
  508. }, {
  509. offset: 0,
  510. color: '#BCFEFF' // 100% 处的颜色
  511. }],
  512. global: false // 缺省为 false
  513. }
  514. }
  515. },
  516. anchor: {
  517. show: false
  518. },
  519. title: {
  520. show: false
  521. },
  522. detail: {
  523. show: false
  524. },
  525. data: [{
  526. value: this.echartsData.total_orders
  527. }]
  528. },
  529. {
  530. name: '上一层',
  531. type: 'gauge',
  532. startAngle: 90,
  533. endAngle: -270,
  534. min: 0,
  535. max: this.getNumMax(this.echartsData.total_orders,100),
  536. splitNumber: 12,
  537. zLevel: 2,
  538. z: 2,
  539. progress: {
  540. show: false
  541. },
  542. axisLine: {
  543. show: false,
  544. lineStyle: {
  545. width: 18,
  546. color: [
  547. [1, '#001A72']
  548. ]
  549. }
  550. },
  551. axisTick: {
  552. show: false
  553. },
  554. splitLine: {
  555. length: 10,
  556. distance: -17,
  557. lineStyle: {
  558. width: 2,
  559. color: '#002091'
  560. }
  561. },
  562. axisLabel: {
  563. show: false
  564. },
  565. pointer: {
  566. show: false,
  567. },
  568. anchor: {
  569. show: false
  570. },
  571. title: {
  572. show: false
  573. },
  574. detail: {
  575. show: false
  576. },
  577. data: [{
  578. value: this.echartsData.total_orders
  579. }]
  580. },
  581. { // 圆环
  582. type: 'pie',
  583. radius: '30%',
  584. center: ['50%', '50%'],
  585. z: -1,
  586. itemStyle: {
  587. normal: {
  588. borderColor: '#1F223B',
  589. color: '#020529'
  590. // color: new echarts.graphic.RadialGradient(.5, .5, .8, [{
  591. // offset: 0,
  592. // color: '#4978EC'
  593. // },
  594. // {
  595. // offset: .5,
  596. // color: '#1E2B57'
  597. // },
  598. // {
  599. // offset: 1,
  600. // color: '#141F3D'
  601. // }
  602. // ], false),
  603. // label: {
  604. // show: false
  605. // },
  606. // labelLine: {
  607. // show: false
  608. // }
  609. },
  610. },
  611. hoverAnimation: false,
  612. label: {
  613. show: false,
  614. },
  615. tooltip: {
  616. show: false
  617. },
  618. data: [100],
  619. animationType: "scale"
  620. }
  621. ]
  622. })
  623. },
  624. echartOuter(){
  625. var dashSmallBoardLeft = echarts.init(document.getElementById('dashSmallBoardLeft'));
  626. let defConfig = {
  627. type: 'gauge',
  628. min: 0,
  629. // max: this.getNumMax(this.echartsData.total_views),
  630. startAngle: -110,
  631. endAngle: -250,
  632. splitNumber: 2,
  633. radius: 113,
  634. center: ['100%', '70%'],
  635. progress: {
  636. show: true,
  637. width: 25,
  638. itemStyle: {
  639. color: {
  640. type: 'linear',
  641. x: 0,
  642. y: 0,
  643. x2: 0,
  644. y2: 1,
  645. colorStops: [{
  646. offset: 1,
  647. color: '#0234E5' // 0% 处的颜色
  648. }, {
  649. offset: 0.75,
  650. color: '#1465FF' // 100% 处的颜色
  651. }, {
  652. offset: 0.61,
  653. color: '#1465FF' // 100% 处的颜色
  654. }, {
  655. offset: 0.42,
  656. color: '#2069E4' // 100% 处的颜色
  657. }, {
  658. offset: 0,
  659. color: '#55F7FB' // 100% 处的颜色
  660. }],
  661. global: false // 缺省为 false
  662. },
  663. borderWidth: 1,
  664. borderColor: '#FFFFFF'
  665. }
  666. },
  667. axisLine: {
  668. lineStyle: {
  669. width: 25,
  670. color: [
  671. [1, '#031D79']
  672. ]
  673. },
  674. },
  675. splitLine: {
  676. show: true,
  677. distance: -15,
  678. length: 15,
  679. lineStyle: {
  680. color: '#FFFFFF',
  681. width: 2
  682. }
  683. },
  684. axisTick: {
  685. show: false
  686. },
  687. axisLabel: {
  688. show: true,
  689. distance: 30,
  690. color: '#F8F8F8',
  691. formatter: function(value) {
  692. if (value < 1000) {
  693. return value
  694. } else if (value >= 1000 && value < 10000) {
  695. return `${value / 1000}K`
  696. } else {
  697. return `${value / 10000}W`
  698. }
  699. }
  700. },
  701. anchor: {},
  702. pointer: {
  703. width: 20,
  704. icon: 'triangle',
  705. length: '50%',
  706. itemStyle: {
  707. color: {
  708. type: 'linear',
  709. x: 0,
  710. y: 0,
  711. x2: 0,
  712. y2: 1,
  713. colorStops: [{
  714. offset: 1,
  715. color: '#070709' // 0% 处的颜色
  716. }, {
  717. offset: 0.45,
  718. color: '#0034E4' // 100% 处的颜色
  719. }, {
  720. offset: 0.07,
  721. color: '#09F7FA' // 100% 处的颜色
  722. }, {
  723. offset: 0,
  724. color: '#BCFEFF' // 100% 处的颜色
  725. }],
  726. global: false // 缺省为 false
  727. }
  728. }
  729. },
  730. detail: {
  731. show: false
  732. },
  733. title: {
  734. show: false
  735. },
  736. /* data: [{
  737. value: this.echartsData.total_views
  738. }] */
  739. }
  740. dashSmallBoardLeft.setOption({
  741. series: [
  742. {
  743. ...defConfig,
  744. name: 'dash-small-board-left',
  745. max: this.getNumMax(this.echartsData.total_views),
  746. data: [{
  747. value: this.echartsData.total_views
  748. }],
  749. }
  750. ]
  751. })
  752. var dashSmallBoardRight = echarts.init(document.getElementById('dashSmallBoardRight'));
  753. dashSmallBoardRight.setOption({
  754. series: [
  755. {
  756. ...defConfig,
  757. clockwise: false,
  758. name: 'dash-small-board-right1',
  759. max: this.getNumMax(this.echartsData.today_total_visitors),
  760. data: [{
  761. value: this.echartsData.today_total_visitors
  762. }],
  763. center: ['0', '70%'],
  764. startAngle: 80,
  765. endAngle: -80,
  766. axisLine: {
  767. show: false,
  768. lineStyle: {
  769. width: 5,
  770. color: [
  771. [1, '#031D79']
  772. ]
  773. },
  774. },
  775. splitLine: {
  776. show: false
  777. },
  778. },
  779. {
  780. ...defConfig,
  781. name: 'dash-small-board-right2',
  782. type: 'gauge',
  783. min: 0,
  784. max: this.getNumMax(this.echartsData.today_total_visitors),
  785. startAngle: 80,
  786. endAngle: -80,
  787. splitNumber: 2,
  788. radius: 113,
  789. center: ['0', '70%'],
  790. progress: {
  791. show: false
  792. },
  793. axisLine: {
  794. lineStyle: {
  795. width: 25,
  796. color: [
  797. [1, '#031D79']
  798. ]
  799. },
  800. },
  801. splitLine: {
  802. show: true,
  803. distance: -15,
  804. length: 15,
  805. lineStyle: {
  806. color: '#FFFFFF',
  807. width: 2
  808. }
  809. },
  810. axisTick: {
  811. show: false
  812. },
  813. axisLabel: {
  814. show: false
  815. },
  816. anchor: {},
  817. pointer: {
  818. show: false
  819. },
  820. detail: {
  821. show: false
  822. },
  823. title: {
  824. show: false
  825. },
  826. }
  827. ]
  828. })
  829. },
  830. echartCenter(){
  831. var myChartObj = {
  832. type: 'gauge',
  833. progress: {
  834. show: true,
  835. width: 35,
  836. roundCap: true,
  837. itemStyle: {
  838. color: {
  839. type: 'linear',
  840. x: 0,
  841. y: 0,
  842. x2: 0,
  843. y2: 1,
  844. colorStops: [{
  845. offset: 1,
  846. color: '#0234E5' // 0% 处的颜色
  847. }, {
  848. offset: 0.75,
  849. color: '#1465FF' // 100% 处的颜色
  850. }, {
  851. offset: 0.61,
  852. color: '#1465FF' // 100% 处的颜色
  853. }, {
  854. offset: 0.42,
  855. color: '#2069E4' // 100% 处的颜色
  856. }, {
  857. offset: 0,
  858. color: '#55F7FB' // 100% 处的颜色
  859. }],
  860. global: false // 缺省为 false
  861. }
  862. }
  863. },
  864. axisLine: {
  865. lineStyle: {
  866. width: 35,
  867. color: [
  868. [1, '#031D79']
  869. ]
  870. },
  871. roundCap: true
  872. },
  873. axisTick: {
  874. show: false
  875. },
  876. splitLine: {
  877. show: false
  878. },
  879. axisLabel: {
  880. distance: 25,
  881. color: '#999',
  882. fontSize: 16,
  883. formatter: function(value) {
  884. if (value < 1000) {
  885. return value
  886. } else if (value >= 1000 && value < 10000) {
  887. return `${(value / 1000).toFixed()}K`
  888. } else {
  889. return `${(value / 10000).toFixed()}W`
  890. }
  891. }
  892. },
  893. anchor: {
  894. show: false,
  895. },
  896. pointer: {
  897. width: 10,
  898. itemStyle: {
  899. color: {
  900. type: 'linear',
  901. x: 0,
  902. y: 0,
  903. x2: 0,
  904. y2: 1,
  905. colorStops: [{
  906. offset: 1,
  907. color: '#070709' // 0% 处的颜色
  908. }, {
  909. offset: 0.45,
  910. color: '#0034E4' // 100% 处的颜色
  911. }, {
  912. offset: 0.07,
  913. color: '#09F7FA' // 100% 处的颜色
  914. }, {
  915. offset: 0,
  916. color: '#BCFEFF' // 100% 处的颜色
  917. }],
  918. global: false // 缺省为 false
  919. }
  920. }
  921. },
  922. title: {
  923. show: false
  924. },
  925. detail: {
  926. show: false
  927. },
  928. min: 0,
  929. // max: 100000,
  930. splitNumber: 10,
  931. }
  932. var myChartCircleComm1 = {
  933. type: 'pie',
  934. radius: '20%',
  935. center: ['50%', '50%'],
  936. z: -1,
  937. itemStyle: {
  938. normal: {
  939. color: new echarts.graphic.RadialGradient(.5, .5, .8, [{
  940. offset: 0,
  941. color: '#4978EC'
  942. },
  943. {
  944. offset: .5,
  945. color: '#1E2B57'
  946. },
  947. {
  948. offset: 1,
  949. color: '#141F3D'
  950. }
  951. ], false),
  952. label: {
  953. show: false
  954. },
  955. labelLine: {
  956. show: false
  957. }
  958. },
  959. },
  960. hoverAnimation: false,
  961. label: {
  962. show: false,
  963. },
  964. tooltip: {
  965. show: false
  966. },
  967. data: [100],
  968. animationType: "scale"
  969. }
  970. var myChartCircleComm2 = {
  971. type: 'pie',
  972. radius: '30%',
  973. center: ['50%', '50%'],
  974. z: -2,
  975. itemStyle: {
  976. normal: {
  977. width: '4',
  978. borderColor: '#212131',
  979. color: 'transparent'
  980. },
  981. },
  982. hoverAnimation: false,
  983. label: {
  984. show: false,
  985. },
  986. tooltip: {
  987. show: false
  988. },
  989. data: [100],
  990. animationType: "scale"
  991. }
  992. var myChart1 = echarts.init(document.getElementById('dashBoardLeft'));
  993. myChart1.setOption({
  994. series: [{
  995. name: 'dash-board-left',
  996. ...myChartObj,
  997. data: [{
  998. value: this.echartsData.total_users
  999. }],
  1000. max: this.getNumMax(this.echartsData.total_users)
  1001. },
  1002. myChartCircleComm1,
  1003. myChartCircleComm2
  1004. ]
  1005. })
  1006. var myChart2 = echarts.init(document.getElementById('dashBoardRight'));
  1007. myChart2.setOption({
  1008. series: [
  1009. {
  1010. name: 'gauge-midle-big1',
  1011. clockwise: false,
  1012. ...myChartObj,
  1013. axisLine: {
  1014. show: false,
  1015. },
  1016. axisLabel: {
  1017. show: false,
  1018. },
  1019. data: [{
  1020. value: this.echartsData.total_pay_money
  1021. }],
  1022. max: this.getNumMax(this.echartsData.total_pay_money),
  1023. },
  1024. {
  1025. name: 'gauge-midle-big1',
  1026. type: 'gauge',
  1027. progress: {
  1028. show: false,
  1029. },
  1030. axisLine: {
  1031. lineStyle: {
  1032. width: 35,
  1033. color: [
  1034. [1, '#031D79']
  1035. ]
  1036. },
  1037. roundCap: true
  1038. },
  1039. axisTick: {
  1040. show: false
  1041. },
  1042. splitLine: {
  1043. show: false
  1044. },
  1045. axisLabel: {
  1046. show: true,
  1047. distance: 25,
  1048. color: '#999',
  1049. fontSize: 16,
  1050. formatter: function(value) {
  1051. // value = Number(value)
  1052. if (value < 1000) {
  1053. return value
  1054. } else if (value >= 1000 && value < 10000) {
  1055. return `${value / 1000}K`
  1056. } else {
  1057. return `${value / 10000}W`
  1058. }
  1059. }
  1060. },
  1061. anchor: {
  1062. show: false,
  1063. },
  1064. pointer: {
  1065. show: false
  1066. },
  1067. title: {
  1068. show: false
  1069. },
  1070. detail: {
  1071. show: false
  1072. },
  1073. min: this.getNumMax(this.echartsData.total_pay_money),
  1074. max: 0,
  1075. splitNumber: 10,
  1076. },
  1077. myChartCircleComm1,
  1078. myChartCircleComm2
  1079. ]
  1080. })
  1081. },
  1082. getNumMax(num=0,max=10000){
  1083. let length = (num/max).toFixed();
  1084. if(length > 1){
  1085. let addMax = Math.pow(10, String(length).length);
  1086. max *= Number(addMax);
  1087. }
  1088. return Number(max);
  1089. },
  1090. numSystemVal(val) {
  1091. if(isNaN(val)){
  1092. val = '-'
  1093. }else if (val * 1 < 10000) {
  1094. val = val * 1
  1095. } else {
  1096. if ((val * 1) % 1000000 == 0) {
  1097. val = parseInt((val * 1) / 10000) + 'W'
  1098. } else {
  1099. val = parseInt((val * 1) / 10000) + 'W+'
  1100. }
  1101. }
  1102. return val
  1103. }
  1104. }
  1105. })
  1106. </script>