<!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小说下载服务，是广大网友最喜欢的温馨小说站。">
    <meta name="keywords" 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="bookStatus" th:value="${bookStatus}"/>
<input type="hidden" id="token" th:value="${token}"/>
<input type="hidden" id="keyword" th:value="${keyword}"/>
<input type="hidden" id="catId" th:value="${catId}"/>
<input type="hidden" id="sortBy" th:value="${sortBy}"/>
<input type="hidden" id="sort" th:value="${sort}"/>

<div style="height: 50px;line-height: 50px;text-align: center" class="layui-header header header-doc  layui-bg-cyan">

    <div style="float: left;margin-left: 10px">
        <a href="javascript:history.go(-1)">
            <i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
    </div>
    <b class="layui-icon" th:text="${titleType}"></b>
    <div style="float: right;margin-right: 10px">
        <a href="/"><i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i></a>
    </div>
</div>

<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/search?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/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/search?curr=" + curr + "&limit=" + limit;
        var ids = $("#ids").val();
        if(ids){
            toUrl += ("&historyBookIds=" + ids);
        }
        var token = $("#token").val();
        if(token){
            toUrl += ("&token=" + token);
        }
        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 catId = $("#catId").val();
        if (catId) {
            toUrl += ("&catId=" + catId);
        }

        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);
    })();


    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>