Merge pull request #34 from zsjy/dev

Dev
This commit is contained in:
宏尘 2024-12-07 07:08:50 +08:00 committed by GitHub
commit 158cdef738
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 9564 additions and 9015 deletions

8
package-lock.json generated
View File

@ -11,7 +11,7 @@
"dependencies": {
"html2canvas": "^1.4.1",
"qrcode": "^1.5.1",
"remixicon": "^4.3.0"
"remixicon": "^4.5.0"
},
"devDependencies": {
"@babel/core": "^7.15.5",
@ -7377,9 +7377,9 @@
}
},
"node_modules/remixicon": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.3.0.tgz",
"integrity": "sha512-jRYQ37dTFSkJtvcxwTUAkIiXkYRvA9EDvVuXPNrmt2xf/VS//CRgFtsX2TAFBoQOhh9SDh7l6La4Xu12snEyxg=="
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.5.0.tgz",
"integrity": "sha512-IP/wNQGG3JCigaeFF3DERSTqMIZBlNu1yu8clNGB7wFe7ZN/ueKMplFHL5uEbnGpCzqfY6MlxIYn2vRzub+5cQ=="
},
"node_modules/remove-bom-buffer": {
"version": "3.0.0",

View File

@ -54,6 +54,6 @@
"dependencies": {
"html2canvas": "^1.4.1",
"qrcode": "^1.5.1",
"remixicon": "^4.3.0"
"remixicon": "^4.5.0"
}
}

View File

@ -46,10 +46,12 @@ spec:
name: record_number_ps
label: 公安部备案
placeholder: 'X公网安备 XXXXXXXXXXXXXX号'
- $formkit: text
- $formkit: code
name: custom_text
language: html
height: 45px
label: 自定义内容
placeholder: '自定义内容'
placeholder: '自定义内容支持html'
help: '在网站页脚建站时间上方显示自定义内容。'
- $formkit: datetime-local
name: website_time
@ -96,49 +98,93 @@ spec:
- group: basic_style
label: '基础样式'
formSchema:
- $formkit: group
name: console
label: 控制台
value:
show_console: false
console_icon: ri-equalizer-line
console_title: 控制台
console_url: '/console'
console_target: _blank
children:
- $formkit: radio
name: show_console
id: show_console
label: 显示控制台
label: 控制台按钮
help: 在网站右上角显示用于登录或进入后台管理的按钮。
value: 'false'
options:
- label: 显示
value: true
- label: 隐藏
value: false
- label: 登录组件样式
value: 'logon'
- label: 控制台按钮样式
value: 'console'
- label: 不显示
value: 'false'
- $formkit: group
name: logon
if: $get(show_console).value != 'false'
label: 登录组件样式
value:
console_login_class: 'ri-login-circle-line'
console_person_class: 'ri-account-circle-line'
console_manage_class: 'ri-settings-3-line'
console_logout_class: 'ri-logout-circle-line'
children:
- $formkit: text
name: console_login_class
label: 登录按钮图标
help: '输入登录按钮图标class清空不显示图标。'
- $formkit: text
name: console_person_class
label: 个人中心按钮图标
help: '输入个人中心按钮图标class清空不显示图标。'
- $formkit: text
name: console_manage_class
label: 后台管理按钮图标
help: '输入后台管理按钮图标class清空不显示图标。'
- $formkit: text
name: console_logout_class
label: 退出登录按钮图标
help: '输入退出登录按钮图标class清空不显示图标。'
- $formkit: group
name: console
if: $get(show_console).value != 'false'
label: 控制台按钮样式
value:
console_icon: 'ri-equalizer-line'
console_title: '控制台'
console_url: '/console'
console_target: '_blank'
console_logon_url: '/console'
console_logon_target: '_blank'
children:
- $formkit: text
name: console_icon
if: $get(show_console).value
label: 控制台图标
help: '控制台图标,留空显示默认图标。'
- $formkit: text
name: console_title
if: $get(show_console).value
label: 控制台鼠标悬停提示,留空不显示
- $formkit: text
name: console_url
validation: required
if: $get(show_console).value
label: 控制台跳转URL
help: '控制台跳转URL可使用“redirect_uri”参数进行登录后跳转例如“/login?redirect_uri=/”,登录后默认跳转到前台页面。'
validation: requiredc
label: 未登录控制台跳转URL
value: '/login'
help: '未登录,控制台跳转URL可使用“redirect_uri”参数进行登录后跳转例如“/login?redirect_uri=/”,登录后默认跳转到前台页面。'
- $formkit: radio
if: $get(show_console).value
name: console_target
validation: required
label: 控制台跳转方式
value: _blank
label: 未登录,控制台跳转方式
options:
- value: _blank
- value: '_blank'
label: 新标签页
- value: _self
- value: '_self'
label: 当前窗口
- $formkit: text
name: console_logon_url
validation: required
label: 已登录控制台跳转URL
help: '已登录控制台跳转URL。'
- $formkit: radio
name: console_logon_target
validation: required
label: 已登录,控制台跳转方式
options:
- value: '_blank'
label: 新标签页
- value: '_self'
label: 当前窗口
- $formkit: radio
name: load_progress
@ -919,14 +965,14 @@ spec:
label: 不显示
- $formkit: radio
name: recent_posts_pinned
label: 侧边栏最近文章-显示”置顶”标记
label: 侧边栏最近文章-显示模式
value: false
help: '侧边栏最近文章是否显示”置顶”标记。'
help: '侧边栏最近文章显示模式,置顶优先:优先显示置顶文章,同时显示置顶标记,发布优先:优先显示最新发布的文章,不显示置顶标记。'
options:
- value: true
label: 显示
label: 置顶优先
- value: false
label: 不显示
label: 发布优先
- $formkit: number
name: recent_comments_num
label: 侧边栏最近评论-展示评论数量

