|
5 | 5 | </template> |
6 | 6 |
|
7 | 7 | <script> |
8 | | -import { mapMutations } from "vuex"; |
| 8 | +import {mapMutations} from "vuex"; |
| 9 | +import Ribbons from '@/assets/js/ribbon.js' |
9 | 10 |
|
10 | 11 | export default { |
11 | | - components: {}, |
12 | | - data() { |
13 | | - return { |
14 | | - location: [], |
15 | | - timer: "", |
16 | | - showBackTop: true |
17 | | - }; |
18 | | - }, |
19 | | - watch: {}, |
20 | | - mounted() { |
21 | | - this.initPanel(); |
22 | | - }, |
23 | | - computed: {}, |
24 | | - methods: { |
25 | | - ...mapMutations(["setArchives", "setCategory", "setTags", "setNewComments", "setNewArticles", "setTotals"]), |
26 | | - initPanel() { |
27 | | - this.$api.listArchive({ countType: "month", pageNum: 1, pageSize: 1000 }).then((res) => { |
28 | | - if (res.code === 200) { |
29 | | - this.setArchives(res.rows); |
| 12 | + Ribbons, |
| 13 | + components: {}, |
| 14 | + data() { |
| 15 | + return { |
| 16 | + location: [], |
| 17 | + timer: "", |
| 18 | + showBackTop: true |
| 19 | + }; |
| 20 | + }, |
| 21 | + watch: {}, |
| 22 | + mounted() { |
| 23 | + this.initPanel(); |
| 24 | + Ribbons.start() |
| 25 | + }, |
| 26 | + computed: {}, |
| 27 | + methods: { |
| 28 | + ...mapMutations(["setArchives", "setCategory", "setTags", "setNewComments", "setNewArticles", "setTotals"]), |
| 29 | + initPanel() { |
| 30 | + this.$api.listArchive({countType: "month", pageNum: 1, pageSize: 1000}).then((res) => { |
| 31 | + if (res.code === 200) { |
| 32 | + this.setArchives(res.rows); |
| 33 | + } |
| 34 | + ; |
| 35 | + }); |
| 36 | + this.$api.listCategory().then((res) => { |
| 37 | + if (res.code === 200) { |
| 38 | + this.setTotals({key: "category", value: res.total}); |
| 39 | + this.setCategory(res.rows); |
| 40 | + } |
| 41 | + }); |
| 42 | + this.$api.listTag().then((res) => { |
| 43 | + if (res.code === 200) { |
| 44 | + this.setTotals({key: "tag", value: res.total}); |
| 45 | + this.setTags(res.rows); |
| 46 | + } |
| 47 | + }); |
| 48 | + this.$api.listComment({ |
| 49 | + pageNum: 1, |
| 50 | + pageSize: 5 |
| 51 | + }).then((res) => { |
| 52 | + if (res.code === 200) this.setNewComments(res.rows); |
| 53 | + }); |
| 54 | + this.$api.listArticle({ |
| 55 | + pageNum: 1, |
| 56 | + pageSize: 5, |
| 57 | + }).then((res) => { |
| 58 | + if (res.code === 200) { |
| 59 | + this.setTotals({key: "article", value: res.total}); |
| 60 | + this.setNewArticles(res.rows); |
| 61 | + } |
| 62 | + }); |
30 | 63 | } |
31 | | - ; |
32 | | - }); |
33 | | - this.$api.listCategory().then((res) => { |
34 | | - if (res.code === 200) { |
35 | | - this.setTotals({ key: "category", value: res.total }); |
36 | | - this.setCategory(res.rows); |
37 | | - } |
38 | | - }); |
39 | | - this.$api.listTag().then((res) => { |
40 | | - if (res.code === 200) { |
41 | | - this.setTotals({ key: "tag", value: res.total }); |
42 | | - this.setTags(res.rows); |
43 | | - } |
44 | | - }); |
45 | | - this.$api.listComment({ |
46 | | - pageNum: 1, |
47 | | - pageSize: 5 |
48 | | - }).then((res) => { |
49 | | - if (res.code === 200) this.setNewComments(res.rows); |
50 | | - }); |
51 | | - this.$api.listArticle({ |
52 | | - pageNum: 1, |
53 | | - pageSize: 5, |
54 | | - }).then((res) => { |
55 | | - if (res.code === 200) { |
56 | | - this.setTotals({ key: "article", value: res.total }); |
57 | | - this.setNewArticles(res.rows); |
58 | | - } |
59 | | - }); |
60 | 64 | } |
61 | | - } |
62 | 65 | }; |
63 | 66 | </script> |
64 | 67 |
|
|
0 commit comments