diff --git a/package-lock.json b/package-lock.json index 1eb414348..a222dad74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2826,9 +2826,9 @@ "dev": true }, "axios": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz", - "integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", "requires": { "follow-redirects": "1.5.10", "is-buffer": "^2.0.2" @@ -6700,9 +6700,9 @@ } }, "filepond": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/filepond/-/filepond-4.8.2.tgz", - "integrity": "sha512-CWXCv3amz1ECVidA33vezuXqfBI0O+UKWGh3g4574ZbyLwSwcJEbOy0vv2kgE0Xdg39xDQAruxHUGZm/xYK2oA==" + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/filepond/-/filepond-4.9.2.tgz", + "integrity": "sha512-YJGwIPFnkHxtG88LLpSuZSCySaxRDOKqSKywQ7KgPCRoUzHD8e5uC8Ii78+mjfBaU5QDOND/FFQLXLoLE99oJw==" }, "filepond-plugin-image-preview": { "version": "4.5.0", @@ -10276,9 +10276,9 @@ } }, "marked": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", - "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==" + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz", + "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==" }, "md5.js": { "version": "1.3.5", @@ -14521,9 +14521,9 @@ "dev": true }, "vue": { - "version": "2.6.10", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", - "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz", + "integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ==" }, "vue-clipboard2": { "version": "0.3.1", @@ -14713,9 +14713,9 @@ } }, "vue-template-compiler": { - "version": "2.6.10", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz", - "integrity": "sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz", + "integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==", "dev": true, "requires": { "de-indent": "^1.0.2", diff --git a/package.json b/package.json index 0e048bcb7..c4e459807 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,15 @@ "dependencies": { "animate.css": "^3.7.0", "ant-design-vue": "^1.4.10", - "axios": "^0.18.0", + "axios": "^0.19.0", "enquire.js": "^2.1.6", - "filepond": "^4.7.2", + "filepond": "^4.9.2", "filepond-plugin-image-preview": "^4.5.0", "halo-editor": "^2.8.2", - "marked": "^0.7.0", + "marked": "^0.8.0", "moment": "^2.24.0", "verte": "^0.0.12", - "vue": "^2.6.10", + "vue": "^2.6.11", "vue-clipboard2": "^0.3.0", "vue-codemirror-lite": "^1.0.4", "vue-count-to": "^1.0.13", @@ -50,7 +50,7 @@ "less": "^3.10.0", "less-loader": "^5.0.0", "vue-svg-icon-loader": "^2.1.1", - "vue-template-compiler": "^2.6.10" + "vue-template-compiler": "^2.6.11" }, "eslintConfig": { "root": true, diff --git a/src/api/statistics.js b/src/api/statistics.js new file mode 100644 index 000000000..df8ce2206 --- /dev/null +++ b/src/api/statistics.js @@ -0,0 +1,21 @@ +import service from '@/utils/service' + +const baseUrl = '/api/admin/statistics' + +const statisticsApi = {} + +statisticsApi.statistics = () => { + return service({ + url: `${baseUrl}`, + method: 'get' + }) +} + +statisticsApi.statisticsWithUser = () => { + return service({ + url: `${baseUrl}/user`, + method: 'get' + }) +} + +export default statisticsApi diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 819cb8469..0af7a6385 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -12,7 +12,7 @@ @@ -82,10 +82,10 @@ - + @@ -336,7 +336,7 @@ import countTo from 'vue-count-to' import postApi from '@/api/post' import logApi from '@/api/log' -import adminApi from '@/api/admin' +import statisticsApi from '@/api/statistics' import journalApi from '@/api/journal' export default { name: 'Dashboard', @@ -359,7 +359,7 @@ export default { logDrawerVisible: false, postData: [], logData: [], - countsData: {}, + statisticsData: {}, journal: { content: '', photos: [] @@ -379,7 +379,7 @@ export default { } }, created() { - this.getCounts() + this.getStatistics() this.listLatestPosts() this.listLatestLogs() }, @@ -413,7 +413,7 @@ export default { beforeRouteEnter(to, from, next) { next(vm => { vm.interval = setInterval(() => { - vm.getCounts() + vm.getStatistics() }, 5000) }) }, @@ -442,9 +442,9 @@ export default { this.writeLoading = false }) }, - getCounts() { - adminApi.counts().then(response => { - this.countsData = response.data.data + getStatistics() { + statisticsApi.statistics().then(response => { + this.statisticsData = response.data.data this.countsLoading = false }) }, diff --git a/src/views/user/Profile.vue b/src/views/user/Profile.vue index 93677ec2a..33116b8f7 100644 --- a/src/views/user/Profile.vue +++ b/src/views/user/Profile.vue @@ -40,20 +40,21 @@ {{ user.email }}

- {{ counts.establishDays || 0 }} 天 + {{ statistics.establishDays || 0 }} 天

- 累计发表了 {{ counts.postCount || 0 }} 篇文章。 - 累计创建了 {{ counts.attachmentCount || 0 }} 个附件。 - 累计获得了 {{ counts.commentCount || 0 }} 条评论。 - 累计添加了 {{ counts.linkCount || 0 }} 个友链。 - 文章总访问 {{ counts.visitCount || 0 }} 次。 + 累计发表了 {{ statistics.postCount || 0 }} 篇文章。 + 累计创建了 {{ statistics.categoryCount || 0 }} 个分类。 + 累计创建了 {{ statistics.tagCount || 0 }} 个标签。 + 累计获得了 {{ statistics.commentCount || 0 }} 条评论。 + 累计添加了 {{ statistics.linkCount || 0 }} 个友链。 + 文章总访问 {{ statistics.visitCount || 0 }} 次。
@@ -142,7 +143,7 @@