View File

@ -4136,17 +4136,11 @@ button.swiper-pagination-bullet {
}
.navbar-console {
float: right;
margin-left: 5px;
align-items: center;
justify-content: center;
display: flex;
background: transparent !important;
& > i {
font-size: 23px;
color: var(--main);
display: none !important;
}
.navbar-logon {
display: none !important;
}
}
}
@ -4183,9 +4177,6 @@ button.swiper-pagination-bullet {
margin-left: 0;
}
.navbar-console {
display: none;
}
}
.swiper-button-prev,
@ -5316,3 +5307,85 @@ button.swiper-pagination-bullet {
.search-page-title {
margin-top: 0 !important;
}
//登录组件
.navbar-logon {
margin-left: 5px;
&-head {
& > img {
border-radius: 50%;
width: 34px;
height: 34px;
}
}
&-group {
display: block;
visibility: hidden;
position: absolute;
width: auto;
min-width: 8rem;
right: -6.8rem;
top: 60px;
z-index: 5;
opacity: 0;
border-top: 3px solid var(--theme);
transform-origin: top;
background: var(--bg-d);
box-shadow: 0 0 10px rgba(0, 0, 0, .15);
border-radius: 0 0 var(--radius-inner) var(--radius-inner);
padding: 10px 0;
transform: translateX(-50%) perspective(600px) rotateX(-45deg);
transition: opacity .35s, visibility .35s, transform .35s, -webkit-transform .35s;
&-menu {
padding: 5px;
text-align: center;
line-height: 2rem;
& > a {
color: var(--title);
font-size: 15px;
width: 100%;
display: block;
i {
color: var(--title);
font-size: 18px;
}
}
}
&::before {
content: "";
position: absolute;
top: -10px;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid var(--theme);
}
}
&.active {
.navbar-logon-group {
visibility: visible;
opacity: 1;
transform: translateX(-50%) perspective(600px) rotateX(0);
}
.navbar-logon-group-menu:hover {
background: var(--bg-a);
a, i {
color: var(--theme);
}
}
}
}

View File

@ -143,6 +143,25 @@ const commonContext = {
}
})
},
/* 激活登录窗口下拉框功能 */
initLogonMenu() {
$('.navbar-logon').each(function (index, item) {
const trigger = $(item).attr('trigger') || 'click'
if (trigger === 'hover') {
$(this).hover(
() => $(this).addClass('active'),
() => $(this).removeClass('active')
)
} else {
$(this).on('click', function (e) {
e.stopPropagation()
$(this).toggleClass('active')
$(document).one('click', () => $(this).removeClass('active'))
e.stopPropagation()
})
}
})
},
/* 处理滚动 */
initScroll() {
window.initTop = 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,7 +21,7 @@
th:src="${#theme.assets('/img/ba.webp')}" height="auto" width="auto" alt="备案" style="vertical-align: text-top; width: 1.2em; margin-right: 4px;"/>[[${theme.config.basic_info.record_number}]]</a>
<a th:if="${!#strings.isEmpty(theme.config.basic_info.record_number_ps)}" class="record footer-truncation" th:href="'https://beian.mps.gov.cn/#/query/webSearch?code=' + ${theme.config.basic_info.record_number_ps.replaceAll('[^\d]', '')}" target="_blank" rel="noopener noreferrer nofollow"><img
th:src="${#theme.assets('/img/ga.webp')}" height="auto" width="auto" alt="公网安备" style="vertical-align: text-top; width: 1.2em; margin-right: 4px;"/>[[${theme.config.basic_info.record_number_ps}]]</a></p>
<p th:if="${!#strings.isEmpty(theme.config.basic_info.custom_text)}">[[${theme.config.basic_info.custom_text}]]</p>
<p th:if="${!#strings.isEmpty(theme.config.basic_info.custom_text)}" th:utext="${theme.config.basic_info.custom_text}"></p>
<p class="icon-spot" th:if="${!#strings.isEmpty(theme.config.basic_info.website_time) || theme.config.enhance.enable_busuanzi == true}">
<span th:if="${!#strings.isEmpty(theme.config.basic_info.website_time)}" id="websiteDate">建站<span class="stand">00</span><span class="stand">0</span><span class="stand">0</span><span class="stand">0</span></span>
<span th:if="${theme.config.enhance.busuanzi_group.enable_busuanzi == true}" class="icon-spot footer-truncation">

View File

@ -25,7 +25,7 @@ th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage
<link rel="canonical" th:href="${#strings.isEmpty(canonical) ? '' : #strings.startsWith(canonical,'http') ? canonical : (#strings.endsWith(canonical,'/') ? #strings.substringBefore(site.url, '/') : site.url + canonical)}"/>
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/theme.min.css(mew=${theme.spec.version})}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/lib/remixicon@4.3.0/remixicon.min.css}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/lib/remixicon@4.5.0/remixicon.min.css}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/style.min.css(mew=${theme.spec.version})}">
<link th:if="${theme.config.basic_style.theme_style == 'celebration'}" rel="preload stylesheet" as="style" th:href="@{/assets/css/celebration.min.css(mew=${theme.spec.version})}">

