index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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 auto-resize theme="vab-echarts-theme" :option="fwl" />
  28. <div class="bottom">
  29. <span>
  30. 日均访问量:
  31. <vab-count
  32. :start-val="config1.startVal"
  33. :end-val="config1.endVal"
  34. :duration="config1.duration"
  35. :separator="config1.separator"
  36. :prefix="config1.prefix"
  37. :suffix="config1.suffix"
  38. :decimals="config1.decimals"
  39. />
  40. </span>
  41. </div>
  42. </el-card>
  43. </el-col>
  44. <el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6">
  45. <el-card shadow="never">
  46. <div slot="header">
  47. <span>授权数</span>
  48. </div>
  49. <vab-chart auto-resize theme="vab-echarts-theme" :option="sqs" />
  50. <div class="bottom">
  51. <span>
  52. 总授权数:
  53. <vab-count
  54. :start-val="config2.startVal"
  55. :end-val="config2.endVal"
  56. :duration="config2.duration"
  57. :separator="config2.separator"
  58. :prefix="config2.prefix"
  59. :suffix="config2.suffix"
  60. :decimals="config2.decimals"
  61. />
  62. </span>
  63. </div>
  64. </el-card>
  65. </el-col>
  66. <el-col
  67. v-for="(item, index) in iconList"
  68. :key="index"
  69. :xs="12"
  70. :sm="6"
  71. :md="3"
  72. :lg="3"
  73. :xl="3"
  74. >
  75. <router-link :to="item.link" target="_blank">
  76. <el-card class="icon-panel" shadow="never">
  77. <vab-icon
  78. :style="{ color: item.color }"
  79. :icon="['fas', item.icon]"
  80. ></vab-icon>
  81. <p>{{ item.title }}</p>
  82. </el-card>
  83. </router-link>
  84. </el-col>
  85. <el-col :xs="24" :sm="24" :md="24" :lg="11" :xl="11">
  86. <el-card class="card" shadow="never">
  87. <div slot="header">
  88. <span>依赖信息</span>
  89. <div style="float: right">部署时间:{{ updateTime }}</div>
  90. </div>
  91. <div class="bottom-btn">
  92. <el-popover placement="top" width="250" trigger="hover">
  93. <p>
  94. 请我们喝杯咖啡,付款后联系qq
  95. 783963206,我们将邀请您加入我们的讨论群,谢谢您愿意支持开源,加群获取文档、及基础模板,群内大佬众多,希望能帮到大家(如情况不允许,请勿勉强)。
  96. </p>
  97. <el-image :src="require('@/assets/zfb_kf.jpg')"></el-image>
  98. <a slot="reference" target="_blank">
  99. <el-button type="primary">QQ讨论群、基础版、文档</el-button>
  100. </a>
  101. </el-popover>
  102. <a
  103. target="_blank"
  104. href="https://github.com/chuzhixin/vue-admin-beautiful"
  105. >
  106. <el-button type="warning">github下载源码点star</el-button>
  107. </a>
  108. <a
  109. target="_blank"
  110. href="https://gitee.com/chu1204505056/vue-admin-beautiful"
  111. >
  112. <el-button type="warning">码云下载源码点star</el-button>
  113. </a>
  114. <a @click="handleChangeTheme">
  115. <el-button type="danger">修改主题和布局</el-button>
  116. </a>
  117. <!-- <el-popover placement="top" width="250" trigger="hover">
  118. <p>谢谢您愿意支持开源,加群获取文档,群内提供基础模板</p>
  119. <el-image :src="require('@/assets/ewm.png')"></el-image>
  120. <a slot="reference" target="_blank">
  121. <el-button type="warning">文档</el-button>
  122. </a>
  123. </el-popover> -->
  124. </div>
  125. <table class="table">
  126. <tr>
  127. <td>@vue/cli版本</td>
  128. <td>{{ devDependencies['@vue/cli-service'] }}</td>
  129. <td>vue版本</td>
  130. <td>{{ dependencies['vue'] }}</td>
  131. </tr>
  132. <tr>
  133. <td>vuex版本</td>
  134. <td>{{ dependencies['vuex'] }}</td>
  135. <td>vue-router版本</td>
  136. <td>{{ dependencies['vue-router'] }}</td>
  137. </tr>
  138. <tr>
  139. <td>element-ui版本</td>
  140. <td>{{ dependencies['element-ui'] }}</td>
  141. <td>axios版本</td>
  142. <td>{{ dependencies['axios'] }}</td>
  143. </tr>
  144. <tr>
  145. <td>eslint版本</td>
  146. <td>{{ devDependencies['eslint'] }}</td>
  147. <td>prettier版本</td>
  148. <td>{{ devDependencies['prettier'] }}</td>
  149. </tr>
  150. <tr>
  151. <td>sass版本</td>
  152. <td>{{ devDependencies['sass'] }}</td>
  153. <td>mockjs版本</td>
  154. <td>{{ dependencies['mockjs'] }}</td>
  155. </tr>
  156. <tr>
  157. <td>zx-layouts版本</td>
  158. <td>{{ dependencies['zx-layouts'] }}</td>
  159. <td>lodash版本</td>
  160. <td>{{ dependencies['lodash'] }}</td>
  161. </tr>
  162. </table>
  163. </el-card>
  164. <el-card shadow="never">
  165. <div slot="header">
  166. <span>其他信息</span>
  167. </div>
  168. <div style="text-align: center">
  169. <vab-colorful-icon style="font-size: 140px" icon-class="vab" />
  170. <h1 style="font-size: 30px">vue-admin-beautiful</h1>
  171. </div>
  172. <div v-for="(item, index) in noticeList" :key="index">
  173. <el-alert
  174. v-if="index !== 0"
  175. :title="item.title"
  176. :type="item.type"
  177. :closable="item.closable"
  178. ></el-alert>
  179. <br />
  180. </div>
  181. <el-alert :closable="false" :title="userAgent" type="info"></el-alert>
  182. <br />
  183. </el-card>
  184. </el-col>
  185. <el-col :xs="24" :sm="24" :md="13" :lg="13" :xl="13">
  186. <el-card class="card" shadow="never">
  187. <div slot="header">
  188. <span>更新日志</span>
  189. </div>
  190. <el-timeline :reverse="reverse">
  191. <el-timeline-item
  192. v-for="(activity, index) in activities"
  193. :key="index"
  194. :timestamp="activity.timestamp"
  195. :color="activity.color"
  196. >
  197. {{ activity.content }}
  198. </el-timeline-item>
  199. </el-timeline>
  200. </el-card>
  201. <plan></plan>
  202. <version-information></version-information>
  203. </el-col>
  204. </el-row>
  205. </div>
  206. </template>
  207. <script>
  208. import VabChart from '@/plugins/echarts'
  209. import { dependencies, devDependencies } from '../../../package.json'
  210. import { getList } from '@/api/changeLog'
  211. import { getNoticeList } from '@/api/notice'
  212. import { getRepos, getStargazers } from '@/api/github'
  213. import Plan from './components/Plan'
  214. import VersionInformation from './components/VersionInformation'
  215. export default {
  216. name: 'Index',
  217. components: {
  218. VabChart,
  219. Plan,
  220. VersionInformation,
  221. },
  222. data() {
  223. return {
  224. timer: 0,
  225. updateTime: process.env.VUE_APP_UPDATE_TIME,
  226. nodeEnv: process.env.NODE_ENV,
  227. dependencies: dependencies,
  228. devDependencies: devDependencies,
  229. config1: {
  230. startVal: 0,
  231. endVal: this.$baseLodash.random(20000, 60000),
  232. decimals: 0,
  233. prefix: '',
  234. suffix: '',
  235. separator: ',',
  236. duration: 8000,
  237. },
  238. config2: {
  239. startVal: 0,
  240. endVal: this.$baseLodash.random(1000, 20000),
  241. decimals: 0,
  242. prefix: '',
  243. suffix: '',
  244. separator: ',',
  245. duration: 8000,
  246. },
  247. config3: {
  248. startVal: 0,
  249. endVal: this.$baseLodash.random(1000, 20000),
  250. decimals: 0,
  251. prefix: '',
  252. suffix: '',
  253. separator: ',',
  254. duration: 8000,
  255. },
  256. //访问量
  257. fwl: {
  258. grid: {
  259. top: '4%',
  260. left: '2%',
  261. right: '4%',
  262. bottom: '0%',
  263. containLabel: true,
  264. },
  265. xAxis: [
  266. {
  267. type: 'category',
  268. boundaryGap: false,
  269. data: [],
  270. axisTick: {
  271. alignWithLabel: true,
  272. },
  273. },
  274. ],
  275. yAxis: [
  276. {
  277. type: 'value',
  278. },
  279. ],
  280. series: [
  281. {
  282. name: '访问量',
  283. type: 'line',
  284. data: [],
  285. smooth: true,
  286. areaStyle: {},
  287. },
  288. ],
  289. },
  290. //授权数
  291. sqs: {
  292. grid: {
  293. top: '4%',
  294. left: '2%',
  295. right: '4%',
  296. bottom: '0%',
  297. containLabel: true,
  298. },
  299. xAxis: [
  300. {
  301. type: 'category',
  302. /*boundaryGap: false,*/
  303. data: ['0时', '4时', '8时', '12时', '16时', '20时', '24时'],
  304. axisTick: {
  305. alignWithLabel: true,
  306. },
  307. },
  308. ],
  309. yAxis: [
  310. {
  311. type: 'value',
  312. },
  313. ],
  314. series: [
  315. {
  316. name: '授权数',
  317. type: 'bar',
  318. barWidth: '60%',
  319. data: [10, 52, 20, 33, 39, 33, 22],
  320. },
  321. ],
  322. },
  323. //词云
  324. cy: {
  325. grid: {
  326. top: '4%',
  327. left: '2%',
  328. right: '4%',
  329. bottom: '0%',
  330. },
  331. series: [
  332. {
  333. type: 'wordCloud',
  334. gridSize: 15,
  335. sizeRange: [12, 40],
  336. rotationRange: [0, 0],
  337. width: '100%',
  338. height: '100%',
  339. textStyle: {
  340. normal: {
  341. color() {
  342. const arr = [
  343. '#5470c6',
  344. '#91cc75',
  345. '#fac858',
  346. '#ee6666',
  347. '#73c0de',
  348. '#975FE5',
  349. ]
  350. let index = Math.floor(Math.random() * arr.length)
  351. return arr[index]
  352. },
  353. },
  354. },
  355. data: [
  356. {
  357. name: 'vue-admin-beautiful',
  358. value: 15000,
  359. },
  360. {
  361. name: 'element',
  362. value: 10081,
  363. },
  364. {
  365. name: 'beautiful',
  366. value: 9386,
  367. },
  368. {
  369. name: 'vue',
  370. value: 6500,
  371. },
  372. {
  373. name: 'chuzhixin',
  374. value: 6000,
  375. },
  376. {
  377. name: 'good',
  378. value: 4500,
  379. },
  380. {
  381. name: 'success',
  382. value: 3800,
  383. },
  384. {
  385. name: 'never',
  386. value: 3000,
  387. },
  388. {
  389. name: 'boy',
  390. value: 2500,
  391. },
  392. {
  393. name: 'girl',
  394. value: 2300,
  395. },
  396. {
  397. name: 'github',
  398. value: 2000,
  399. },
  400. {
  401. name: 'hbuilder',
  402. value: 1900,
  403. },
  404. {
  405. name: 'dcloud',
  406. value: 1800,
  407. },
  408. {
  409. name: 'china',
  410. value: 1700,
  411. },
  412. {
  413. name: '1204505056',
  414. value: 1600,
  415. },
  416. {
  417. name: '972435319',
  418. value: 1500,
  419. },
  420. {
  421. name: 'young',
  422. value: 1200,
  423. },
  424. {
  425. name: 'old',
  426. value: 1100,
  427. },
  428. {
  429. name: 'vuex',
  430. value: 900,
  431. },
  432. {
  433. name: 'router',
  434. value: 800,
  435. },
  436. {
  437. name: 'money',
  438. value: 700,
  439. },
  440. {
  441. name: 'qingdao',
  442. value: 800,
  443. },
  444. {
  445. name: 'yantai',
  446. value: 9000,
  447. },
  448. {
  449. name: 'author is very cool',
  450. value: 9200,
  451. },
  452. ],
  453. },
  454. ],
  455. },
  456. //更新日志
  457. reverse: true,
  458. activities: [],
  459. noticeList: [],
  460. //其他信息
  461. userAgent: navigator.userAgent,
  462. //卡片图标
  463. iconList: [
  464. {
  465. icon: 'video',
  466. title: '视频播放器',
  467. link: '/vab/player',
  468. color: '#ffc069',
  469. },
  470. {
  471. icon: 'table',
  472. title: '表格',
  473. link: '/vab/table/comprehensiveTable',
  474. color: '#5cdbd3',
  475. },
  476. {
  477. icon: 'laptop-code',
  478. title: '源码',
  479. link: 'https://github.com/chuzhixin/vue-admin-beautiful',
  480. color: '#b37feb',
  481. },
  482. {
  483. icon: 'book',
  484. title: '书籍',
  485. link: '',
  486. color: '#69c0ff',
  487. },
  488. {
  489. icon: 'bullhorn',
  490. title: '公告',
  491. link: '',
  492. color: '#ff85c0',
  493. },
  494. {
  495. icon: 'gift',
  496. title: '礼物',
  497. link: '',
  498. color: '#ffd666',
  499. },
  500. {
  501. icon: 'balance-scale-left',
  502. title: '公平的世界',
  503. link: '',
  504. color: '#ff9c6e',
  505. },
  506. {
  507. icon: 'coffee',
  508. title: '休息一下',
  509. link: '',
  510. color: '#95de64',
  511. },
  512. ],
  513. }
  514. },
  515. created() {
  516. this.fetchData()
  517. },
  518. beforeDestroy() {
  519. clearInterval(this.timer)
  520. },
  521. mounted() {
  522. let base = +new Date(2020, 1, 1)
  523. let oneDay = 24 * 3600 * 1000
  524. let date = []
  525. let data = [Math.random() * 1500]
  526. let now = new Date(base)
  527. const addData = (shift) => {
  528. now = [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/')
  529. date.push(now)
  530. data.push(this.$baseLodash.random(20000, 60000))
  531. if (shift) {
  532. date.shift()
  533. data.shift()
  534. }
  535. now = new Date(+new Date(now) + oneDay)
  536. }
  537. for (let i = 1; i < 6; i++) {
  538. addData()
  539. }
  540. addData(true)
  541. this.fwl.xAxis[0].data = date
  542. this.fwl.series[0].data = data
  543. this.timer = setInterval(() => {
  544. addData(true)
  545. this.fwl.xAxis[0].data = date
  546. this.fwl.series[0].data = data
  547. }, 3000)
  548. },
  549. methods: {
  550. handleClick(e) {
  551. this.$baseMessage(`点击了${e.name},这里可以写跳转`)
  552. },
  553. handleZrClick(e) {},
  554. handleChangeTheme() {
  555. this.$baseEventBus.$emit('theme')
  556. },
  557. async fetchData() {
  558. const { data } = await getList()
  559. data.map((item, index) => {
  560. if (index === data.length - 1) {
  561. item.color = '#0bbd87'
  562. }
  563. })
  564. this.activities = data
  565. const res = await getNoticeList()
  566. this.noticeList = res.data
  567. /* getRepos({
  568. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  569. }).then((res) => {
  570. const per_page = Math.ceil(res.data.stargazers_count / 100);
  571. alert(per_page);
  572. getStargazers({
  573. token: "1061286824f978ea3cf98b7b8ea26fe27ba7cea1",
  574. page: 1,
  575. per_page: res.per_page,
  576. }).then((res) => {
  577. alert(JSON.stringify(res));
  578. });
  579. }); */
  580. },
  581. },
  582. }
  583. </script>
  584. <style lang="scss" scoped>
  585. .index-container {
  586. padding: 0 !important;
  587. margin: 0 !important;
  588. background: #f5f7f8 !important;
  589. ::v-deep {
  590. .el-alert {
  591. padding: $base-padding;
  592. &--info.is-light {
  593. min-height: 82px;
  594. padding: $base-padding;
  595. margin-bottom: 15px;
  596. color: #909399;
  597. background-color: $base-color-white;
  598. border: 1px solid #ebeef5;
  599. }
  600. }
  601. .el-card__body {
  602. .echarts {
  603. width: 100%;
  604. height: 115px;
  605. }
  606. }
  607. }
  608. .card {
  609. ::v-deep {
  610. .el-card__body {
  611. .echarts {
  612. width: 100%;
  613. height: 305px;
  614. }
  615. }
  616. }
  617. }
  618. .bottom {
  619. padding-top: 20px;
  620. margin-top: 5px;
  621. color: #595959;
  622. text-align: left;
  623. border-top: 1px solid $base-border-color;
  624. }
  625. .table {
  626. width: 100%;
  627. color: #666;
  628. border-collapse: collapse;
  629. background-color: #fff;
  630. td {
  631. position: relative;
  632. min-height: 20px;
  633. padding: 9px 15px;
  634. font-size: 14px;
  635. line-height: 20px;
  636. border: 1px solid #e6e6e6;
  637. &:nth-child(odd) {
  638. width: 20%;
  639. text-align: right;
  640. background-color: #f7f7f7;
  641. }
  642. }
  643. }
  644. .icon-panel {
  645. height: 117px;
  646. text-align: center;
  647. cursor: pointer;
  648. svg {
  649. font-size: 40px;
  650. }
  651. p {
  652. margin-top: 10px;
  653. }
  654. }
  655. .bottom-btn {
  656. button {
  657. margin: 5px 10px 15px 0;
  658. }
  659. }
  660. }
  661. </style>