From 9c6bda84d322dca967376318fcfc342db727f4d4 Mon Sep 17 00:00:00 2001
From: Ryan Wang
Date: Fri, 30 Sep 2022 16:06:18 +0800
Subject: [PATCH] feat: support for displaying site content statistics
(halo-dev/console#624)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
#### What type of PR is this?
/kind feature
/milestone 2.0
#### What this PR does / why we need it:
- 支持在文章和自定义页面的管理列表显示访问数和评论数。
- 仪表盘支持显示整站的访问数。
适配 https://github.com/halo-dev/halo/pull/2476
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2430
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. Halo 需要 https://github.com/halo-dev/halo/pull/2476 PR 中的分支。
2. 需要执行 `pnpm install && pnpm build:packages`
3. 随机访问前台文章或者自定义页面,以及添加评论。
4. 查看后台是否正确统计文章浏览数和评论数。
TODO list:
- [ ] 更新 `@halo-dev/api-client`
#### Does this PR introduce a user-facing change?
```release-note
支持在文章和自定义页面的管理列表显示访问数和评论数
```
---
package.json | 2 +-
pnpm-lock.yaml | 8 ++++----
src/modules/contents/pages/SinglePageList.vue | 14 +++++++++++++-
src/modules/contents/posts/PostList.vue | 8 ++++++--
.../widgets/RecentPublishedWidget.vue | 8 ++++++--
.../dashboard/widgets/ViewsStatsWidget.vue | 18 +++++++++++++++++-
src/utils/api-client.ts | 2 ++
7 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/package.json b/package.json
index 263abc237..e78ebb640 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
"@formkit/themes": "1.0.0-beta.10",
"@formkit/vue": "1.0.0-beta.10",
"@halo-dev/admin-shared": "workspace:*",
- "@halo-dev/api-client": "^0.0.34",
+ "@halo-dev/api-client": "^0.0.35",
"@halo-dev/components": "workspace:*",
"@halo-dev/richtext-editor": "^0.0.0-alpha.7",
"@tiptap/extension-character-count": "2.0.0-beta.31",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f1aaf0996..bbb63b8b5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -14,7 +14,7 @@ importers:
'@formkit/themes': 1.0.0-beta.10
'@formkit/vue': 1.0.0-beta.10
'@halo-dev/admin-shared': workspace:*
- '@halo-dev/api-client': ^0.0.34
+ '@halo-dev/api-client': ^0.0.35
'@halo-dev/components': workspace:*
'@halo-dev/richtext-editor': ^0.0.0-alpha.7
'@iconify-json/mdi': ^1.1.33
@@ -101,7 +101,7 @@ importers:
'@formkit/themes': 1.0.0-beta.10_tailwindcss@3.1.8
'@formkit/vue': 1.0.0-beta.10_k5hp3txgeyj6le63abiyc7wx3u
'@halo-dev/admin-shared': link:packages/shared
- '@halo-dev/api-client': 0.0.34
+ '@halo-dev/api-client': 0.0.35
'@halo-dev/components': link:packages/components
'@halo-dev/richtext-editor': 0.0.0-alpha.7_vue@3.2.40
'@tiptap/extension-character-count': 2.0.0-beta.31
@@ -1886,8 +1886,8 @@ packages:
- windicss
dev: false
- /@halo-dev/api-client/0.0.34:
- resolution: {integrity: sha512-WOEbyRjPSASH1tyQjQQU/RjXKtRPSD+L6erAWLUfy7BIsyCAMSBdkF3auBWaevUt08uyCBeI3ln+sP+VPyFM0A==}
+ /@halo-dev/api-client/0.0.35:
+ resolution: {integrity: sha512-+WBXS2/tHmeugeiDNXmBrtV9NiU22lylzwcugH/eTXGy7MnpAG4j//o2OOYyhVcp9BUBoh7MHuu0UcyLHq1bgg==}
dev: false
/@halo-dev/richtext-editor/0.0.0-alpha.7_vue@3.2.40:
diff --git a/src/modules/contents/pages/SinglePageList.vue b/src/modules/contents/pages/SinglePageList.vue
index 1e2c34d68..2dea5e8a6 100644
--- a/src/modules/contents/pages/SinglePageList.vue
+++ b/src/modules/contents/pages/SinglePageList.vue
@@ -535,7 +535,6 @@ function handleSortItemChange(sortItem?: SortItem) {