index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  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-col>
  255. </el-row>
  256. </div>
  257. </template>
  258. <script>
  259. import VabChart from '@/plugins/echarts'
  260. import { dependencies, devDependencies } from '../../../package.json'
  261. import { getList } from '@/api/changeLog'
  262. import { getNoticeList } from '@/api/notice'
  263. import { getRepos, getStargazers } from '@/api/github'
  264. export default {
  265. name: 'Index',
  266. components: {
  267. VabChart,
  268. },
  269. data() {
  270. return {
  271. timer: 0,
  272. updateTime: process.env.VUE_APP_UPDATE_TIME,
  273. nodeEnv: process.env.NODE_ENV,
  274. dependencies: dependencies,
  275. devDependencies: devDependencies,
  276. config1: {
  277. startVal: 0,
  278. endVal: this.$baseLodash.random(20000, 60000),
  279. decimals: 0,
  280. prefix: '',
  281. suffix: '',
  282. separator: ',',
  283. duration: 8000,
  284. },
  285. config2: {
  286. startVal: 0,
  287. endVal: this.$baseLodash.random(1000, 20000),
  288. decimals: 0,
  289. prefix: '',
  290. suffix: '',
  291. separator: ',',
  292. duration: 8000,
  293. },
  294. config3: {
  295. startVal: 0,
  296. endVal: this.$baseLodash.random(1000, 20000),
  297. decimals: 0,
  298. prefix: '',
  299. suffix: '',
  300. separator: ',',
  301. duration: 8000,
  302. },
  303. //访问量
  304. fwl: {
  305. grid: {
  306. top: '4%',
  307. left: '2%',
  308. right: '4%',
  309. bottom: '0%',
  310. containLabel: true,
  311. },
  312. xAxis: [
  313. {
  314. type: 'category',
  315. boundaryGap: false,
  316. data: [],
  317. axisTick: {
  318. alignWithLabel: true,
  319. },
  320. },
  321. ],
  322. yAxis: [
  323. {
  324. type: 'value',
  325. },
  326. ],
  327. series: [
  328. {
  329. name: '访问量',
  330. type: 'line',
  331. data: [],
  332. smooth: true,
  333. areaStyle: {},
  334. },
  335. ],
  336. },
  337. //授权数
  338. sqs: {
  339. grid: {
  340. top: '4%',
  341. left: '2%',
  342. right: '4%',
  343. bottom: '0%',
  344. containLabel: true,
  345. },
  346. xAxis: [
  347. {
  348. type: 'category',
  349. /*boundaryGap: false,*/
  350. data: ['0时', '4时', '8时', '12时', '16时', '20时', '24时'],
  351. axisTick: {
  352. alignWithLabel: true,
  353. },
  354. },
  355. ],
  356. yAxis: [
  357. {
  358. type: 'value',
  359. },
  360. ],
  361. series: [
  362. {
  363. name: '授权数',
  364. type: 'bar',
  365. barWidth: '60%',
  366. data: [10, 52, 20, 33, 39, 33, 22],
  367. },
  368. ],
  369. },
  370. //词云
  371. cy: {
  372. grid: {
  373. top: '4%',
  374. left: '2%',
  375. right: '4%',
  376. bottom: '0%',
  377. },
  378. series: [
  379. {
  380. type: 'wordCloud',
  381. gridSize: 15,
  382. sizeRange: [12, 40],
  383. rotationRange: [0, 0],
  384. width: '100%',
  385. height: '100%',
  386. textStyle: {
  387. normal: {
  388. color() {
  389. const arr = [
  390. '#1890FF',
  391. '#36CBCB',
  392. '#4ECB73',
  393. '#FBD437',
  394. '#F2637B',
  395. '#975FE5',
  396. ]
  397. let index = Math.floor(Math.random() * arr.length)
  398. return arr[index]
  399. },
  400. },
  401. },
  402. data: [
  403. {
  404. name: 'vue-admin-beautiful',
  405. value: 15000,
  406. },
  407. {
  408. name: 'element',
  409. value: 10081,
  410. },
  411. {
  412. name: 'beautiful',
  413. value: 9386,
  414. },
  415. {
  416. name: 'vue',
  417. value: 6500,
  418. },
  419. {
  420. name: 'chuzhixin',
  421. value: 6000,
  422. },
  423. {
  424. name: 'good',
  425. value: 4500,
  426. },
  427. {
  428. name: 'success',
  429. value: 3800,
  430. },
  431. {
  432. name: 'never',
  433. value: 3000,
  434. },
  435. {
  436. name: 'boy',
  437. value: 2500,
  438. },
  439. {
  440. name: 'girl',
  441. value: 2300,
  442. },
  443. {
  444. name: 'github',
  445. value: 2000,
  446. },
  447. {
  448. name: 'hbuilder',
  449. value: 1900,
  450. },
  451. {
  452. name: 'dcloud',
  453. value: 1800,
  454. },
  455. {
  456. name: 'china',
  457. value: 1700,
  458. },
  459. {
  460. name: '1204505056',
  461. value: 1600,
  462. },
  463. {
  464. name: '972435319',
  465. value: 1500,
  466. },
  467. {
  468. name: 'young',
  469. value: 1200,
  470. },
  471. {
  472. name: 'old',
  473. value: 1100,
  474. },
  475. {
  476. name: 'vuex',
  477. value: 900,
  478. },
  479. {
  480. name: 'router',
  481. value: 800,
  482. },
  483. {
  484. name: 'money',
  485. value: 700,
  486. },
  487. {
  488. name: 'qingdao',
  489. value: 800,
  490. },
  491. {
  492. name: 'yantai',
  493. value: 9000,
  494. },
  495. {
  496. name: 'author is very cool',
  497. value: 9200,
  498. },
  499. ],
  500. },
  501. ],
  502. },
  503. //中国地图
  504. zgdt: {
  505. title: {
  506. text: '2099年全国GDP分布',
  507. subtext: '数据来自vue-admin-beautiful杜撰',
  508. },
  509. tooltip: {
  510. trigger: 'item',
  511. },
  512. dataRange: {
  513. orient: 'horizontal',
  514. min: 0,
  515. max: 55000,
  516. text: ['高', '低'],
  517. splitNumber: 0,
  518. },
  519. series: [
  520. {
  521. name: '2099年全国GDP分布',
  522. type: 'map',
  523. roam: false,
  524. zoom: 1.25,
  525. mapType: 'china',
  526. mapLocation: {
  527. x: 'center',
  528. },
  529. selectedMode: 'multiple',
  530. itemStyle: {
  531. normal: {
  532. label: {
  533. show: false,
  534. },
  535. },
  536. emphasis: {
  537. label: {
  538. show: true,
  539. },
  540. },
  541. },
  542. data: [
  543. { name: '西藏', value: 605.83 },
  544. { name: '青海', value: 1670.44 },
  545. { name: '宁夏', value: 2102.21 },
  546. { name: '海南', value: 2522.66 },
  547. { name: '甘肃', value: 5020.37 },
  548. { name: '贵州', value: 5701.84 },
  549. { name: '新疆', value: 6610.05 },
  550. { name: '云南', value: 8893.12 },
  551. { name: '重庆', value: 10011.37 },
  552. { name: '吉林', value: 10568.83 },
  553. { name: '山西', value: 11237.55 },
  554. { name: '天津', value: 11307.28 },
  555. { name: '江西', value: 11702.82 },
  556. { name: '广西', value: 11720.87 },
  557. { name: '陕西', value: 12512.3 },
  558. { name: '黑龙江', value: 12582 },
  559. { name: '内蒙古', value: 14359.88 },
  560. { name: '安徽', value: 15300.65 },
  561. { name: '北京', value: 16251.93 },
  562. { name: '福建', value: 17560.18 },
  563. { name: '上海', value: 19195.69 },
  564. { name: '湖北', value: 19632.26 },
  565. { name: '湖南', value: 19669.56 },
  566. { name: '四川', value: 21026.68 },
  567. { name: '辽宁', value: 22226.7 },
  568. { name: '河北', value: 24515.76 },
  569. { name: '河南', value: 26931.03 },
  570. { name: '浙江', value: 32318.85 },
  571. { name: '山东', value: 45361.85, selected: true },
  572. { name: '江苏', value: 49110.27 },
  573. { name: '广东', value: 53210.28 },
  574. ],
  575. },
  576. ],
  577. },
  578. //更新日志
  579. reverse: true,
  580. activities: [],
  581. noticeList: [],
  582. //其他信息
  583. userAgent: navigator.userAgent,
  584. //卡片图标
  585. iconList: [
  586. {
  587. icon: 'video',
  588. title: '视频播放器',
  589. link: '/vab/player',
  590. color: '#ffc069',
  591. },
  592. {
  593. icon: 'table',
  594. title: '表格',
  595. link: '/vab/table/comprehensiveTable',
  596. color: '#5cdbd3',
  597. },
  598. {
  599. icon: 'laptop-code',
  600. title: '源码',
  601. link: 'https://github.com/chuzhixin/vue-admin-beautiful',
  602. color: '#b37feb',
  603. },
  604. {
  605. icon: 'book',
  606. title: '书籍',
  607. link: '',
  608. color: '#69c0ff',
  609. },
  610. {
  611. icon: 'bullhorn',
  612. title: '公告',
  613. link: '',
  614. color: '#ff85c0',
  615. },
  616. {
  617. icon: 'gift',
  618. title: '礼物',
  619. link: '',
  620. color: '#ffd666',
  621. },
  622. {
  623. icon: 'balance-scale-left',
  624. title: '公平的世界',
  625. link: '',
  626. color: '#ff9c6e',
  627. },
  628. {
  629. icon: 'coffee',
  630. title: '休息一下',
  631. link: '',
  632. color: '#95de64',
  633. },
  634. ],
  635. }
  636. },
  637. created() {
  638. this.fetchData()
  639. },
  640. beforeDestroy() {
  641. clearInterval(this.timer)
  642. },
  643. mounted() {
  644. let base = +new Date(2020, 1, 1)
  645. let oneDay = 24 * 3600 * 1000
  646. let date = []
  647. let data = [Math.random() * 1500]
  648. let now = new Date(base)
  649. const addData = (shift) => {
  650. now = [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/')
  651. date.push(now)
  652. data.push(this.$baseLodash.random(20000, 60000))
  653. if (shift) {
  654. date.shift()
  655. data.shift()
  656. }
  657. now = new Date(+new Date(now) + oneDay)
  658. }
  659. for (let i = 1; i < 6; i++) {
  660. addData()
  661. }
  662. addData(true)
  663. this.fwl.xAxis[0].data = date
  664. this.fwl.series[0].data = data
  665. this.timer = setInterval(() => {
  666. addData(true)
  667. this.fwl.xAxis[0].data = date
  668. this.fwl.series[0].data = data
  669. }, 3000)
  670. },
  671. methods: {
  672. handleClick(e) {
  673. this.$baseMessage(`点击了${e.name},这里可以写跳转`)
  674. },
  675. handleZrClick(e) {},
  676. handleChangeTheme() {
  677. this.$baseEventBus.$emit('theme')
  678. },
  679. async fetchData() {
  680. const { data } = await getList()
  681. data.map((item, index) => {
  682. if (index === data.length - 1) {
  683. item.color = '#0bbd87'
  684. }
  685. })
  686. this.activities = data
  687. const res = await getNoticeList()
  688. this.noticeList = res.data
  689. /* getRepos({
  690. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  691. }).then((res) => {
  692. const per_page = Math.ceil(res.data.stargazers_count / 100);
  693. alert(per_page);
  694. getStargazers({
  695. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  696. page: 1,
  697. per_page: res.per_page,
  698. }).then((res) => {
  699. alert(JSON.stringify(res));
  700. });
  701. }); */
  702. },
  703. },
  704. }
  705. </script>
  706. <style lang="scss" scoped>
  707. .index-container {
  708. padding: 0 !important;
  709. margin: 0 !important;
  710. background: #f5f7f8 !important;
  711. ::v-deep {
  712. .el-alert {
  713. padding: $base-padding;
  714. &--info.is-light {
  715. min-height: 82px;
  716. padding: $base-padding;
  717. margin-bottom: 15px;
  718. color: #909399;
  719. background-color: $base-color-white;
  720. border: 1px solid #ebeef5;
  721. }
  722. }
  723. .el-card__body {
  724. .echarts {
  725. width: 100%;
  726. height: 125px;
  727. }
  728. }
  729. }
  730. .card {
  731. min-height: 400px;
  732. ::v-deep {
  733. .el-card__body {
  734. .echarts {
  735. width: 100%;
  736. height: 305px;
  737. }
  738. }
  739. }
  740. }
  741. .bottom {
  742. padding-top: 20px;
  743. margin-top: 5px;
  744. color: #595959;
  745. text-align: left;
  746. border-top: 1px solid $base-border-color;
  747. }
  748. .table {
  749. width: 100%;
  750. color: #666;
  751. border-collapse: collapse;
  752. background-color: #fff;
  753. td {
  754. position: relative;
  755. min-height: 20px;
  756. padding: 9px 15px;
  757. font-size: 14px;
  758. line-height: 20px;
  759. border: 1px solid #e6e6e6;
  760. &:nth-child(odd) {
  761. width: 20%;
  762. text-align: right;
  763. background-color: #f7f7f7;
  764. }
  765. }
  766. }
  767. .icon-panel {
  768. height: 100px;
  769. text-align: center;
  770. cursor: pointer;
  771. svg {
  772. font-size: 40px;
  773. }
  774. p {
  775. margin-top: 10px;
  776. }
  777. }
  778. .bottom-btn {
  779. button {
  780. margin: 5px 10px 15px 0;
  781. }
  782. }
  783. }
  784. </style>