index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  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. <p v-html="noticeList[0].title"></p>
  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. <plan></plan>
  194. <version-information></version-information>
  195. </el-col>
  196. <el-col :xs="24" :sm="24" :md="13" :lg="13" :xl="13">
  197. <el-card class="card" shadow="never">
  198. <div slot="header">
  199. <span>更新日志</span>
  200. </div>
  201. <el-timeline :reverse="reverse">
  202. <el-timeline-item
  203. v-for="(activity, index) in activities"
  204. :key="index"
  205. :timestamp="activity.timestamp"
  206. :color="activity.color"
  207. >
  208. {{ activity.content }}
  209. </el-timeline-item>
  210. </el-timeline>
  211. </el-card>
  212. </el-col>
  213. </el-row>
  214. </div>
  215. </template>
  216. <script>
  217. import VabChart from '@/plugins/echarts'
  218. import { dependencies, devDependencies } from '../../../package.json'
  219. import { getList } from '@/api/changeLog'
  220. import { getNoticeList } from '@/api/notice'
  221. import { getRepos, getStargazers } from '@/api/github'
  222. import Plan from './components/Plan'
  223. import VersionInformation from './components/VersionInformation'
  224. export default {
  225. name: 'Index',
  226. components: {
  227. VabChart,
  228. Plan,
  229. VersionInformation,
  230. },
  231. data() {
  232. return {
  233. timer: 0,
  234. updateTime: process.env.VUE_APP_UPDATE_TIME,
  235. nodeEnv: process.env.NODE_ENV,
  236. dependencies: dependencies,
  237. devDependencies: devDependencies,
  238. config1: {
  239. startVal: 0,
  240. endVal: this.$baseLodash.random(20000, 60000),
  241. decimals: 0,
  242. prefix: '',
  243. suffix: '',
  244. separator: ',',
  245. duration: 8000,
  246. },
  247. config2: {
  248. startVal: 0,
  249. endVal: this.$baseLodash.random(1000, 20000),
  250. decimals: 0,
  251. prefix: '',
  252. suffix: '',
  253. separator: ',',
  254. duration: 8000,
  255. },
  256. config3: {
  257. startVal: 0,
  258. endVal: this.$baseLodash.random(1000, 20000),
  259. decimals: 0,
  260. prefix: '',
  261. suffix: '',
  262. separator: ',',
  263. duration: 8000,
  264. },
  265. //访问量
  266. fwl: {
  267. grid: {
  268. top: '4%',
  269. left: '2%',
  270. right: '4%',
  271. bottom: '0%',
  272. containLabel: true,
  273. },
  274. xAxis: [
  275. {
  276. type: 'category',
  277. boundaryGap: false,
  278. data: [],
  279. axisTick: {
  280. alignWithLabel: true,
  281. },
  282. },
  283. ],
  284. yAxis: [
  285. {
  286. type: 'value',
  287. },
  288. ],
  289. series: [
  290. {
  291. name: '访问量',
  292. type: 'line',
  293. data: [],
  294. smooth: true,
  295. areaStyle: {},
  296. },
  297. ],
  298. },
  299. //授权数
  300. sqs: {
  301. grid: {
  302. top: '4%',
  303. left: '2%',
  304. right: '4%',
  305. bottom: '0%',
  306. containLabel: true,
  307. },
  308. xAxis: [
  309. {
  310. type: 'category',
  311. /*boundaryGap: false,*/
  312. data: ['0时', '4时', '8时', '12时', '16时', '20时', '24时'],
  313. axisTick: {
  314. alignWithLabel: true,
  315. },
  316. },
  317. ],
  318. yAxis: [
  319. {
  320. type: 'value',
  321. },
  322. ],
  323. series: [
  324. {
  325. name: '授权数',
  326. type: 'bar',
  327. barWidth: '60%',
  328. data: [10, 52, 20, 33, 39, 33, 22],
  329. },
  330. ],
  331. },
  332. //词云
  333. cy: {
  334. grid: {
  335. top: '4%',
  336. left: '2%',
  337. right: '4%',
  338. bottom: '0%',
  339. },
  340. series: [
  341. {
  342. type: 'wordCloud',
  343. gridSize: 15,
  344. sizeRange: [12, 40],
  345. rotationRange: [0, 0],
  346. width: '100%',
  347. height: '100%',
  348. textStyle: {
  349. normal: {
  350. color() {
  351. const arr = [
  352. '#5470c6',
  353. '#91cc75',
  354. '#fac858',
  355. '#ee6666',
  356. '#73c0de',
  357. '#975FE5',
  358. ]
  359. let index = Math.floor(Math.random() * arr.length)
  360. return arr[index]
  361. },
  362. },
  363. },
  364. data: [
  365. {
  366. name: 'vue-admin-beautiful',
  367. value: 15000,
  368. },
  369. {
  370. name: 'element',
  371. value: 10081,
  372. },
  373. {
  374. name: 'beautiful',
  375. value: 9386,
  376. },
  377. {
  378. name: 'vue',
  379. value: 6500,
  380. },
  381. {
  382. name: 'chuzhixin',
  383. value: 6000,
  384. },
  385. {
  386. name: 'good',
  387. value: 4500,
  388. },
  389. {
  390. name: 'success',
  391. value: 3800,
  392. },
  393. {
  394. name: 'never',
  395. value: 3000,
  396. },
  397. {
  398. name: 'boy',
  399. value: 2500,
  400. },
  401. {
  402. name: 'girl',
  403. value: 2300,
  404. },
  405. {
  406. name: 'github',
  407. value: 2000,
  408. },
  409. {
  410. name: 'hbuilder',
  411. value: 1900,
  412. },
  413. {
  414. name: 'dcloud',
  415. value: 1800,
  416. },
  417. {
  418. name: 'china',
  419. value: 1700,
  420. },
  421. {
  422. name: '1204505056',
  423. value: 1600,
  424. },
  425. {
  426. name: '972435319',
  427. value: 1500,
  428. },
  429. {
  430. name: 'young',
  431. value: 1200,
  432. },
  433. {
  434. name: 'old',
  435. value: 1100,
  436. },
  437. {
  438. name: 'vuex',
  439. value: 900,
  440. },
  441. {
  442. name: 'router',
  443. value: 800,
  444. },
  445. {
  446. name: 'money',
  447. value: 700,
  448. },
  449. {
  450. name: 'qingdao',
  451. value: 800,
  452. },
  453. {
  454. name: 'yantai',
  455. value: 9000,
  456. },
  457. {
  458. name: 'author is very cool',
  459. value: 9200,
  460. },
  461. ],
  462. },
  463. ],
  464. },
  465. //更新日志
  466. reverse: true,
  467. activities: [],
  468. noticeList: [],
  469. //其他信息
  470. userAgent: navigator.userAgent,
  471. //卡片图标
  472. iconList: [
  473. {
  474. icon: 'video',
  475. title: '视频播放器',
  476. link: '/vab/player',
  477. color: '#ffc069',
  478. },
  479. {
  480. icon: 'table',
  481. title: '表格',
  482. link: '/vab/table/comprehensiveTable',
  483. color: '#5cdbd3',
  484. },
  485. {
  486. icon: 'laptop-code',
  487. title: '源码',
  488. link: 'https://github.com/chuzhixin/vue-admin-beautiful',
  489. color: '#b37feb',
  490. },
  491. {
  492. icon: 'book',
  493. title: '书籍',
  494. link: '',
  495. color: '#69c0ff',
  496. },
  497. {
  498. icon: 'bullhorn',
  499. title: '公告',
  500. link: '',
  501. color: '#ff85c0',
  502. },
  503. {
  504. icon: 'gift',
  505. title: '礼物',
  506. link: '',
  507. color: '#ffd666',
  508. },
  509. {
  510. icon: 'balance-scale-left',
  511. title: '公平的世界',
  512. link: '',
  513. color: '#ff9c6e',
  514. },
  515. {
  516. icon: 'coffee',
  517. title: '休息一下',
  518. link: '',
  519. color: '#95de64',
  520. },
  521. ],
  522. }
  523. },
  524. created() {
  525. this.fetchData()
  526. },
  527. beforeDestroy() {
  528. clearInterval(this.timer)
  529. },
  530. mounted() {
  531. let base = +new Date(2020, 1, 1)
  532. let oneDay = 24 * 3600 * 1000
  533. let date = []
  534. let data = [Math.random() * 1500]
  535. let now = new Date(base)
  536. const addData = (shift) => {
  537. now = [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/')
  538. date.push(now)
  539. data.push(this.$baseLodash.random(20000, 60000))
  540. if (shift) {
  541. date.shift()
  542. data.shift()
  543. }
  544. now = new Date(+new Date(now) + oneDay)
  545. }
  546. for (let i = 1; i < 6; i++) {
  547. addData()
  548. }
  549. addData(true)
  550. this.fwl.xAxis[0].data = date
  551. this.fwl.series[0].data = data
  552. this.timer = setInterval(() => {
  553. addData(true)
  554. this.fwl.xAxis[0].data = date
  555. this.fwl.series[0].data = data
  556. }, 3000)
  557. },
  558. methods: {
  559. handleClick(e) {
  560. this.$baseMessage(`点击了${e.name},这里可以写跳转`)
  561. },
  562. handleZrClick(e) {},
  563. handleChangeTheme() {
  564. this.$baseEventBus.$emit('theme')
  565. },
  566. async fetchData() {
  567. const { data } = await getList()
  568. data.map((item, index) => {
  569. if (index === data.length - 1) {
  570. item.color = '#0bbd87'
  571. }
  572. })
  573. this.activities = data
  574. const res = await getNoticeList()
  575. this.noticeList = res.data
  576. /* getRepos({
  577. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  578. }).then((res) => {
  579. const per_page = Math.ceil(res.data.stargazers_count / 100);
  580. alert(per_page);
  581. getStargazers({
  582. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  583. page: 1,
  584. per_page: res.per_page,
  585. }).then((res) => {
  586. alert(JSON.stringify(res));
  587. });
  588. }); */
  589. },
  590. },
  591. }
  592. </script>
  593. <style lang="scss" scoped>
  594. .index-container {
  595. padding: 0 !important;
  596. margin: 0 !important;
  597. background: #f5f7f8 !important;
  598. ::v-deep {
  599. .el-alert {
  600. padding: $base-padding;
  601. &--info.is-light {
  602. min-height: 82px;
  603. padding: $base-padding;
  604. margin-bottom: 15px;
  605. color: #909399;
  606. background-color: $base-color-white;
  607. border: 1px solid #ebeef5;
  608. }
  609. }
  610. .el-card__body {
  611. .echarts {
  612. width: 100%;
  613. height: 115px;
  614. }
  615. }
  616. }
  617. .card {
  618. ::v-deep {
  619. .el-card__body {
  620. .echarts {
  621. width: 100%;
  622. height: 305px;
  623. }
  624. }
  625. }
  626. }
  627. .bottom {
  628. padding-top: 20px;
  629. margin-top: 5px;
  630. color: #595959;
  631. text-align: left;
  632. border-top: 1px solid $base-border-color;
  633. }
  634. .table {
  635. width: 100%;
  636. color: #666;
  637. border-collapse: collapse;
  638. background-color: #fff;
  639. td {
  640. position: relative;
  641. min-height: 20px;
  642. padding: 9px 15px;
  643. font-size: 14px;
  644. line-height: 20px;
  645. border: 1px solid #e6e6e6;
  646. &:nth-child(odd) {
  647. width: 20%;
  648. text-align: right;
  649. background-color: #f7f7f7;
  650. }
  651. }
  652. }
  653. .icon-panel {
  654. height: 117px;
  655. text-align: center;
  656. cursor: pointer;
  657. svg {
  658. font-size: 40px;
  659. }
  660. p {
  661. margin-top: 10px;
  662. }
  663. }
  664. .bottom-btn {
  665. button {
  666. margin: 5px 10px 15px 0;
  667. }
  668. }
  669. }
  670. </style>