<!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 th:text="${book.bookName}+'小说最新章节免费阅读和下载'"></title>
    <meta name="keywords" th:attr="content=${book.bookName}+','+${book.bookName}+'最新章节,'+${book.bookName}+'免费阅读,'+${book.bookName}+'TXT下载'">
    <meta name="description"
          th:attr="content=${book.bookName}+'最新章节列表,'+${book.bookName}+'最新更新章节免费无广告无弹窗在线阅读,'+${book.bookName}+'小说TXT免费下载'">

    <meta property="og:type" content="novel"/>
    <meta property="og:title" th:attr="content=${book.bookName}+'小说最新章节免费阅读和下载'"/>
    <meta property="og:description" th:attr="content=${book.bookDesc}"/>
    <meta property="og:image" th:attr="content=${book.picUrl}"/>
    <meta property="og:novel:category" th:attr="content=${book.cateName}"/>
    <meta property="og:novel:author" th:attr="content=${book.author}"/>
    <meta property="og:novel:book_name" th:attr="content=${book.bookName}"/>
    <meta property="og:novel:read_url"  th:attr="content='https://www.zinglizingli.xyz/book/'+${book.id}+'.html'"/>
    <meta property="og:url" th:attr="content='https://www.zinglizingli.xyz/book/'+${book.id}+'.html'"/>
    <meta property="og:novel:status" th:attr="content=${book.bookStatus}"/>
    <meta property="og:novel:update_time" th:attr="content=${#dates.format(book.updateTime, 'yy-MM-dd')}"/>
    <meta property="og:novel:latest_chapter_name" th:attr="content=${lastIndexName}"/>
    <meta property="og:novel:latest_chapter_url" th:attr="content='https://www.zinglizingli.xyz/book/'+${bookId}+'/'+${lastIndexNum}+'.html'"/>




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

    <style type="text/css">

        .indexP p a{
            color:#4c6978;
        }

        .tag-list {
            padding-top: 0px;
            padding-bottom: 20px;
            position: fixed;
            top:50px;
            right: 0px;
            width: 120px;
            z-index:100000;
        }

        .tag-list .tag {
            float: right;
            width: 100%;
            text-align: right;
            margin-top: 5px;
        }

        .tag-list .tag a {
            display: inline-block;
            margin-right: 8px;
            font-size: 12px;
        }
        .tag-list .highlight {
            padding: 5px 9px;
            border: 1px solid #f90;
            color: #f90;
            border-radius: 50px;
        }

        .tag-list .highlight .text {
            color: #f90;
        }
        .tag-list .tag .text {
            display: inline-block;
            vertical-align: middle;
            color: #f90;
        }

        ul, li {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .tag-list .tag a {
            display: inline-block;
            margin-right: 8px;
            font-size: 12px;
        }

        .tag-list .highlight .icn {
            color: #f90;
        }
        .tag-list .tag .icn {
            margin-right: 5px;
            color: #ccc;
        }

        .tag-list .highlight .text {
            padding-left: 3px;
            color: #f90;
        }
        .tag-list .tag .text {
            display: inline-block;
            vertical-align: middle;
            color: #f90;
        }

    </style>

    <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>
    <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);
        })();
    </script>
    <script src="/js/wap_collect.js"></script>

</head>
<body>

<ul class="tag-list clearfix" id="tagLi">

</ul>


<input type="hidden" id="bookIdHidden" th:value="${bookId}"/>
<input type="hidden" id="bookTagHidden" th:value="${book.softTag}"/>
<input type="hidden" id="bookNamedHidden" th:value="${book.bookName}"/>

<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="${book.bookName}"></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-row" style="background: #f2f2f2">
    <div style="padding: 10px" class="layui-col-xs4 layui-col-sm2 layui-col-md2 layui-col-lg2">
        <img style=" width:auto; height:auto; max-width:100%; max-height:100%;" th:src="${book.picUrl}"/>

    </div>
        <div style="position:relative;padding: 10px 20px" class="layui-col-xs8 layui-col-sm8 layui-col-md8 layui-col-lg8">
            <a th:href="'/book/search?keyword='+ ${book.author}"><div style=";color: #4c6978;" th:text="'作者：'+ ${book.author}"></div></a>
            <a th:href="'/book/search?catId='+${book.catid}"><div style="margin-top: 5px;color: #4c6978;" th:text="'类别：'+ ${book.cateName}"></div></a>
            <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 style="margin-top: 5px;color: #4c6978;">评分：<i style="font-weight:bold;color: red" th:text="${book.score} + '分'"></i></div>
            <div style="margin-top: 5px;color: #4c6978;">点击：<i style="font-weight:bold;color: red" th:text="${book.visitCount}"></i></div>


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



<div style="text-align: center;height: 45px;line-height: 45px">
    <a th:href="'/book/'+${book.id}+'/'+${minIndexNum}+'.html'"  type="button" class="layui-btn layui-btn-sm layui-btn-radius">开始阅读</a>
    <button type="button" id="collectButton"  class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">加入书架</button>

    <button type="button" onclick="toMyCollect()" class="layui-btn layui-btn-sm layui-btn-radius layui-bg-cyan">我的书架</button>
    <button type="button" onclick="downloadFile()" class="layui-btn layui-btn-sm layui-btn-radius layui-bg-normal">下载TXT</button>
</div>
<p style="line-height: 23px;padding: 10px;font-size: 14px;color: #4c6978;" th:utext="${book.bookDesc}">