View File

@ -2,7 +2,8 @@
th:class="${theme.config.basic_style.theme_style}"
th:fragment="layout (title, canonical, content, isPost)">
<th:block th:with="contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)},
enableComment = ${baseEnableComment == true && site.comment.enable}">
enableComment = ${baseEnableComment == true && site.comment.enable},
logonUserName = ${#authentication.name != 'anonymousUser' ? #authentication.name : ''}">
<th:block th:with="stats = ${siteStatsFinder.getStats()}">
<th:block th:replace="~{common/head :: head}"/>

View File

@ -1,4 +1,5 @@
<header class="navbar" th:classappend="${!theme.config.basic_info.header_fixed}? 'animation' : 'fixed'" xmlns:th="https://www.thymeleaf.org">
<header class="navbar" th:classappend="${!theme.config.basic_info.header_fixed}? 'animation' : 'fixed'"
xmlns:th="https://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
<div class="navbar-above" th:classappend="${!theme.config.basic_info.header_fixed}? 'animation'">
<div th:class="${theme.config.basic_style.sidebar_column != 'all' ? 'container two-column' : 'container' }">
<i class="ri-list-unordered navbar-slideicon"></i>
@ -69,10 +70,32 @@
</div>
<i th:unless="${theme.config.page_config.search.search_enable}" class="ri-search-line navbar-searchicon" onclick="javascript:SearchWidget.open();"></i>
<a th:if="${theme.config.page_config.search.search_enable}" class="navbar-searchicon" target="_self" href="/search"><i class="ri-search-line navbar-searchicon"></i></a>
<a data-not-pjax th:if="${theme.config.basic_style.console.show_console}" class="navbar-console" th:href="@{${theme.config.basic_style.console.console_url}}" th:target="${theme.config.basic_style.console.console_target}"
<a data-not-pjax th:if="${theme.config.basic_style.show_console == 'console'}" class="navbar-console" th:href="${!#strings.isEmpty(logonUserName) ? theme.config.basic_style.console.console_logon_url : theme.config.basic_style.console.console_url}"
th:target="${!#strings.isEmpty(logonUserName) ? theme.config.basic_style.console.console_logon_target : theme.config.basic_style.console.console_target}"
th:title="${theme.config.basic_style.console.console_title}">
<i th:class="${#strings.defaultString(theme.config.basic_style.console.console_icon, 'ri-equalizer-line')}"></i>
</a>
<div th:if="${theme.config.basic_style.show_console == 'logon'}" class="navbar-logon" trigger="hover" th:with="currentUser = ${contributorFinder.getContributor(#authentication.name)}">
<div class="navbar-logon-head">
<img th:src="${currentUser.avatar ?: #theme.assets('/img/avatar.svg')}"
th:alt="${currentUser.displayName}"
/>
</div>
<ul class="navbar-logon-group">
<li sec:authorize="isAuthenticated()" class="navbar-logon-group-menu">
<a href="/uc" target="_blank"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_person_class)}" th:class="${theme.config.basic_style.logon.console_person_class}"></i> 个人中心</a>
</li>
<li sec:authorize="isAuthenticated()" class="navbar-logon-group-menu">
<a href="/console" target="_blank"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_manage_class)}" th:class="${theme.config.basic_style.logon.console_manage_class}"></i> 后台管理</a>
</li>
<li sec:authorize="isAuthenticated()" class="navbar-logon-group-menu">
<a href="/logout"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_logout_class)}" th:class="${theme.config.basic_style.logon.console_logout_class}"></i> 退出登录</a>
</li>
<li sec:authorize="isAnonymous()" class="navbar-logon-group-menu">
<a href="/login" onclick="this.href = '/login?redirect_uri=' + encodeURIComponent(window.location.href)"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_login_class)}" th:class="${theme.config.basic_style.logon.console_login_class}"></i> 登录</a>
</li>
</ul>
</div>
</div>
</div>

