对博客进行了优化置顶,收藏,热度等操作
This commit is contained in:
@@ -14,43 +14,42 @@
|
||||
<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">
|
||||
Q&A 累计:
|
||||
论坛累计:
|
||||
<span th:text="${pageParam.getTotal()}"></span>
|
||||
<span class="float-right" th:if="${!#strings.isEmpty(thisCategoryName)}">
|
||||
<a th:href="@{/blog}">全部</a>
|
||||
/
|
||||
<span th:text="${thisCategoryName}"></span>
|
||||
</span>
|
||||
</h6>
|
||||
|
||||
<div th:each="blog:${blogList}" class="media text-muted pt-3">
|
||||
<!-- 时间 -->
|
||||
<div th:each="blog:${blogList}" class="media pt-3 border-bottom border-gray">
|
||||
<!-- 头像 -->
|
||||
<img th:src="${blog.getAuthorAvatar()}" style="border-radius: 5px " width="32" height="32">
|
||||
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray" style="margin-left: 5px">
|
||||
<div class="media-body small pl-2">
|
||||
<!-- 标题 -->
|
||||
<a th:text="${blog.getTitle()}"
|
||||
th:href="@{'/blog/read/'+${blog.getBid()}}"
|
||||
class="text-dark font-weight-bold text-decoration-none d-block">
|
||||
<a th:href="@{'/blog/read/'+${blog.getBid()}}"
|
||||
class="text-dark font-weight-bold text-decoration-none">
|
||||
<span th:if="${blog.getSort() == 1}" class="badge badge-danger">置顶</span>
|
||||
[[${blog.getTitle()}]]
|
||||
</a>
|
||||
<!-- 浏览量 -->
|
||||
<span>
|
||||
<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 th:text="${#dates.format(blog.getGmtUpdate(),'yyyy-MM-dd')}"
|
||||
class="badge badge-light float-right">
|
||||
</span>
|
||||
</p>
|
||||
<p class="float-right" th:text="${#dates.format(blog.getGmtUpdate(),'yyyy-MM-dd')}"></p>
|
||||
<div class="small">
|
||||
<!-- 浏览量 -->
|
||||
<span>
|
||||
<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>
|
||||
<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>
|
||||
[[${blog.getStar()}]]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--分页-->
|
||||
<nav aria-label="Page navigation example" class="mt-4">
|
||||
<ul class="pagination justify-content-center pagination-sm">
|
||||
@@ -85,21 +84,32 @@
|
||||
</div>
|
||||
|
||||
<div class="p-4 my-3 bg-white rounded">
|
||||
<p class="mb-0"> 社区公约: <br> 禁止瞎水论坛,内容尽量有实际意义,禁止任何形式的广告,违者暂停账号使用! 申请分类可以在Q群@小狂神 </p>
|
||||
<p 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>
|
||||
敲黑板
|
||||
<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>
|
||||
<br> 如果发的帖子水分过大,可能会被封禁账号,请酌情发帖评论! </p>
|
||||
</div>
|
||||
|
||||
<div class="p-4 my-3 bg-white rounded">
|
||||
<a th:href="@{'/blog/category/'+${category.getId()}+'/1/10'}"
|
||||
th:each="category:${categoryList}" th:text="${category.getCategory()}"
|
||||
class="badge badge-pill badge-primary mr-1"></a>
|
||||
</div>
|
||||
|
||||
<div class="p-4 my-3 bg-white rounded">
|
||||
<h4 class="font-italic">友情链接</h4>
|
||||
<ol class="list-unstyled">
|
||||
<li><a href="https://gitee.com/quinn">Gitee</a></li>
|
||||
<li><a href="https://space.bilibili.com/95256449">Bilibili</a></li>
|
||||
</ol>
|
||||
<h4 class="font-italic pb-3">推荐</h4>
|
||||
<ul class="list-unstyled" th:each="topBlog:${topBlogList}">
|
||||
<li>
|
||||
<a class="text-dark text-decoration-none" th:href="@{'/blog/read/'+${topBlog.getBid()}}">
|
||||
<span class="badge badge-dark">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-balloon-fill" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M8.48 10.901C11.211 10.227 13 7.837 13 5A5 5 0 0 0 3 5c0 2.837 1.789 5.227 4.52 5.901l-.244.487a.25.25 0 1 0 .448.224l.04-.08c.009.17.024.315.051.45.068.344.208.622.448 1.102l.013.028c.212.422.182.85.05 1.246-.135.402-.366.751-.534 1.003a.25.25 0 0 0 .416.278l.004-.007c.166-.248.431-.646.588-1.115.16-.479.212-1.051-.076-1.629-.258-.515-.365-.732-.419-1.004a2.376 2.376 0 0 1-.037-.289l.008.017a.25.25 0 1 0 .448-.224l-.244-.487ZM4.352 3.356a4.004 4.004 0 0 1 3.15-2.325C7.774.997 8 1.224 8 1.5c0 .276-.226.496-.498.542-.95.162-1.749.78-2.173 1.617a.595.595 0 0 1-.52.341c-.346 0-.599-.329-.457-.644Z"/>
|
||||
</svg>
|
||||
[[${topBlog.getViews()}]]</span>
|
||||
[[${topBlog.getTitle()}]]
|
||||
</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</span>
|
||||
<!-- 自己写的文章可以编辑和删除 -->
|
||||
<a th:if="${session.loginUser.getUid()==blog.getAuthorId()}"
|
||||
class="float-right" style="color: red"
|
||||
class="float-right text-decoration-none" style="color: red"
|
||||
th:href="@{'/blog/delete/'+${session.loginUser.getUid()}+'/'+${blog.getBid()}}"
|
||||
onclick="if(!confirm('你确认要删除吗?')) return false;">
|
||||
<svg class="bi bi-x-square" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -50,7 +50,7 @@
|
||||
删除
|
||||
</a>
|
||||
<a th:if="${session.loginUser.getUid()==blog.getAuthorId()}"
|
||||
class="float-right mr-3"
|
||||
class="float-right mr-3 text-decoration-none"
|
||||
th:href="@{'/blog/editor/'+${session.loginUser.getUid()}+'/'+${blog.getBid()}}">
|
||||
<svg class="bi bi-pencil-square" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
|
||||
@@ -58,6 +58,18 @@
|
||||
</svg>
|
||||
编辑
|
||||
</a>
|
||||
<span class="float-right" th:if="${session.loginUser.getUid()!=blog.getAuthorId()}">
|
||||
<a class="text-danger text-decoration-none" th:fragment="star_refresh" th:id="id_star_refresh"
|
||||
href="javascript:starFun(this);">
|
||||
<svg th:if="${starValue.isStar() == true}" xmlns="http://www.w3.org/2000/svg" width="16" height="16" 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>
|
||||
<svg th:if="${starValue.isStar() != true}" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16">
|
||||
<path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"/>
|
||||
</svg>
|
||||
收藏
|
||||
</a>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -76,10 +88,10 @@
|
||||
|
||||
<div class="col-md-12 blog-main" style="margin-top: 20px">
|
||||
<form th:action="@{'/blog/comment/'+${blog.getBid()}}" method="post">
|
||||
<input type="hidden" name="userId" th:value="${session.loginUser.getUid()}">
|
||||
<input type="hidden" id="userId" name="userId" th:value="${session.loginUser.getUid()}">
|
||||
<input type="hidden" name="userName" th:value="${session.loginUser.getUsername()}">
|
||||
<input type="hidden" name="userAvatar" th:value="${session.loginUser.getAvatar()}">
|
||||
<input type="hidden" name="topicId" th:value="${blog.getBid()}">
|
||||
<input type="hidden" id="topicId" name="topicId" th:value="${blog.getBid()}">
|
||||
<div class="form-group">
|
||||
<textarea name="content" class="form-control" rows="3" required></textarea>
|
||||
</div>
|
||||
@@ -130,7 +142,24 @@
|
||||
<script th:src="@{/editormd/lib/flowchart.min.js}"></script>
|
||||
<script th:src="@{/editormd/lib/jquery.flowchart.min.js}"></script>
|
||||
<script th:src="@{/editormd/editormd.js}"></script>
|
||||
<script type="text/javascript">
|
||||
function starFun(btn){
|
||||
btn.disabled = true;
|
||||
var userId = $('#userId').val();
|
||||
var topicId = $('#topicId').val();
|
||||
$.ajax({
|
||||
url: "/blog/star",
|
||||
type: "post",
|
||||
async: false,
|
||||
data: {"userId": userId, "topicId": topicId},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$('#id_star_refresh').html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var testEditor;
|
||||
$(function () {
|
||||
|
||||
Reference in New Issue
Block a user