</p>

<div class="layui-collapse">
    <div class="layui-colla-item" >
        <h2 class="layui-colla-title">
            <span>最新章节</span>
            <span style="margin-left: 30px">
                更新： <i th:text="${#dates.format(book.updateTime, 'yy-MM-dd HH:mm:ss')}"></i>
            </span>
        </h2>
        <div class="layui-colla-content layui-show indexP">


            <p style="height: 30px;line-height: 30px;padding: 10px" th:each="index : ${indexList}"><a th:href="'/book/'+${index.bookId}+'/'+${index.indexNum}+'.html'" th:text="${index.indexName}"></a></p>

        </div>
    </div>
</div>
<div style="height: 42px;color:#4c6978;line-height: 42px;padding-left: 30px;background: #f2f2f2" >

    <a th:href="'/book/'+${book.id}+'/index.html'">查看完整目录</a>
</div>

<!--
<div style="position: fixed;top:0px;left:0px;z-index:-100;opacity: 0" th:utext="${attacDivForSearch}"></div>
-->

<div th:replace="common/footer :: footer">
</div>



</body>
<div th:replace="common/js :: js">
</div>
<script>

    function downloadFile() {
        var fileUrl = 'http://www.zinglizingli.xyz:8080/book/download?bookId='+$("#bookIdHidden").val()+'&bookName='+$("#bookNamedHidden").val();
        window.location.href=fileUrl;


    }

    $(window).unload(function(){
        var token = localStorage.getItem("token");
        if(token) {

            $.get("/user/isCollect", {"bookId": $("#bookIdHidden").val(), "token": token}, function (data) {

                if (data.code == 1) {
                    $("#collectButton").text("撤下书架");
                    $('#collectButton').unbind("click");
                    $("#collectButton").click(function () {
                        cancelToCollect();
                    });

                } else if (data.code == 2) {
                    $('#collectButton').unbind("click");
                    $("#collectButton").text("加入书架");
                    $("#collectButton").click(function () {
                        addToCollect();
                    });
                } else {
                    $('#collectButton').unbind("click");
                    $("#collectButton").text("加入书架");
                    $("#collectButton").click(function () {
                        window.location.href = "/user/login.html?bookId=" + $("#bookIdHidden").val();
                    });
                }
            });
        }else{
            $('#collectButton').unbind("click");
            $("#collectButton").text("加入书架");
            $("#collectButton").click(function () {
                window.location.href = "/user/login.html?bookId="+$("#bookIdHidden").val();
            });

        }

    });

    $(function () {
        var token = localStorage.getItem("token");
        if(token) {

            $.get("/user/isCollect", {"bookId": $("#bookIdHidden").val(), "token": token}, function (data) {

                if (data.code == 1) {
                    $("#collectButton").text("撤下书架");
                    $('#collectButton').unbind("click");
                    $("#collectButton").click(function () {
                        cancelToCollect();
                    });

                } else if (data.code == 2) {
                    $('#collectButton').unbind("click");
                    $("#collectButton").text("加入书架");
                    $("#collectButton").click(function () {
                        addToCollect();
                    });
                } else {
                    $('#collectButton').unbind("click");
                    $("#collectButton").text("加入书架");
                    $("#collectButton").click(function () {
                        window.location.href = "/user/login.html?bookId=" + $("#bookIdHidden").val();
                    });
                }
            });
        }else{
            $('#collectButton').unbind("click");
            $("#collectButton").text("加入书架");
            $("#collectButton").click(function () {
                window.location.href = "/user/login.html?bookId="+$("#bookIdHidden").val();
            });

        }


        var bookTag = $("#bookTagHidden").val();
        if(bookTag){
            bookTag=bookTag.split(",");
            var innerHtml = "";
            for(var i=0; i< bookTag.length;i++){
                var tag = bookTag[i];
                innerHtml+=("<li class=\"tag\">\n" +
                    "        <a href=\"/book/searchSoftBook.html?softTag="+encodeURI(tag)+"\" class=\"highlight\"><span class=\"layui-icon\">&#xe66e;</span><span class=\"text\">"+tag+"</span></a>\n" +
                    "    </li>");
            }

            $("#tagLi").html(innerHtml);
        }
    });



    $.get("/book/addVisit",{"bookId":$("#bookIdHidden").val()},function(){});

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

    function addToCollect(){
        var token = localStorage.getItem("token");

        if(token) {
            $.get("/user/addToCollect",{"bookId":$("#bookIdHidden").val(),"token":token},function(data){
                    layer.alert(data.desc);
                    if(data.code == 1) {
                        $('#collectButton').unbind("click");
                        $("#collectButton").text("撤下书架");
                        $("#collectButton").click(function () {
                            cancelToCollect();
                        });
                    }
            });
        }else{
            window.location.href = "/user/login.html?bookId="+$("#bookIdHidden").val();
        }



    }


    function cancelToCollect(){
        var token = localStorage.getItem("token");

        if(token) {
            $.get("/user/cancelToCollect",{"bookId":$("#bookIdHidden").val(),"token":token},function(data){
                    layer.alert(data.desc);
                if(data.code == 1) {
                    $('#collectButton').unbind("click");
                    $("#collectButton").text("加入书架");
                    $("#collectButton").click(function () {
                        addToCollect();
                    });
                }

            });
        }else{
            window.location.href = "/user/login.html?bookId="+$("#bookIdHidden").val();
        }

    }
</script>


</html>