View File

@ -18,27 +18,27 @@
<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" th:with="visit = ${stats.visit}">
<p class="heading" th:text="|访问${visit / 10000000 > 0 ? '(KW)' : (visit / 10000 > 0 ? '(W)' : '')}|"></p>
<p class="heading" th:text="|访问${visit / 10000000 > 0 ? '(千万)' : (visit / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${visit / 10000 > 0} ? ${visit}" th:text="${visit / 10000000 > 0} ? (${#numbers.formatDecimal(visit / 10000000.0,1,1)}) : (${visit / 10000 > 0} ? (${#numbers.formatDecimal(visit / 10000.0,1,1)}) : ${visit})"></p>
</div>
<div th:case="upvote" th:with="upvote = ${stats.upvote}">
<p class="heading" th:text="|点赞${upvote / 10000000 > 0 ? '(KW)' : (upvote / 10000 > 0 ? '(W)' : '')}|"></p>
<p class="heading" th:text="|点赞${upvote / 10000000 > 0 ? '(千万)' : (upvote / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${upvote / 10000 > 0} ? ${upvote}" th:text="${upvote / 10000000 > 0} ? (${#numbers.formatDecimal(upvote / 10000000.0,1,1)}) : (${upvote / 10000 > 0} ? (${#numbers.formatDecimal(upvote / 10000.0,1,1)}) : ${upvote})"></p>
</div>
<div th:case="comment" th:with="comment = ${stats.comment}">
<p class="heading" th:text="|评论${comment / 10000000 > 0 ? '(KW)' : (comment / 10000 > 0 ? '(W)' : '')}|"></p>
<p class="heading" th:text="|评论${comment / 10000000 > 0 ? '(千万)' : (comment / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${comment / 10000 > 0} ? ${comment}" th:text="${comment / 10000000 > 0} ? (${#numbers.formatDecimal(comment / 10000000.0,1,1)}) : (${comment / 10000 > 0} ? (${#numbers.formatDecimal(comment / 10000.0,1,1)}) : ${comment})"></p>
</div>
<div th:case="category" th:with="category = ${stats.category}">
<p class="heading" th:text="|分类${category / 10000000 > 0 ? '(KW)' : (category / 10000 > 0 ? '(W)' : '')}|"></p>
<p class="heading" th:text="|分类${category / 10000000 > 0 ? '(千万)' : (category / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${category / 10000 > 0} ? ${category}" th:text="${category / 10000000 > 0} ? (${#numbers.formatDecimal(category / 10000000.0,1,1)}) : (${category / 10000 > 0} ? (${#numbers.formatDecimal(category / 10000.0,1,1)}) : ${category})"></p>
</div>
<div th:case="tag" th:with="tagsList = ${tagFinder.listAll()}, tags = ${#lists.size(tagsList)}">
<p class="heading" th:text="|标签${tags / 10000000 > 0 ? '(KW)' : (tags / 10000 > 0 ? '(W)' : '')}|"></p>
<p class="heading" th:text="|标签${tags / 10000000 > 0 ? '(千万)' : (tags / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${tags / 10000 > 0} ? ${tags}" th:text="${tags / 10000000 > 0} ? (${#numbers.formatDecimal(tags / 10000000.0,1,1)}) : (${tags / 10000 > 0} ? (${#numbers.formatDecimal(tags / 10000.0,1,1)}) : ${tags})"></p>
</div>
<div th:case="post" th:with="post = ${stats.post}">
<p class="heading" th:text="|文章${post / 10000000 > 0 ? '(KW)' : (post / 10000 > 0 ? '(W)' : '')}|"></p>
<div th:case="*" th:with="post = ${stats.post}">
<p class="heading" th:text="|文章${post / 10000000 > 0 ? '(千万)' : (post / 10000 > 0 ? '(万)' : '')}|"></p>
<p class="value" th:title="${post / 10000 > 0} ? ${post}" th:text="${post / 10000000 > 0} ? (${#numbers.formatDecimal(post / 10000000.0,1,1)}) : (${post / 10000 > 0} ? (${#numbers.formatDecimal(post / 10000.0,1,1)}) : ${post})"></p>
</div>
</div>

View File

@ -1,7 +1,10 @@
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar)"
th:class="'card widget recent-posts ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)}, posts = ${postFinder.list(1,num)}, isEmpty = ${#lists.isEmpty(posts)}">
th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)},
sortCondition = ${theme.config.sidebar.recent_posts_pinned ? {'spec.pinned,desc', 'spec.publishTime,desc', 'metadata.creationTimestamp,desc'} : {'spec.publishTime,desc', 'metadata.creationTimestamp,desc'}},
posts = ${postFinder.list({page: 1, size: num, sort: sortCondition})},
isEmpty = ${#lists.isEmpty(posts)}">
<div class="card-title">
<i th:class="${#strings.defaultString(sidebar.icon, 'ri-history-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '最新文章')}"></span>
<a th:if="${theme.config.sidebar.recent_posts_more}" class="card-more" th:href="@{/archives}">更多<i class="ri-arrow-right-double-line"></i></a>

View File

@ -30,7 +30,7 @@ spec:
settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap
# 版本号
version: 1.3.1
version: 1.3.2.beta8
# 最低支持的 Halo 版本
require: ">=2.20.0"
# 许可