menuFinde API 适配

This commit is contained in:
liuzhihang 2022-11-12 12:35:29 +08:00
parent 2eae03e5e7
commit 71079c4cde
1 changed files with 12 additions and 13 deletions

View File

@ -2,8 +2,7 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="post-list"
th:with="postItems=${posts.items},
totalPages = ${(posts.total - 1) / posts.size + 1}, pageIndex = ${posts.page}">
th:with="postItems=${posts.items}">
<!-- card需要添加在没有图片时使用随机图片 -->
<div class="recent-post-item"
@ -71,7 +70,7 @@
<nav id="pagination" th:if="${posts.hasPrevious() || posts.hasNext()}">
<!-- 页面小于 7 -->
<div class="pagination" th:if="${(totalPages le 7) && (totalPages gt 0)}">
<div class="pagination" th:if="${(posts.totalPages le 7) && (posts.totalPages gt 0)}">
<!-- 上一页 -->
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
@ -82,7 +81,7 @@
<!-- th:href="${PostFinder.list(index, posts.size)}" -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(1, totalPages)}"
th:each="index : ${#numbers.sequence(1, posts.totalPages)}"
th:text="${index}">
</a>
@ -97,7 +96,7 @@
<!-- 页面大于 7 -->
<!-- https://blog.csdn.net/lizc_lizc/article/details/80215147 -->
<div class="pagination" th:if="${totalPages gt 7}">
<div class="pagination" th:if="${posts.totalPages gt 7}">
<!-- 上一页 -->
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
@ -117,39 +116,39 @@
th:if="${pageIndex le 4}"
th:text="${index}">
</a>
<!-- TODO 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${pageIndex le 4}">...</a>
<!-- 最后一页与当前页面之差小于等于3 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${totalPages - pageIndex le 3}">...</a>
<a class="page-number" th:if="${posts.totalPages - pageIndex le 3}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(totalPages - 4, totalPages - 1)}"
th:if="${totalPages - pageIndex le 3}"
th:each="index : ${#numbers.sequence(posts.totalPages - 4, posts.totalPages - 1)}"
th:if="${posts.totalPages - pageIndex le 3}"
th:text="${index}">
</a>
<!-- 最后一页与当前页面之差大于3 且当前页面大于4 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}">...</a>
<a class="page-number" th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:each="index : ${#numbers.sequence(pageIndex - 1,pageIndex + 1)}"
th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}"
th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}"
th:text="${index}">
</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}">...</a>
<a class="page-number" th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}">...</a>
<!-- 尾页 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:text="${totalPages}">
th:text="${posts.totalPages}">
</a>
<!-- 下一页 -->