Skip to content

Commit

Permalink
feat(profile):增加信息模块统计项配置
Browse files Browse the repository at this point in the history
增加信息模块统计项配置
  • Loading branch information
mjsoftking committed Dec 1, 2023
1 parent 06a2ee2 commit 7a33165
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
27 changes: 26 additions & 1 deletion settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 侧边栏信息-主题按钮
Expand Down Expand Up @@ -1082,4 +1107,4 @@ spec:
name: inline_js_body
label: "内嵌JS(body)"
placeholder: 请输入 JS 代码内容
help: '填入JS代码,无需script标签,将插入body标签尾部。'
help: '填入JS代码,无需script标签,将插入body标签尾部。'
32 changes: 18 additions & 14 deletions templates/widget/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,28 @@
</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>
<p class="heading">分类</p>
<p class="value" th:text="${stats.category}"></p>
<div th:case="upvote">
<p class="heading">点赞</p>
<p class="value" th:text="${stats.upvote}"></p>
</div>
</div>
<div class="level-item">
<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 th:case="*">
<p class="heading">文章</p>
<p class="value" th:text="${stats.post}"></p>
</div>
</div>
</nav>
<div th:if="${!#strings.isEmpty(theme.config.sidebar.profile_theme_button)}" class="level"
Expand All @@ -52,4 +56,4 @@
</a>
</div>
</div>
</div>
</div>

0 comments on commit 7a33165

Please sign in to comment.