<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">


    <title th:text="${application.website.name}"></title>

    <meta name="keywords" th:content="${application.website.keyword}"/>
    <meta name="description"
          th:content="${application.website.description}"/>


    <div th:include="/common/css :: css"></div>

    <style>

        .line-limit-length {

            overflow: hidden;

            text-overflow: ellipsis;

            white-space: nowrap;

        }

        .layui-nav .layui-nav-item {
            position: relative;
            display: inline-block;
            vertical-align: middle;
            line-height: 50px;
        }

        body ul.layui-nav li.layui-nav-item a {
            display: block;
            transition: all .3s;
            -webkit-transition: all .3s;
        }

    </style>


</head>
<body>


<!-- 你的HTML代码 -->
<a name="top"></a>
<ul  class="layui-nav app" lay-filter="" style="display:none;padding:0 10px;text-align: center">
    <li class="layui-nav-item"><a>分类</a>
        <dl class="layui-nav-child">
            <dd><a href="/book/book_ranking.html?catId=1&sort=last_index_update_time">玄幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=2&sort=last_index_update_time">修真小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=3&sort=last_index_update_time">都市小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=4&sort=last_index_update_time">历史小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=6&sort=last_index_update_time">网游小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=5&sort=last_index_update_time">科幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?catId=7&sort=last_index_update_time">女频小说</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a>全本</a>
        <dl class="layui-nav-child">
            <dd><a href="/book/book_ranking.html?bookStatus=1">全部小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=1">玄幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=2">修真小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=3">都市小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=4">历史小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=6">网游小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=5">科幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=7">女频小说</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a>排行</a>
        <dl class="layui-nav-child">
            <dd><a href="/book/book_ranking.html?sortBy=visit_count">全部小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=1">玄幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=2">修真小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=3">都市小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=4">历史小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=6">网游小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=5">科幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=7">女频小说</a></dd>
        </dl>
    </li>

</ul>
<ul class="layui-nav pc" lay-filter="" style="padding:0 36px;text-align: center">
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=1&sort=last_index_update_time">玄幻小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=2&sort=last_index_update_time">修真小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=3&sort=last_index_update_time">都市小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=4&sort=last_index_update_time">历史小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=6&sort=last_index_update_time">网游小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=5&sort=last_index_update_time">科幻小说</a></li>
    <li class="layui-nav-item"><a href="/book/book_ranking.html?catId=7&sort=last_index_update_time">女频小说</a></li>
    <li class="layui-nav-item"><a>完本小说</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd><a href="/book/book_ranking.html?bookStatus=1">全部小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=1">玄幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=2">修真小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=3">都市小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=4">历史小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=6">网游小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=5">科幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?bookStatus=1&catId=7">女频小说</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a>小说排行</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd><a href="/book/book_ranking.html?sortBy=visit_count">全部小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=1">玄幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=2">修真小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=3">都市小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=4">历史小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=6">网游小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=5">科幻小说</a></dd>
            <dd><a href="/book/book_ranking.html?sortBy=visit_count&catId=7">女频小说</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">
        </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 style="height: 1px" class="layui-col-lg1"></div>
<div class="layui-collapse layui-col-lg10">
    <div class="layui-colla-item">
        <h2 class="layui-colla-title">本站推荐</h2>
        <div class="layui-colla-content layui-show">


            <div class="layui-container" style="padding: 0px">

                <div class="layui-row" style="text-align: center" id="currentWeek">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-colla-item">
        <h2 class="layui-colla-title">热门小说推荐</h2>
        <div class="layui-colla-content layui-show">

            <div class="layui-container">
                <div class="layui-row" id="hotRecBooks">


                    <!--<div th:each="hotBook : ${hotBooks}" style="margin-top: 1%"
                     class="layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6">
                    <a th:href="'/book/'+${hotBook.id}+'.html'">
                        <div class="layui-col-xs5 layui-col-sm3 layui-col-md3 layui-col-lg3">
                            <img style=" width:100px; height:125px;"
                                 th:src="${hotBook.picUrl}"/>
                        </div>

                        <div class="layui-col-xs7 layui-col-sm6 layui-col-md7 layui-col-lg7"
                             style="float: left;padding-right: 10px">
                            <div><b th:text="${hotBook.bookName}"></b></div>
                            <div class="layui-col-xs8 layui-col-sm9 layui-col-md10 layui-col-lg10"
                                 th:text="'作者：'+ ${hotBook.author}"></div>
                            <div class="layui-col-xs3 layui-col-sm2 layui-col-md1 layui-col-lg1" style="text-align: right;">
                            <b><i style="color: red"
                                  th:text="${hotBook.score} + '分'"></i></b></div>
                           </div>
                            <div class="layui-elip layui-col-xs12 layui-col-sm9 layui-col-md10 layui-col-lg10 layui-col-sm9 layui-col-md10 layui-col-lg10"
                                 th:text="${hotBook.bookDesc}">
                            </div>



                    </a>
                </div>-->
                </div>
            </div>

        </div>

    </div>
</div>
</div>
<div style="clear: both"></div>
<div style="height: 1px" class="layui-col-lg1"></div>
<div class="layui-colla-item layui-col-lg10"
     style="border-width: 1px;border-style: solid;border-radius: 2px;border-top-width: 0px"><a
        href="javascript:moreNewBooks()">
    <h2 class="layui-colla-title">最近更新小说
        <div style="float: right; margin-right: 20px"><i style="font-size: 14px;"
                                                         class="layui-icon">更多&#xe65b;</i>
        </div>
    </h2>
</a>
    <div class="layui-colla-content layui-show">

        <div class="layui-container" style="padding-left: 2px;padding-right: 5px">
            <div class="layui-row" id="updateRankBooks">



            </div>
        </div>

    </div>
