优化博客

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

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>

View File

@@ -15,7 +15,7 @@
<main role="main">
<div class="container">
<div class="col-md-12 blog-main" style="margin-top: 20px">
<form th:action="@{'/about/'+${session.loginUser.getRoleId()}}" method="post">
<form th:action="@{'/about'}" method="post">
<div class="col-md-12 mb-3">
<label>标题</label>
<input type="text" name="title" class="form-control" value="" required>

View File

@@ -18,7 +18,7 @@
<input type="text" name="username" class="form-control mb-2" placeholder="用户名" required="">
<input type="password" name="password" class="form-control" placeholder="密码" required="">
<input type="password" name="repassword" class="form-control" placeholder="确认密码" required="">
<input type="text" name="code" class="form-control" placeholder="社区邀请码" required="">
<input type="text" name="code" class="form-control" placeholder="邀请码" required="">
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" onclick="this.disabled=true; this.form.submit();">注 册</button>

View File

@@ -5,87 +5,121 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>资源库-Quinn</title>
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
<link rel="stylesheet" th:href="@{/css/download.css}">
<style>
#maxLength {
max-width: 500px;
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 超出部分不显示 */
text-overflow: ellipsis; /* 超出部分显示为... */
}
</style>
</head>
<body>
<div th:replace="~{common/header::header(activeUrl='source')}"></div>
<main role="main" class="mt-3">
<div class="container">
<form action="javascript:navChange(0);" method="post">
<div class="form-row align-items-center">
<div class="col-auto">
<label class="sr-only" for="name">KEYWORD</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">关键字</div>
<main role="main" class="container">
<div class="row">
<div class="col-md-9 blog-main">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0">
累计资源总量:
<span th:text="${pageParam.getAllTotal()}"></span>
</h6>
<div th:fragment="s_table_refresh" th:id="id_s_table_refresh">
<div th:each="source:${sourceList}" class="media pt-3 border-bottom border-gray">
<div class="media-body small pl-2">
<!-- 标题 -->
<a th:href="@{'/source/view/'+${source.getSid()}}"
class="text-dark font-weight-bold text-decoration-none">
<span th:if="${source.getDownRecord() > 20}" class="badge badge-danger"></span>
[[${source.getSourceName()}]]
</a>
<!-- 收藏 -->
<span class="badge badge-dark">
[[${source.getCategoryName()}]]
(
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
</svg>
[[${source.getStar()}]]
)
</span>
<p class="float-right" th:text="${#dates.format(source.getGmtUpdate(),'yyyy-MM-dd HH:mm:ss')}"></p>
<div class="small">
<span id="maxLength" th:text="${source.getDetail()}"
class="d-block">
</span>
</div>
</div>
<input type="text" class="form-control" id="name" name="name" placeholder="请输入关键字"/>
</div>
</div>
<div class="col-auto">
<label class="sr-only" for="category">SOURCE-TYPE</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">类别</div>
</div>
<select id="category" name="category" class="form-control custom-select">
<option th:value=-1 th:text="请选择"></option>
<option th:each="category:${categoryList}" th:value="${category.getId()}" th:text="${category.getCategory()}"></option>
</select>
</div>
</div>
<div class="col-auto ml-auto">
<button type="submit" class="btn btn-primary mb-2">查询</button>
<!--分页-->
<nav aria-label="Page navigation example" class="mt-4">
<ul class="pagination justify-content-center pagination-sm">
<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="${pageParam.hasPrevious()}">
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
</li>
<li class="page-item active">
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
</li>
<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="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
<a class="page-link" href="javascript:navChange(1);">Next</a>
</li>
</ul>
</nav>
</div>
</div>
</form>
</div>
<div class="container" th:fragment="s_table_refresh" th:id="id_s_table_refresh">
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">资源名</th>
<th scope="col">资源简介</th>
<th scope="col">资源类型</th>
<th scope="col">热度</th>
<th scope="col">去下载</th>
</tr>
</thead>
<tbody>
<tr th:each="source:${sourceList}">
<td th:text="${source.getSourceName()}"></td>
<td th:text="${source.getDetail()}"></td>
<td th:text="${source.getCategoryName()}"></td>
<td th:text="${source.getDownRecord()}"></td>
<td th:name="${source.getSid()}">
<a style="color: white" th:href="@{'/source/view/'+${source.getSid()}}" class="btn btn-sm btn-secondary">详情</a>
</td>
</tr>
</tbody>
</table>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<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="${pageParam.hasPrevious()}">
<a class="page-link" href="javascript:navChange(-1);" th:text="${pageParam.getCurrent()-1}"></a>
</li>
<li class="page-item active">
<a id = "current" class="page-link" href="javascript:navChange(0);" th:text="${pageParam.getCurrent()}"></a>
</li>
<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="${pageParam.hasNext()==true?'page-item':'page-item disabled'}">
<a class="page-link" href="javascript:navChange(1);">Next</a>
</li>
</ul>
</nav>
</div>
<aside class="col-md-3 blog-sidebar">
<div class="p-1 my-2 bg-white rounded">
<strong class="mb-0">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bookmarks-fill" viewBox="0 0 16 16">
<path d="M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L7 13.101l-4.223 2.815A.5.5 0 0 1 2 15.5V4z"/>
<path d="M4.268 1A2 2 0 0 1 6 0h6a2 2 0 0 1 2 2v11.5a.5.5 0 0 1-.777.416L13 13.768V2a1 1 0 0 0-1-1H4.268z"/>
</svg>
敲黑板
</strong>
<br/>
<span>如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论!</span>
</div>
<div class="p-1 my-2 bg-white rounded">
<form action="javascript:navChange(0);" method="post">
<div class="form-row align-items-center">
<div class="col-md-12 form-control-sm">
<label class="sr-only" for="name">KEYWORD</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">名称</div>
</div>
<input type="text" class="form-control" id="name" name="name" placeholder="请输入关键字"/>
</div>
</div>
<div class="col-md-12 mt-3 form-control-sm">
<label class="sr-only" for="category">SOURCE-TYPE</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">类别</div>
</div>
<select id="category" name="category" class="form-control custom-select">
<option th:value=-1 th:text="请选择"></option>
<option th:each="category:${categoryList}" th:value="${category.getId()}" th:text="${category.getCategory()}"></option>
</select>
</div>
</div>
<div class="col-md-12 mt-3 form-control-sm">
<button type="submit" class="btn btn-primary btn-block">查询</button>
</div>
</div>
</form>
</div>
</aside>
</div>
</main>
@@ -104,7 +138,8 @@
var current = $('#current').text();
var pageNum = parseInt(current) + page;
$.ajax({
url: "/source/page",
url: "/source",
async: false,
type: "post",
data: {"name": name, "category": category, "pageNum": pageNum, "limit": 10},
success: function (data) {

View File

@@ -62,14 +62,12 @@
class="text-dark font-weight-bold text-decoration-none d-block">
</a>
<!-- 浏览量 -->
<span style="color: red">
<span class="badge badge-success">
<svg class="bi bi-eye-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
</svg>
[[${blog.getViews()}]]
</span>
<span style="color: red">
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" class="bi bi-heart-fill" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
</svg>
@@ -139,9 +137,9 @@
<span th:text="${session.loginUser.getUsername()}"></span>
<br>
<small>
<!--<span class="badge badge-primary">普通用户</span>-->
<span th:class="${session.loginUser.getRoleId()==2?'badge badge-warning':'badge badge-success'}"
th:text="${session.loginUser.getRoleId()==2?'Vip会员':'管理员'}">
<span th:if="${session.loginUser.getRoleId()=='ADMIN'}" class="badge badge-primary">超级管理员</span>
<span th:if="${session.loginUser.getRoleId()!='ADMIN'}" th:class="${session.loginUser.getRoleId()=='VIP'?'badge badge-warning':'badge badge-success'}"
th:text="${session.loginUser.getRoleId()=='VIP'?'VIP会员':'普通用户'}">
</span>
</small>
<p>