index.vue 21 KB

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