优化博客

This commit is contained in:
limqhz
2022-05-10 02:21:30 +08:00
parent 1826e4bb9a
commit b0b9e80f8a
28 changed files with 339 additions and 227 deletions

View File

@@ -15,11 +15,11 @@
<div class="row">
<div class="col-md-9 blog-main">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<div th:fragment="s_table_refresh" th:id="id_s_table_refresh">
<h6 class="border-bottom border-gray pb-2 mb-0">
论坛累计:
<span th:text="${myPageParam.getTotal()}"></span>
<span th:text="${pageParam.getTotal()}"></span>
</h6>
<!-- 时间 -->
<div th:each="blog:${blogList}" class="media pt-3 border-bottom border-gray">
<!-- 头像 -->
<img th:src="${blog.getAvatar()}" style="border-radius: 5px " width="32" height="32">
@@ -60,24 +60,24 @@
<!--分页-->
<nav aria-label="Page navigation example" class="mt-4">
<ul class="pagination justify-content-center pagination-sm">
<li th:class="${myPageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()-1}+'/10'}" tabindex="">Previous</a>
<li th:class="${pageParam.hasPrevious()==true?'page-item':'page-item disabled'}">
<a class="page-link" href="javascript:navChange(-1);" tabindex="">Previous</a>
</li>
<li class="page-item" th:if="${myPageParam.hasPrevious()}">
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()-1}+'/10'}" th:text="${myPageParam.getCurrent()-1}"></a>
<li class="page-item" th:if="${pageParam.hasPrevious()}">
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
</li>
<li class="page-item active">
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()}+'/10'}" th:text="${myPageParam.getCurrent()}"></a>
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
</li>
<li class="page-item" th:if="${myPageParam.hasNext()}">
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()+1}+'/10'}" th:text="${myPageParam.getCurrent()+1}"></a>
<li class="page-item" th:if="${pageParam.hasNext()}">
<a class="page-link" href="javascript:navChange(1);" th:text="${pageParam.getCurrent()+1}"></a>
</li>
<li th:class="${myPageParam.hasNext()==true?'page-item':'page-item disabled'}">
<a class="page-link" th:href="@{'/blog/'+${myPageParam.getCurrent()+1}+'/10'}" >Next</a>
<li th:class="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
<a class="page-link" href="javascript:navChange(1);">Next</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
@@ -101,7 +101,6 @@
<br/>
<span>如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论!</span>
</div>
<div class="p-4 my-3 bg-white rounded">
<h4 class="pb-1">推荐</h4>
<ul class="list-unstyled small" th:each="topBlog:${topBlogList}">
@@ -131,10 +130,20 @@
<script th:src="@{/js/toTop.js}"></script>
<script th:src="@{/js/jquery-ui.min.js}"></script>
<script th:src="@{/live/js/addlive2d.js}"></script>
<script>
<script type="text/javascript">
function navChange(page){
var current = $('#current').text();
var pageNum = parseInt(current) + page;
$.ajax({
url: "/blog",
async: false,
type: "post",
data: {"pageNum": pageNum, "limit": 10},
success: function (data) {
$('#id_s_table_refresh').html(data);
}
});
}
</script>
</body>
</html>