漫画专区上线

This commit is contained in:
xiongxiaoyang 2019-11-17 13:31:10 +08:00
parent d8bddd9161
commit 63e18b4c25
6 changed files with 358 additions and 7 deletions

View File

@ -211,6 +211,10 @@ public class BookService {
catName = "轻小说"; catName = "轻小说";
break; break;
} }
case 9: {
catName = "漫画";
break;
}
default: { default: {
break; break;
} }
@ -458,6 +462,28 @@ public class BookService {
} }
public String getMhCatNameById(Integer softCat) {
String catName = "其他";
switch (softCat) {
case 3262: {
catName = "少年漫";
break;
}
case 3263: {
catName = "少女漫";
break;
}
default: {
break;
}
}
return catName;
}
public void sendBullet(Long contentId, String bullet) { public void sendBullet(Long contentId, String bullet) {
ScreenBullet screenBullet = new ScreenBullet(); ScreenBullet screenBullet = new ScreenBullet();

View File

@ -150,6 +150,41 @@ public class BookController {
return "books/soft_book_search"; return "books/soft_book_search";
} }
@RequestMapping("searchMhBook.html")
public String searchMhBook(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", defaultValue = "9") Integer catId,
@RequestParam(value = "softCat", required = false) Integer softCat,
@RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "softTag", required = false) String softTag,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) {
String userId = null;
List<Book> books = bookService.search(page, pageSize, userId, null, keyword, bookStatus, catId, softCat, softTag, sortBy, sort);
List<BookVO> bookVOList;
bookVOList = new ArrayList<>();
for (Book book : books) {
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getMhCatNameById(bookvo.getSoftCat()));
bookVOList.add(bookvo);
}
PageInfo<Book> bookPageInfo = new PageInfo<>(books);
modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList);
modelMap.put("keyword", keyword);
modelMap.put("bookStatus", bookStatus);
modelMap.put("softCat", softCat);
modelMap.put("softTag", softTag);
modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort);
return "books/mh_book_search";
}
@RequestMapping("{bookId}.html") @RequestMapping("{bookId}.html")
public String detail(@PathVariable("bookId") Long bookId, ModelMap modelMap) { public String detail(@PathVariable("bookId") Long bookId, ModelMap modelMap) {
//查询基本信息 //查询基本信息

View File

@ -3,12 +3,12 @@ server:
spring: spring:
datasource: datasource:
url: jdbc:mysql://148.70.59.92:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai # url: jdbc:mysql://148.70.59.92:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: xiongxiaoyang # username: xiongxiaoyang
password: Lzslov123! # password: Lzslov123!
# url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8 url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: books username: root
# password: books password: test123456
cache: cache:
ehcache: ehcache:
config: classpath:ehcache.xml config: classpath:ehcache.xml

View File

@ -320,7 +320,7 @@
</when> </when>
<otherwise><!-- 我的书架和我的阅读记录查询所有记录,不分版块--> <otherwise><!-- 我的书架和我的阅读记录查询所有记录,不分版块-->
<if test="(ids == null or ids == ''.toString()) and (userId == null or userId == ''.toString())"> <if test="(ids == null or ids == ''.toString()) and (userId == null or userId == ''.toString())">
AND book.catId <![CDATA[ <> ]]> 8 AND book.catId <![CDATA[ < ]]> 8
</if> </if>
</otherwise> </otherwise>
</choose> </choose>

View File

@ -0,0 +1,289 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>精品小说楼_漫画专区</title>
<meta name="description"
content="精品小说楼是国内优秀的小说弹幕网站,精品小说楼提供海量网络小说,日本轻小说,国产轻小说,动漫小说,轻小说TXT下载,轻小说在线阅读和TXT小说下载,是网友最喜欢的温馨小说站。">
<meta name="keywords" content="精品小说楼,精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说">
<meta property="og:type" content="soft_novel_index"/>
<meta property="og:title" content="精品小说楼_轻小说专区"/>
<meta property="og:description" content="精品小说楼是国内优秀的小说弹幕网站,精品小说楼提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。"/>
<div th:include="common/css :: css"></div>
</div>
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?2cf01edbc2b27cd3a143e17948167d77";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<style type="text/css">
.line-limit-length {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.indexP p a {
color: #4c6978;
}
.Readarea {
font-size: 18px;
line-height: 35px;
padding: 10px;
color: #333;
}
div, p {
wrap-work: break-word;
word-break: break-all;
word-wrap: break-word;
word-break: normal;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-ms-box-sizing: border-box;
}
.indexDiv a {
margin-left: 20px;
}
img {
width: 147px;
height: 197px;
}
</style>
</head>
<body>
<input type="hidden" id="limit" th:value="${limit}"/>
<input type="hidden" id="curr" th:value="${curr}"/>
<input type="hidden" id="total" th:value="${total}"/>
<input type="hidden" id="ids" th:value="${ids}"/>
<input type="hidden" id="keyword" th:value="${keyword}"/>
<input type="hidden" id="softTag" th:value="${softTag}"/>
<input type="hidden" id="sortBy" th:value="${sortBy}"/>
<input type="hidden" id="sort" th:value="${sort}"/>
<input type="hidden" id="bookStatus" th:value="${bookStatus}"/>
<input type="hidden" id="softCat" th:value="${softCat}"/>
<ul class="layui-nav" lay-filter="" style="padding:0 20px;text-align: center" >
<li id="menunew" class="layui-nav-item"><a href="/book/searchMhBook.html">最新</a></li>
<li id="menu21" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3262">少年漫</a></li>
<li id="menu22" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3263">少女漫</a></li>
<li id="menucomplete" class="layui-nav-item"><a >完本</a>
<dl class="layui-nav-child"> <!-- 二级菜单 -->
<dd><a href="/book/searchMhBook.html?bookStatus=已完成">全部</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3262">少年漫</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3263">少女漫</a></dd>
</dl>
</li>
<li id="menuhot" class="layui-nav-item"><a >排行</a>
<dl class="layui-nav-child"> <!-- 二级菜单 -->
<dd><a href="/book/searchMhBook.html?sortBy=score">全部</a></dd>
<dd><a href="/book/searchMhBook.html?sortBy=score&softCat=3262">少年漫</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3263">少女漫</a></dd>
</dl>
</li>
</ul>
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-xs10 layui-col-sm10 layui-col-md11 layui-col-lg11" style="padding-top:1%">
<input id="title" type="text" name="title" required lay-verify="required" placeholder="请输入书名·作者"
autocomplete="off"
class="layui-input" th:value="${keyword}">
</div>
<div class="layui-col-xs1" style="padding: 1%">
<button onclick="searchBooks()" class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
</div>
</div>
</div>
<div th:each="book : ${books}" class="layui-row" style="margin-bottom:10px;padding:10px;background: #f2f2f2">
<a th:href="'/book/'+ ${book.id} + '.html'">
<div class="layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2" style="text-align: center">
<img align="center"
th:src="${book.picUrl}"/>
</div>
</a>
<div style="padding: 20px" class="layui-col-xs6 layui-col-sm8 layui-col-md8 layui-col-lg8">
<a th:href="'/book/'+ ${book.id} + '.html'">
<div class="line-limit-length" style=";color: #4c6978;font-weight: bold;font-size: 15px"
th:text="${book.bookName}"></div>
</a>
<div style=";color: #4c6978;float: right;"><i style="color: red" th:text="${book.score} + '分'"></i></div>
<a th:href="'/book/searchMhBook.html?keyword='+ ${book.author}">
<div style=";color: #4c6978;" class="line-limit-length" th:text="'作者'+ ${book.author}"></div>
</a>
<div style="margin-top: 5px;color: #4c6978;" th:text="'类别:'+ ${book.cateName}"></div>
<div style="margin-top: 5px;color: #4c6978;" th:text="'状态:'+ ${book.bookStatus}"></div>
<div style="margin-top: 5px;color: #4c6978;">更新<i th:text="${#dates.format(book.updateTime, 'yy-MM-dd')}"></i>
</div>
<div class="layui-collapse" style="margin-top: 5px;">
<div class="layui-colla-item">
<h2 style="color: #4c6978;" class="layui-colla-title">简介:</h2>
<div style="color: #4c6978;" class="layui-colla-content" th:utext="${book.bookDesc}">
</div>
</div>
</div>
</div>
</div>
<div id="books" style="text-align: center"></div>
<div th:replace="common/soft_footer :: footer">
</div>
<a name="buttom"></a>
</body>
<div th:replace="common/js :: js"></div>
<script>
layui.use('laypage', function () {
var laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'books' //注意这里的 test1 ID不用加 #
, count: $("#total").val() //数据总数从服务端得到,
, curr: $("#curr").val()
, limit: $("#limit").val()
, jump: function (obj, first) {
//obj包含了当前分页的所有参数比如
console.log(obj.curr); //得到当前页以便向服务端请求对应页的数据
console.log(obj.limit); //得到每页显示的条数
//首次不执行
if (!first) {
searchByAllCondition(obj.curr,obj.limit);
} else {
}
}
});
});
function searchByAllCondition(curr,limit,newKeyword){
var toUrl = "/book/searchMhBook.html?curr=" + curr + "&limit=" + limit;
var ids = $("#ids").val();
if(ids){
toUrl += ("&historyBookIds=" + ids);
}
var keyword = $("#keyword").val();
if(newKeyword){
toUrl += encodeURI("&keyword=" + newKeyword);
}else if (keyword) {
toUrl += encodeURI("&keyword=" + keyword);
}
var bookStatus = $("#bookStatus").val();
if(bookStatus){
toUrl += ("&bookStatus=" + bookStatus);
}
var softCat = $("#softCat").val();
if (softCat) {
toUrl += ("&softCat=" + softCat);
}
var softTag = $("#softTag").val();
if (softTag) {
toUrl += ("&softTag=" + softTag);
}
var sortBy = $("#sortBy").val();
if (sortBy) {
toUrl += ("&sortBy=" + sortBy);
}
var sort = $("#sort").val();
if (sort) {
toUrl += ("&sort=" + sort);
}
window.location.href = toUrl;
}
function searchBooks() {
var keywords = $("#title").val();
$("#keyword").val("");
searchByAllCondition(1,20,keywords);
}
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
var sortCat = $("#softCat").val();
var sortBy = $("#sortBy").val();
if(sortBy == 'score'){
$("#menuhot").addClass("layui-this");
}else if($("#bookStatus").val()){
$("#menucomplete").addClass("layui-this");
}else if(sortCat){
$("#menu"+sortCat).addClass("layui-this");
}else{
$("#menunew").addClass("layui-this");
}
})();
function toMyCollect(){
var token = localStorage.getItem("token");
if(token) {
window.location.href = "/book/search?token=" + token;
}else{
window.location.href = "/user/login.html";
}
}
</script>
</html>

View File

@ -1,5 +1,6 @@
<div th:fragment="footer" style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan"> <div th:fragment="footer" style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan">
<a href="/book/searchSoftBook.html" style="font-size: 14px;color: #92B8B1;">轻小说</a> <a href="/book/searchSoftBook.html" style="font-size: 14px;color: #92B8B1;">轻小说</a>
<a href="/book/searchMhBook.html" style="font-size: 14px;color: #92B8B1;">漫画</a>
<a href="javascript:readHistory()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">阅读记录</a> <a href="javascript:readHistory()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">阅读记录</a>
<a href="javascript:toMyCollect()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">书架</a> <a href="javascript:toMyCollect()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">书架</a>
<a href="/HotBook.apk" style="font-size: 14px;color: #92B8B1;margin-left: 8px">客户端</a> <a href="/HotBook.apk" style="font-size: 14px;color: #92B8B1;margin-left: 8px">客户端</a>