feat(profile):增加信息模块统计项配置

增加信息模块统计项配置
This commit is contained in:
mjking 2023-12-01 13:36:24 +08:00 committed by GitHub
parent 06a2ee2fc0
commit 7a331658a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 15 deletions

View File

@ -590,6 +590,31 @@ spec:
name: profile_location
label: 侧边栏信息-地理位置
placeholder: '请输入个人所在地'
- $formkit: repeater
name: custom_stats
label: 侧边栏信息-统计
help: 可最多配置3个统计项未配置统计项时不显示。
max: 3
value:
- type: post
- type: category
- type: comment
children:
- $formkit: select
name: type
label: 统计项
value: ""
options:
- value: 'post'
label: 文章数量
- value: 'category'
label: 分类数量
- value: 'comment'
label: 评论数量
- value: 'upvote'
label: 点赞数量
- value: 'visit'
label: 访问数量
- $formkit: text
name: profile_theme_button
label: 侧边栏信息-主题按钮

View File

@ -15,23 +15,27 @@
</p>
</div>
</nav>
<nav class="level">
<div class="level-item">
<div>
<p class="heading">文章</p>
<p class="value" th:text="${stats.post}"></p>
<nav class="level" th:if="${!#lists.isEmpty(theme.config.sidebar.custom_stats)}">
<div th:each="item,sindex :${theme.config.sidebar.custom_stats}" class="level-item" th:switch="${item.type}">
<div th:case="visit">
<p class="heading">访问</p>
<p class="value" th:text="${stats.visit}"></p>
</div>
</div>
<div class="level-item has-text-centered is-marginless">
<div>
<div th:case="upvote">
<p class="heading">点赞</p>
<p class="value" th:text="${stats.upvote}"></p>
</div>
<div th:case="comment">
<p class="heading">评论</p>
<p class="value" th:text="${stats.comment}"></p>
</div>
<div th:case="category">
<p class="heading">分类</p>
<p class="value" th:text="${stats.category}"></p>
</div>
</div>
<div class="level-item">
<div>
<p class="heading">评论</p>
<p class="value" th:text="${stats.comment}"></p>
<div th:case="*">
<p class="heading">文章</p>
<p class="value" th:text="${stats.post}"></p>
</div>
</div>
</nav>