index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. <template>
  2. <div class="index-container">
  3. <el-row :gutter="20">
  4. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  5. <el-alert v-if="noticeList[0]" :closable="noticeList[0].closable">
  6. <div
  7. style="display: flex; align-items: center; justify-content: center"
  8. >
  9. <a
  10. target="_blank"
  11. href="https://github.com/chuzhixin/vue-admin-beautiful"
  12. >
  13. <img
  14. style="margin-right: 10px"
  15. src="https://img.shields.io/github/stars/chuzhixin/vue-admin-beautiful?style=flat-square&label=Stars&logo=github"
  16. />
  17. </a>
  18. {{ noticeList[0].title }}
  19. </div>
  20. </el-alert>
  21. </el-col>
  22. <el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6">
  23. <el-card shadow="never">
  24. <div slot="header">
  25. <span>访问量</span>
  26. </div>
  27. <vab-chart
  28. :autoresize="true"
  29. theme="vab-echarts-theme"
  30. :options="fwl"
  31. />
  32. <div class="bottom">
  33. <span>
  34. 日均访问量:
  35. <vab-count
  36. :start-val="config1.startVal"
  37. :end-val="config1.endVal"
  38. :duration="config1.duration"
  39. :separator="config1.separator"
  40. :prefix="config1.prefix"
  41. :suffix="config1.suffix"
  42. :decimals="config1.decimals"
  43. />
  44. </span>
  45. </div>
  46. </el-card>
  47. </el-col>
  48. <el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6">
  49. <el-card shadow="never">
  50. <div slot="header">
  51. <span>授权数</span>
  52. </div>
  53. <vab-chart
  54. :autoresize="true"
  55. theme="vab-echarts-theme"
  56. :options="sqs"
  57. />
  58. <div class="bottom">
  59. <span>
  60. 总授权数:
  61. <vab-count
  62. :start-val="config2.startVal"
  63. :end-val="config2.endVal"
  64. :duration="config2.duration"
  65. :separator="config2.separator"
  66. :prefix="config2.prefix"
  67. :suffix="config2.suffix"
  68. :decimals="config2.decimals"
  69. />
  70. </span>
  71. </div>
  72. </el-card>
  73. </el-col>
  74. <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
  75. <el-card shadow="never">
  76. <div slot="header">
  77. <span>词云</span>
  78. </div>
  79. <vab-chart
  80. :autoresize="true"
  81. theme="vab-echarts-theme"
  82. :options="cy"
  83. @zr:click="handleZrClick"
  84. @click="handleClick"
  85. />
  86. <div class="bottom">
  87. <span>
  88. 词云数量:
  89. <vab-count
  90. :start-val="config3.startVal"
  91. :end-val="config3.endVal"
  92. :duration="config3.duration"
  93. :separator="config3.separator"
  94. :prefix="config3.prefix"
  95. :suffix="config3.suffix"
  96. :decimals="config3.decimals"
  97. />
  98. </span>
  99. </div>
  100. </el-card>
  101. </el-col>
  102. <el-col
  103. v-for="(item, index) in iconList"
  104. :key="index"
  105. :xs="12"
  106. :sm="6"
  107. :md="3"
  108. :lg="3"
  109. :xl="3"
  110. >
  111. <router-link :to="item.link" target="_blank">
  112. <el-card class="icon-panel" shadow="never">
  113. <vab-icon
  114. :style="{ color: item.color }"
  115. :icon="['fas', item.icon]"
  116. ></vab-icon>
  117. <p>{{ item.title }}</p>
  118. </el-card>
  119. </router-link>
  120. </el-col>
  121. <el-col :xs="24" :sm="24" :md="24" :lg="13" :xl="13">
  122. <el-card class="card" shadow="never">
  123. <div slot="header">
  124. <span>GDP分布图</span>
  125. </div>
  126. <vab-chart
  127. :autoresize="true"
  128. theme="vab-echarts-theme"
  129. :options="zgdt"
  130. />
  131. </el-card>
  132. </el-col>
  133. <el-col :xs="24" :sm="24" :md="24" :lg="11" :xl="11">
  134. <el-card class="card" shadow="never">
  135. <div slot="header">
  136. <span>依赖信息</span>
  137. <div style="float: right">部署时间:{{ updateTime }}</div>
  138. </div>
  139. <div class="bottom-btn">
  140. <el-popover placement="top" width="250" trigger="hover">
  141. <p>
  142. 这是一个付费群,谢谢您愿意支持开源,加群获取详细文档,群内提供vue-admin-beautiful-template基础模板
  143. </p>
  144. <el-image :src="require('@/assets/ewm.png')"></el-image>
  145. <a slot="reference" target="_blank">
  146. <el-button type="primary">QQ讨论群</el-button>
  147. </a>
  148. </el-popover>
  149. <a @click="handleChangeTheme">
  150. <el-button type="danger">修改主题和布局</el-button>
  151. </a>
  152. <a
  153. target="_blank"
  154. href="https://github.com/chuzhixin/vue-admin-beautiful"
  155. >
  156. <el-button type="warning">
  157. github下载源码点star(实时更新)
  158. </el-button>
  159. </a>
  160. <a
  161. target="_blank"
  162. href="https://gitee.com/chu1204505056/vue-admin-beautiful"
  163. >
  164. <el-button type="warning">码云下载源码点star</el-button>
  165. </a>
  166. <el-popover placement="top" width="250" trigger="hover">
  167. <p>
  168. 谢谢您愿意支持开源,加群获取详细教程,群内提供vue-admin-beautiful-template基础模板
  169. </p>
  170. <el-image :src="require('@/assets/ewm.png')"></el-image>
  171. <a slot="reference" target="_blank">
  172. <el-button type="warning">文档</el-button>
  173. </a>
  174. </el-popover>
  175. </div>
  176. <table class="table">
  177. <tr>
  178. <td>@vue/cli版本</td>
  179. <td>{{ devDependencies['@vue/cli-service'] }}</td>
  180. <td>vue版本</td>
  181. <td>{{ dependencies['vue'] }}</td>
  182. </tr>
  183. <tr>
  184. <td>vuex版本</td>
  185. <td>{{ dependencies['vuex'] }}</td>
  186. <td>vue-router版本</td>
  187. <td>{{ dependencies['vue-router'] }}</td>
  188. </tr>
  189. <tr>
  190. <td>element-ui版本</td>
  191. <td>{{ dependencies['element-ui'] }}</td>
  192. <td>axios版本</td>
  193. <td>{{ dependencies['axios'] }}</td>
  194. </tr>
  195. <tr>
  196. <td>eslint版本</td>
  197. <td>{{ devDependencies['eslint'] }}</td>
  198. <td>prettier版本</td>
  199. <td>{{ devDependencies['prettier'] }}</td>
  200. </tr>
  201. <tr>
  202. <td>sass版本</td>
  203. <td>{{ devDependencies['sass'] }}</td>
  204. <td>mockjs版本</td>
  205. <td>{{ dependencies['mockjs'] }}</td>
  206. </tr>
  207. <tr>
  208. <td>zx-layouts版本</td>
  209. <td>{{ dependencies['zx-layouts'] }}</td>
  210. <td>lodash版本</td>
  211. <td>{{ dependencies['lodash'] }}</td>
  212. </tr>
  213. </table>
  214. </el-card>
  215. </el-col>
  216. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  217. <el-card class="card" shadow="never">
  218. <div slot="header">
  219. <span>更新日志</span>
  220. </div>
  221. <el-timeline :reverse="reverse">
  222. <el-timeline-item
  223. v-for="(activity, index) in activities"
  224. :key="index"
  225. :timestamp="activity.timestamp"
  226. :color="activity.color"
  227. >
  228. {{ activity.content }}
  229. </el-timeline-item>
  230. </el-timeline>
  231. </el-card>
  232. </el-col>
  233. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  234. <el-card shadow="never">
  235. <div slot="header">
  236. <span>其他信息</span>
  237. </div>
  238. <div style="text-align: center">
  239. <vab-colorful-icon style="font-size: 140px" icon-class="vab" />
  240. <h1 style="font-size: 30px">vue-admin-beautiful</h1>
  241. </div>
  242. <div v-for="(item, index) in noticeList" :key="index">
  243. <el-alert
  244. v-if="index !== 0"
  245. :title="item.title"
  246. :type="item.type"
  247. :closable="item.closable"
  248. ></el-alert>
  249. <br />
  250. </div>
  251. <el-alert :closable="false" :title="userAgent" type="info"></el-alert>
  252. <br />
  253. </el-card>
  254. <el-card shadow="never">
  255. <div slot="header">
  256. <span>关于开发者</span>
  257. </div>
  258. <img
  259. src="https://github-readme-stats.vercel.app/api?username=chuzhixin"
  260. alt=""
  261. />
  262. </el-card>
  263. </el-col>
  264. </el-row>
  265. </div>
  266. </template>
  267. <script>
  268. import VabChart from '@/plugins/echarts'
  269. import { dependencies, devDependencies } from '../../../package.json'
  270. import { getList } from '@/api/changeLog'
  271. import { getNoticeList } from '@/api/notice'
  272. import { getRepos, getStargazers } from '@/api/github'
  273. export default {
  274. name: 'Index',
  275. components: {
  276. VabChart,
  277. },
  278. data() {
  279. return {
  280. timer: 0,
  281. updateTime: process.env.VUE_APP_UPDATE_TIME,
  282. nodeEnv: process.env.NODE_ENV,
  283. dependencies: dependencies,
  284. devDependencies: devDependencies,
  285. config1: {
  286. startVal: 0,
  287. endVal: this.$baseLodash.random(20000, 60000),
  288. decimals: 0,
  289. prefix: '',
  290. suffix: '',
  291. separator: ',',
  292. duration: 8000,
  293. },
  294. config2: {
  295. startVal: 0,
  296. endVal: this.$baseLodash.random(1000, 20000),
  297. decimals: 0,
  298. prefix: '',
  299. suffix: '',
  300. separator: ',',
  301. duration: 8000,
  302. },
  303. config3: {
  304. startVal: 0,
  305. endVal: this.$baseLodash.random(1000, 20000),
  306. decimals: 0,
  307. prefix: '',
  308. suffix: '',
  309. separator: ',',
  310. duration: 8000,
  311. },
  312. //访问量
  313. fwl: {
  314. grid: {
  315. top: '4%',
  316. left: '2%',
  317. right: '4%',
  318. bottom: '0%',
  319. containLabel: true,
  320. },
  321. xAxis: [
  322. {
  323. type: 'category',
  324. boundaryGap: false,
  325. data: [],
  326. axisTick: {
  327. alignWithLabel: true,
  328. },
  329. },
  330. ],
  331. yAxis: [
  332. {
  333. type: 'value',
  334. },
  335. ],
  336. series: [
  337. {
  338. name: '访问量',
  339. type: 'line',
  340. data: [],
  341. smooth: true,
  342. areaStyle: {},
  343. },
  344. ],
  345. },
  346. //授权数
  347. sqs: {
  348. grid: {
  349. top: '4%',
  350. left: '2%',
  351. right: '4%',
  352. bottom: '0%',
  353. containLabel: true,
  354. },
  355. xAxis: [
  356. {
  357. type: 'category',
  358. /*boundaryGap: false,*/
  359. data: ['0时', '4时', '8时', '12时', '16时', '20时', '24时'],
  360. axisTick: {
  361. alignWithLabel: true,
  362. },
  363. },
  364. ],
  365. yAxis: [
  366. {
  367. type: 'value',
  368. },
  369. ],
  370. series: [
  371. {
  372. name: '授权数',
  373. type: 'bar',
  374. barWidth: '60%',
  375. data: [10, 52, 20, 33, 39, 33, 22],
  376. },
  377. ],
  378. },
  379. //词云
  380. cy: {
  381. grid: {
  382. top: '4%',
  383. left: '2%',
  384. right: '4%',
  385. bottom: '0%',
  386. },
  387. series: [
  388. {
  389. type: 'wordCloud',
  390. gridSize: 15,
  391. sizeRange: [12, 40],
  392. rotationRange: [0, 0],
  393. width: '100%',
  394. height: '100%',
  395. textStyle: {
  396. normal: {
  397. color() {
  398. const arr = [
  399. '#1890FF',
  400. '#36CBCB',
  401. '#4ECB73',
  402. '#FBD437',
  403. '#F2637B',
  404. '#975FE5',
  405. ]
  406. let index = Math.floor(Math.random() * arr.length)
  407. return arr[index]
  408. },
  409. },
  410. },
  411. data: [
  412. {
  413. name: 'vue-admin-beautiful',
  414. value: 15000,
  415. },
  416. {
  417. name: 'element',
  418. value: 10081,
  419. },
  420. {
  421. name: 'beautiful',
  422. value: 9386,
  423. },
  424. {
  425. name: 'vue',
  426. value: 6500,
  427. },
  428. {
  429. name: 'chuzhixin',
  430. value: 6000,
  431. },
  432. {
  433. name: 'good',
  434. value: 4500,
  435. },
  436. {
  437. name: 'success',
  438. value: 3800,
  439. },
  440. {
  441. name: 'never',
  442. value: 3000,
  443. },
  444. {
  445. name: 'boy',
  446. value: 2500,
  447. },
  448. {
  449. name: 'girl',
  450. value: 2300,
  451. },
  452. {
  453. name: 'github',
  454. value: 2000,
  455. },
  456. {
  457. name: 'hbuilder',
  458. value: 1900,
  459. },
  460. {
  461. name: 'dcloud',
  462. value: 1800,
  463. },
  464. {
  465. name: 'china',
  466. value: 1700,
  467. },
  468. {
  469. name: '1204505056',
  470. value: 1600,
  471. },
  472. {
  473. name: '972435319',
  474. value: 1500,
  475. },
  476. {
  477. name: 'young',
  478. value: 1200,
  479. },
  480. {
  481. name: 'old',
  482. value: 1100,
  483. },
  484. {
  485. name: 'vuex',
  486. value: 900,
  487. },
  488. {
  489. name: 'router',
  490. value: 800,
  491. },
  492. {
  493. name: 'money',
  494. value: 700,
  495. },
  496. {
  497. name: 'qingdao',
  498. value: 800,
  499. },
  500. {
  501. name: 'yantai',
  502. value: 9000,
  503. },
  504. {
  505. name: 'author is very cool',
  506. value: 9200,
  507. },
  508. ],
  509. },
  510. ],
  511. },
  512. //中国地图
  513. zgdt: {
  514. title: {
  515. text: '2099年全国GDP分布',
  516. subtext: '数据来自vue-admin-beautiful杜撰',
  517. },
  518. tooltip: {
  519. trigger: 'item',
  520. },
  521. dataRange: {
  522. orient: 'horizontal',
  523. min: 0,
  524. max: 55000,
  525. text: ['高', '低'],
  526. splitNumber: 0,
  527. },
  528. series: [
  529. {
  530. name: '2099年全国GDP分布',
  531. type: 'map',
  532. roam: false,
  533. zoom: 1.25,
  534. mapType: 'china',
  535. mapLocation: {
  536. x: 'center',
  537. },
  538. selectedMode: 'multiple',
  539. itemStyle: {
  540. normal: {
  541. label: {
  542. show: false,
  543. },
  544. },
  545. emphasis: {
  546. label: {
  547. show: true,
  548. },
  549. },
  550. },
  551. data: [
  552. { name: '西藏', value: 605.83 },
  553. { name: '青海', value: 1670.44 },
  554. { name: '宁夏', value: 2102.21 },
  555. { name: '海南', value: 2522.66 },
  556. { name: '甘肃', value: 5020.37 },
  557. { name: '贵州', value: 5701.84 },
  558. { name: '新疆', value: 6610.05 },
  559. { name: '云南', value: 8893.12 },
  560. { name: '重庆', value: 10011.37 },
  561. { name: '吉林', value: 10568.83 },
  562. { name: '山西', value: 11237.55 },
  563. { name: '天津', value: 11307.28 },
  564. { name: '江西', value: 11702.82 },
  565. { name: '广西', value: 11720.87 },
  566. { name: '陕西', value: 12512.3 },
  567. { name: '黑龙江', value: 12582 },
  568. { name: '内蒙古', value: 14359.88 },
  569. { name: '安徽', value: 15300.65 },
  570. { name: '北京', value: 16251.93 },
  571. { name: '福建', value: 17560.18 },
  572. { name: '上海', value: 19195.69 },
  573. { name: '湖北', value: 19632.26 },
  574. { name: '湖南', value: 19669.56 },
  575. { name: '四川', value: 21026.68 },
  576. { name: '辽宁', value: 22226.7 },
  577. { name: '河北', value: 24515.76 },
  578. { name: '河南', value: 26931.03 },
  579. { name: '浙江', value: 32318.85 },
  580. { name: '山东', value: 45361.85, selected: true },
  581. { name: '江苏', value: 49110.27 },
  582. { name: '广东', value: 53210.28 },
  583. ],
  584. },
  585. ],
  586. },
  587. //更新日志
  588. reverse: true,
  589. activities: [],
  590. noticeList: [],
  591. //其他信息
  592. userAgent: navigator.userAgent,
  593. //卡片图标
  594. iconList: [
  595. {
  596. icon: 'video',
  597. title: '视频播放器',
  598. link: '/vab/player',
  599. color: '#ffc069',
  600. },
  601. {
  602. icon: 'table',
  603. title: '表格',
  604. link: '/vab/table/comprehensiveTable',
  605. color: '#5cdbd3',
  606. },
  607. {
  608. icon: 'laptop-code',
  609. title: '源码',
  610. link: 'https://github.com/chuzhixin/vue-admin-beautiful',
  611. color: '#b37feb',
  612. },
  613. {
  614. icon: 'book',
  615. title: '书籍',
  616. link: '',
  617. color: '#69c0ff',
  618. },
  619. {
  620. icon: 'bullhorn',
  621. title: '公告',
  622. link: '',
  623. color: '#ff85c0',
  624. },
  625. {
  626. icon: 'gift',
  627. title: '礼物',
  628. link: '',
  629. color: '#ffd666',
  630. },
  631. {
  632. icon: 'balance-scale-left',
  633. title: '公平的世界',
  634. link: '',
  635. color: '#ff9c6e',
  636. },
  637. {
  638. icon: 'coffee',
  639. title: '休息一下',
  640. link: '',
  641. color: '#95de64',
  642. },
  643. ],
  644. }
  645. },
  646. created() {
  647. this.fetchData()
  648. },
  649. beforeDestroy() {
  650. clearInterval(this.timer)
  651. },
  652. mounted() {
  653. let base = +new Date(2020, 1, 1)
  654. let oneDay = 24 * 3600 * 1000
  655. let date = []
  656. let data = [Math.random() * 1500]
  657. let now = new Date(base)
  658. const addData = (shift) => {
  659. now = [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/')
  660. date.push(now)
  661. data.push(this.$baseLodash.random(20000, 60000))
  662. if (shift) {
  663. date.shift()
  664. data.shift()
  665. }
  666. now = new Date(+new Date(now) + oneDay)
  667. }
  668. for (let i = 1; i < 6; i++) {
  669. addData()
  670. }
  671. addData(true)
  672. this.fwl.xAxis[0].data = date
  673. this.fwl.series[0].data = data
  674. this.timer = setInterval(() => {
  675. addData(true)
  676. this.fwl.xAxis[0].data = date
  677. this.fwl.series[0].data = data
  678. }, 3000)
  679. },
  680. methods: {
  681. handleClick(e) {
  682. this.$baseMessage(`点击了${e.name},这里可以写跳转`)
  683. },
  684. handleZrClick(e) {},
  685. handleChangeTheme() {
  686. this.$baseEventBus.$emit('theme')
  687. },
  688. async fetchData() {
  689. const { data } = await getList()
  690. data.map((item, index) => {
  691. if (index === data.length - 1) {
  692. item.color = '#0bbd87'
  693. }
  694. })
  695. this.activities = data
  696. const res = await getNoticeList()
  697. this.noticeList = res.data
  698. /* getRepos({
  699. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  700. }).then((res) => {
  701. const per_page = Math.ceil(res.data.stargazers_count / 100);
  702. alert(per_page);
  703. getStargazers({
  704. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  705. page: 1,
  706. per_page: res.per_page,
  707. }).then((res) => {
  708. alert(JSON.stringify(res));
  709. });
  710. }); */
  711. },
  712. },
  713. }
  714. </script>
  715. <style lang="scss" scoped>
  716. .index-container {
  717. padding: 0 !important;
  718. margin: 0 !important;
  719. background: #f5f7f8 !important;
  720. ::v-deep {
  721. .el-alert {
  722. padding: $base-padding;
  723. &--info.is-light {
  724. min-height: 82px;
  725. padding: $base-padding;
  726. margin-bottom: 15px;
  727. color: #909399;
  728. background-color: $base-color-white;
  729. border: 1px solid #ebeef5;
  730. }
  731. }
  732. .el-card__body {
  733. .echarts {
  734. width: 100%;
  735. height: 125px;
  736. }
  737. }
  738. }
  739. .card {
  740. min-height: 400px;
  741. ::v-deep {
  742. .el-card__body {
  743. .echarts {
  744. width: 100%;
  745. height: 305px;
  746. }
  747. }
  748. }
  749. }
  750. .bottom {
  751. padding-top: 20px;
  752. margin-top: 5px;
  753. color: #595959;
  754. text-align: left;
  755. border-top: 1px solid $base-border-color;
  756. }
  757. .table {
  758. width: 100%;
  759. color: #666;
  760. border-collapse: collapse;
  761. background-color: #fff;
  762. td {
  763. position: relative;
  764. min-height: 20px;
  765. padding: 9px 15px;
  766. font-size: 14px;
  767. line-height: 20px;
  768. border: 1px solid #e6e6e6;
  769. &:nth-child(odd) {
  770. width: 20%;
  771. text-align: right;
  772. background-color: #f7f7f7;
  773. }
  774. }
  775. }
  776. .icon-panel {
  777. height: 100px;
  778. text-align: center;
  779. cursor: pointer;
  780. svg {
  781. font-size: 40px;
  782. }
  783. p {
  784. margin-top: 10px;
  785. }
  786. }
  787. .bottom-btn {
  788. button {
  789. margin: 5px 10px 15px 0;
  790. }
  791. }
  792. }
  793. </style>