This commit is contained in:
limqhz
2022-05-14 01:14:16 +08:00
parent a3df75bd66
commit 9e1dd3af77
31 changed files with 625 additions and 2240 deletions

View File

@@ -38,7 +38,7 @@
[[${blog.getViews()}]]
</span>
<!-- 自己写的文章可以编辑和删除 -->
<a th:if="${session.loginUser.getUid()==blog.getAuthorId()}"
<a th:if="@{${session.loginUser} ? ${session.loginUser.getUid()==blog.getAuthorId()} : false}"
class="float-right text-decoration-none" style="color: red"
th:href="@{'/blog/delete/'+${blog.getBid()}}"
onclick="if(!confirm('你确认要删除吗?')) return false;">
@@ -49,7 +49,7 @@
</svg>
删除
</a>
<a th:if="${session.loginUser.getUid()==blog.getAuthorId()}"
<a th:if="@{${session.loginUser} ? ${session.loginUser.getUid()==blog.getAuthorId()} : false}"
class="float-right mr-3 text-decoration-none"
th:href="@{'/blog/editor/'+${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">
@@ -58,7 +58,7 @@
</svg>
编辑
</a>
<span class="float-right" th:if="${session.loginUser.getUid()!=blog.getAuthorId()}">
<span class="float-right" th:if="@{${session.loginUser} ? ${session.loginUser.getUid()!=blog.getAuthorId()} : false}">
<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">
@@ -76,7 +76,7 @@
<hr style="margin-top: 18px">
<!--文章主体内容-->
<div id="editor-text-area" style="height: 400px"></div>
<div id="editor-text-area" style="height: 600px"></div>
<textarea id="content-textarea" th:text="${blog.getContent()}" name="content" style="display: none;"></textarea>
</div>
@@ -87,14 +87,13 @@
<div class="col-md-12 blog-main" style="margin-top: 20px">
<form th:action="@{'/blog/comment/'+${blog.getBid()}}" method="post">
<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" id="userId" name="userId" th:value="@{${session.loginUser} ? ${session.loginUser.getUid()} : ''}">
<input type="hidden" name="userName" th:value="@{${session.loginUser} ? ${session.loginUser.getUsername()} : ''}">
<input type="hidden" id="topicId" name="topicId" th:value="${blog.getBid()}">
<div class="form-group">
<input name="content" class="form-control" rows="3" required />
<input id="commentTo" name="content" class="form-control" rows="3" required/>
</div>
<button type="submit" onclick="this.disabled=true; this.form.submit();" class="btn btn-primary float-right">提交评论</button>
<button type="submit" onclick="comment()" class="btn btn-primary float-right">提交评论</button>
</form>
</div>
@@ -132,6 +131,7 @@
<script th:src="@{/live/js/addlive2d.js}"></script>
<script th:src="@{/wangedit/js/wang.min.js}"></script>
<script th:src="@{/wangedit/js/wang.read.js}"></script>
<script th:src="@{/layer/mobile/layer.js}"></script>
<script type="text/javascript">
function starFun(btn){
btn.disabled = true;
@@ -147,6 +147,15 @@
}
});
}
function comment(){
var content = $('#commentTo').val();
console.log(content);
if (!content){
layer.open({ content: '评论内容不能为空', skin: 'msg', time: 2 });
return;
}
this.submit();
}
</script>
</body>
</html>