新增页码跳转;修复异常;优化效果

This commit is contained in:
2026-07-25 15:34:40 +08:00
parent 7d56858616
commit 711cff953b
7 changed files with 423 additions and 93 deletions
+24 -5
View File
@@ -38,14 +38,33 @@
</div>
<th:block th:if="${_posts.totalPages>1}">
<div id="pagination">
<div class="post-paging" th:if="${_posts.hasNext()}"
<div id="pagination">
<div class="post-paging"
th:with="_page = ${_posts.page+1},_path = ${path +'page/'+_page }">
<a th:if="${path == '/archives' and #strings.isEmpty(tag)}"
<a th:if="${_posts.hasNext() and path == '/archives' and #strings.isEmpty(tag)}"
th:data="@{/archives(page=${_page})}" th:text="${theme.config.base_set.site_page}"></a>
<a th:if="${path == '/archives' and not #strings.isEmpty(tag)}"
<a th:if="${_posts.hasNext() and path == '/archives' and not #strings.isEmpty(tag)}"
th:data="@{/archives(tag=${tag},page=${_page})}" th:text="${theme.config.base_set.site_page}"></a>
<a th:if="${path != '/archives'}" th:data="${_path}" th:text="${theme.config.base_set.site_page}"></a>
<a th:if="${_posts.hasNext() and path != '/archives'}" th:data="${_path}"
th:text="${theme.config.base_set.site_page}"></a>
<form class="page-jump-form" method="get" th:action="@{${path}}">
<span class="page-jump-label">转到</span>
<input th:if="${not #strings.isEmpty(tag)}" type="hidden" name="tag" th:value="${tag}" />
<span class="page-jump-input-wrap">
<button class="page-jump-step page-jump-step-down" type="button"
title="减少页码" aria-label="减少页码"><i class="ri-subtract-line"
aria-hidden="true"></i></button>
<input class="page-jump-input" type="number" name="page" min="1"
th:max="${_posts.totalPages}" th:value="${_posts.page}"
inputmode="numeric" aria-label="页码" autocomplete="off" required />
<button class="page-jump-step page-jump-step-up" type="button"
title="增加页码" aria-label="增加页码"><i class="ri-add-line"
aria-hidden="true"></i></button>
</span>
<span class="page-jump-total">/ [[${_posts.totalPages}]]</span>
<button class="page-jump-submit" type="submit" title="跳转到指定页"
aria-label="跳转到指定页"><i class="ri-arrow-right-line"></i></button>
</form>
</div>
</div>
</th:block>
+22 -4
View File
@@ -26,14 +26,32 @@
</div>
<th:block th:if="${_moments.totalPages>1}">
<div id="t_pagination">
<div class="post-paging" th:if="${_moments.hasNext()}"
th:with="tag = ${#lists.isEmpty(param.tag) ? null : param.tag[0]},_page = ${_moments.page+1}">
<a th:if="${#strings.isEmpty(tag)}"
<div class="post-paging"
th:with="tag = ${#lists.isEmpty(param.tag) ? null : param.tag[0]},_page = ${_moments.page+1}">
<a th:if="${_moments.hasNext() and #strings.isEmpty(tag)}"
th:data="@{${_path}(page=${_page})}"
th:text="${theme.config.base_set.site_page}"></a>
<a th:unless="${#strings.isEmpty(tag)}"
<a th:if="${_moments.hasNext() and not #strings.isEmpty(tag)}"
th:data="@{${_path}(tag=${tag},page=${_page})}"
th:text="${theme.config.base_set.site_page}"></a>
<form class="page-jump-form" method="get" th:action="@{${_path}}">
<span class="page-jump-label">转到</span>
<input th:if="${not #strings.isEmpty(tag)}" type="hidden" name="tag" th:value="${tag}" />
<span class="page-jump-input-wrap">
<button class="page-jump-step page-jump-step-down" type="button"
title="减少页码" aria-label="减少页码"><i class="ri-subtract-line"
aria-hidden="true"></i></button>
<input class="page-jump-input" type="number" name="page" min="1"
th:max="${_moments.totalPages}" th:value="${_moments.page}"
inputmode="numeric" aria-label="页码" autocomplete="off" required />
<button class="page-jump-step page-jump-step-up" type="button"
title="增加页码" aria-label="增加页码"><i class="ri-add-line"
aria-hidden="true"></i></button>
</span>
<span class="page-jump-total">/ [[${_moments.totalPages}]]</span>
<button class="page-jump-submit" type="submit" title="跳转到指定页"
aria-label="跳转到指定页"><i class="ri-arrow-right-line"></i></button>
</form>
</div>
</div>
</th:block>
+21 -3
View File
@@ -70,14 +70,32 @@
<!-- 分页 -->
<th:block th:if="${photoPage.hasPrevious()} or ${photoPage.hasNext()}">
<div id="p_pagination">
<div class="post-paging" th:if="${photoPage.hasNext()}"
<div class="post-paging"
th:with="_page = ${photoPage.page+1}">
<a th:if="${#strings.isEmpty(tag)}"
<a th:if="${photoPage.hasNext() and #strings.isEmpty(tag)}"
th:data="@{/photos(page=${_page})}"
th:text="${theme.config.base_set.site_page}"></a>
<a th:unless="${#strings.isEmpty(tag)}"
<a th:if="${photoPage.hasNext() and not #strings.isEmpty(tag)}"
th:data="@{/photos(tag=${tag},page=${_page})}"
th:text="${theme.config.base_set.site_page}"></a>
<form class="page-jump-form" method="get" action="/photos">
<span class="page-jump-label">转到</span>
<input th:if="${not #strings.isEmpty(tag)}" type="hidden" name="tag" th:value="${tag}" />
<span class="page-jump-input-wrap">
<button class="page-jump-step page-jump-step-down" type="button"
title="减少页码" aria-label="减少页码"><i class="ri-subtract-line"
aria-hidden="true"></i></button>
<input class="page-jump-input" type="number" name="page" min="1"
th:max="${photoPage.totalPages}" th:value="${photoPage.page}"
inputmode="numeric" aria-label="页码" autocomplete="off" required />
<button class="page-jump-step page-jump-step-up" type="button"
title="增加页码" aria-label="增加页码"><i class="ri-add-line"
aria-hidden="true"></i></button>
</span>
<span class="page-jump-total">/ [[${photoPage.totalPages}]]</span>
<button class="page-jump-submit" type="submit" title="跳转到指定页"
aria-label="跳转到指定页"><i class="ri-arrow-right-line"></i></button>
</form>
</div>
</div>
</th:block>