</div>
</div>

<div style="clear: both"></div>
<div th:replace="/common/footer :: footer">
</div>
<div th:replace="/common/js :: js">
</div>

<script src="/js/wap_collect.js"></script>


<script>
    //加载首页书籍设置数据
    $.ajax({
        type: "GET",
        url: "/book/listBookSetting",
        data: {},
        dataType: "json",
        success: function (data) {
            if (data.code == 200) {

                //本周强推
                var rightListBooks = data.data[2];
                var rightListBooksHtml = "";
                for (var i = 0; i < 3; i++) {
                    var rightListBook = rightListBooks[i];
                    var classHtml = "";
                    if (i == 0) {
                        classHtml = "on";
                    }
                    if (i < 3) {
                        classHtml += (" num" + (i + 1));
                    }

                    rightListBooksHtml += (" <span>\n" +
                        "                    <a href=\"/book/"+rightListBook.bookId+".html\">\n" +
                        "                        <div style=\"padding: 1%\" class=\"layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4\">\n" +
                        "                            <img style=\" width:80%; height:auto; max-width:100%; max-height:100%;\"\n" +
                        "                                 src=\""+rightListBook.picUrl+"\"/>\n" +
                        "\n" +
                        "                            <br/>\n" +
                        "                            <span>"+rightListBook.bookName+"</span>\n" +
                        "\n" +
                        "                        </div>\n" +
                        "                    </a>\n" +
                        "                        </span>");
                }
                $("#currentWeek").html(rightListBooksHtml);

                //热门推荐
                var hotRecBooks = data.data[3];
                var hotRecBooksHtml = "";
                for (var i = 0; i < 6; i++) {
                    var hotRecBook = hotRecBooks[i];

                    if(hotRecBook.bookDesc){
                        hotRecBook.bookDesc = hotRecBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
                    }

                    hotRecBooksHtml += ("<div style=\"margin-bottom: 5px\" class=\"layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4\">\n" +
                        "                        <a href=\"/book/"+hotRecBook.bookId+".html\">\n" +
                        "                            <div class=\"layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4\" >\n" +
                        "                                <img style=\" width:100px; height:125px;\"\n" +
                        "                                     src=\""+hotRecBook.picUrl+"\"/>\n" +
                        "\n" +
                        "                            </div>\n" +
                        "                            <div class=\"layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6\">\n" +
                        "                                <ul>\n" +
                        "                                    <li class=\"line-limit-length\" style=\"font-weight: bold\">"+hotRecBook.bookName+"</li>\n" +
                        "                                    <li>作者："+hotRecBook.authorName+"</li>\n" +
                        "                                    <li style=\"width: 180px;height:40px;overflow: hidden\">简介：　　"+hotRecBook.bookDesc+"" +
                        "                                </ul>\n" +
                        "                            </div>\n" +
                        "                            <div style=\"font-style: italic;color: red\"\n" +
                        "                                 class=\"layui-col-xs2 layui-col-sm2 layui-col-md2 layui-col-lg2\"></div>\n" +
                        "                        </a>\n" +
                        "                    </div>");
                }
                $("#hotRecBooks").html(hotRecBooksHtml);



            } else {
                layer.alert(data.msg);
            }

        },
        error: function () {
            layer.alert('网络异常');
        }
    })


    //更新榜单查询
    $.ajax({
        type: "GET",
        url: "/book/listUpdateRank",
        data: {},
        dataType: "json",
        success: function (data) {
            if (data.code == 200) {
                var updateRankBooks = data.data;
                var updateRankBookHtml = "";
                for (var i = 0; i < 10; i++) {

                    var updateRankBook = updateRankBooks[i];
                    if(updateRankBook.bookDesc){
                        updateRankBook.bookDesc = updateRankBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
                    }

                        updateRankBookHtml += ("<div style=\"padding-bottom: 30px\"\n" +
                            "                     class=\"layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6\">\n" +
                            "\n" +
                            "                    <a href=\"/book/"+updateRankBook.id+".html\">\n" +
                            "                        <div class=\"line-limit-length layui-col-xs8 layui-col-sm6 layui-col-md6 layui-col-lg6\"><b>"+(i+1)+"."+updateRankBook.bookName+"</b> - <span class=\"layui-elip\">"+updateRankBook.authorName+"</span>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"layui-col-sm3 layui-col-md3 layui-col-lg3\"\n" +
                            "                             style=\"color: #FF5722;float: right;margin-right:5px\"><i>"+updateRankBook.lastIndexUpdateTime+"</i></div>\n" +
                            "\n" +
                            "                        <div style=\"clear: both\"></div>\n" +
                            "                        <div style=\"padding-left: 5px;padding-top: 5px\"\n" +
                            "                             class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介：　　"+updateRankBook.bookDesc+"" +
                            "                    </div></a>\n" +
                            "                </div>");




                }
                $("#updateRankBooks").html(updateRankBookHtml);
            } else {
                layer.alert(data.msg);
            }

        }
        ,
        error: function () {
            layer.alert('网络异常');
        }
    })



    function moreNewBooks(event) {
        window.location.href = "/book/book_ranking.html?sortBy=last_index_update_time";
    }

    function searchBooks() {
        var keywords = $("#title").val();
        window.location.href = "/book/book_ranking.html?keyword=" + encodeURI(keywords);
    }

    function toMyCollect() {
        var token = localStorage.getItem("token");
        if (token) {
            window.location.href = "/book/book_ranking.html?token=" + token;
        } else {
            window.location.href = "/user/login.html";
        }
    }

</script>


</body>
</html>