模版更新

This commit is contained in:
xiaoyang
2021-05-28 20:08:45 +08:00
parent 928cb2417f
commit 8e6842a495
48 changed files with 196 additions and 3346 deletions

View File

@ -86,20 +86,21 @@
<div class="bookComment">
<div class="book_tit">
<div class="fl">
<h3>作品评论区</h3><span id="bookCommentTotal">(0条)</span>
<h3>作品评论区</h3><span id="bookCommentTotal" th:text="'('+${bookCommentPageBean.total}+')'"></span>
</div>
<a class="fr" href="#txtComment">发表评论</a>
</div>
<div class="no_comment" id="noCommentPanel" style="display: none;">
<div class="no_comment" id="noCommentPanel" th:style="${bookCommentPageBean.total > 0}? 'display:none'" >
<img src="/images/no_comment.png" alt=""/>
<span class="block">暂无评论</span>
</div>
<div class="commentBar" id="commentPanel">
<div class="commentBar" id="commentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
<div th:each="comment: ${bookCommentPageBean.list}" class="comment_list cf"><div class="user_heads fl" vals="389"><img th:src="${comment.createUserPhoto}?${comment.createUserPhoto}:'/images/man.png'" class="user_head" alt=""><span class="user_level1" style="display: none;">见习</span></div><ul class="pl_bar fr"> <li class="name" th:text="${#strings.substring(comment.createUserName,0,4)}+'****'+${#strings.substring(comment.createUserName,#strings.length(comment.createUserName)-3,#strings.length(comment.createUserName))}"></li><li class="dec" th:text="${comment.commentContent}"></li><li class="other cf"><span class="time fl" th:text="${#calendars.format(comment.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span><span class="fr"><a href="javascript:void(0);" onclick="javascript:BookDetail.AddAgreeTotal(77,this);" class="zan" style="display: none;">赞<i class="num">(0)</i></a></span></li> </ul> </div>
</div>
<!--无评论时此处隐藏-->
<div class="more_bar" id="moreCommentPanel">
<div class="more_bar" id="moreCommentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
<a th:href="'/book/comment-'+${book.id}+'.html'">查看全部评论&gt;</a>
</div>
@ -171,7 +172,19 @@
</div>
<div class="tj_bar">
<ul id="recBookList">
<li th:each="book : ${recBooks}">
<div class="book_intro">
<div class="cover">
<a th:href="'/book/'+${book.id}+'.html'"><img th:src="${book.picUrl}" th:alt="${book.bookName}"></a>
</div>
<div class="dec">
<a class="book_name" th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}"></a>
<a class="txt" th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookDesc}">
</a>
</div>
</div>
</li>
</ul>
</div>
@ -250,56 +263,7 @@
}
})
//加载评价列表
loadCommentList();
function loadCommentList(){
$.ajax({
type: "get",
url: "/book/listCommentByPage",
data: {'bookId': $("#bookId").val()},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var commentList = data.data.list;
if (commentList.length > 0) {
$("#bookCommentTotal").html("("+data.data.total+"条)");
var commentListHtml = "";
for (var i = 0; i < commentList.length; i++) {
var comment = commentList[i];
commentListHtml += ("<div class=\"comment_list cf\">" +
"<div class=\"user_heads fl\" vals=\"389\">" +
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName.substr(0, 4) + "****" + comment.createUserName.substr(comment.createUserName.length - 3, 3))+"</li><li class=\"dec\">" +
comment.commentContent+
"</li><li class=\"other cf\">" +
"<span class=\"time fl\">"+comment.createTime+"</span>" +
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
"</span></li>\t\t</ul>\t</div>");
}
$("#commentPanel").html(commentListHtml);
$("#noCommentPanel").hide();
$("#commentPanel").show();
$("#moreCommentPanel").show();
} else {
$("#commentPanel").hide();
$("#moreCommentPanel").hide();
$("#noCommentPanel").show();
}
} else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
}
@ -332,49 +296,58 @@
});
var bookCatId = $("#bookCatId").val();
//查询同类推荐
$.ajax({
type: "get",
url: "/book/listRecBookByCatId",
data: {'catId': bookCatId},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var recBookList = data.data;
var recBookListHtml = "";
for (var i = 0; i < recBookList.length; i++) {
var recBook = recBookList[i];
recBookListHtml += ("<li>\n" +
" <div class=\"book_intro\">\n" +
" <div class=\"cover\">\n" +
" <a href=\"/book/" + recBook.id + ".html\" ><img src=\"" + recBook.picUrl + "\" alt=\"" + recBook.bookName + "\" /></a>\n" +
" </div>\n" +
" <div class=\"dec\">\n" +
" <a class=\"book_name\" href=\"/book/" + recBook.id + ".html\" >" + recBook.bookName + "</a>\n" +
" <a class=\"txt\" href=\"/book/" + recBook.id + ".html\" >\n" + recBook.bookDesc +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </li>");
}
$("#recBookList").html(recBookListHtml);
} else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
$.post("/book/addVisitCount", {"bookId": bookId}, function () {
});
function loadCommentList(){
$.ajax({
type: "get",
url: "/book/listCommentByPage",
data: {'bookId': $("#bookId").val()},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var commentList = data.data.list;
if (commentList.length > 0) {
$("#bookCommentTotal").html("("+data.data.total+"条)");
var commentListHtml = "";
for (var i = 0; i < commentList.length; i++) {
var comment = commentList[i];
commentListHtml += ("<div class=\"comment_list cf\">" +
"<div class=\"user_heads fl\" vals=\"389\">" +
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName)+"</li><li class=\"dec\">" +
comment.commentContent+
"</li><li class=\"other cf\">" +
"<span class=\"time fl\">"+comment.createTime+"</span>" +
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
"</span></li>\t\t</ul>\t</div>");
}
$("#commentPanel").html(commentListHtml);
$("#noCommentPanel").hide();
$("#commentPanel").show();
$("#moreCommentPanel").show();
} else {
$("#commentPanel").hide();
$("#moreCommentPanel").hide();
$("#noCommentPanel").show();
}
} else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
}
</script>
</body>
</html>