<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
        name="viewport">
    <title>{{title}} {% if page.current_page!=0 %}-第{{page.current_page}}页 {% endif %}</title>
    <meta name="keywords" content="{{post.keywords}}" />
    <meta name="description" content="{{post.description}}" />
    <link rel="stylesheet" href="{{'CMS_BASEHOST'|sysconfig}}/static/css/style.css" media="all">
    <script type="text/javascript" src="{{'CMS_BASEHOST'|sysconfig}}/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="{{'CMS_BASEHOST'|sysconfig}}/static/js/ad.js"></script>
    <script type="text/javascript" src="{{'CMS_BASEHOST'|sysconfig}}/static/js/jquery-bootstrap-pagination.js"></script>
</head>

<body>
    <script>
        site();
    </script>
    {% include "/index/common/header.html" %}<div id="tad">
        <script>
            tjs();
        </script>
    </div>

    <div class="box mt10">
        <div class="fl_640">
            <div class="bread" style="padding:12px 20px;"><a href="/">{{'CMS_INDEXNAME'|sysconfig}}</a> >
                {{bread|safe}}</div>
            <div class="zinfo" style="padding-left:20px;padding-right:20px;">
                <h1>{{post.name}}</h1>
                {% if post.content%}<div class="zdes">{{post.content|safe}}</div>{% endif %}
            </div>
            <div id="lad1">
                <script>
                    ljs1();
                </script>
            </div>

            {% for row in list %}<div class="list">
                {% if row.litpic %}
                    <a class="limg" href="{{row.id|getArticleDetailUrl}}"><img
                        alt="{{row.title}}" src="/static{{row.litpic}}"></a>{% endif %}
                <strong class="tit"><a
                        href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a></strong>
                <p>{{row.description}}..</p>
                <div class="info"><span
                        class="fl"><em>{{row.update_time|date}}</em></span><span
                        class="fr"><em>{{row.click}}</em>人阅读</span></div>
                <div class="cl"></div>
            </div>{% endfor %} {% if list|length == 0 %}<div style="text-align:center;padding:20px;">暂无记录</div>{% endif %}<div id="lad2">
                <script>
                    ljs2();
                </script>
            </div>

            <ul class="pagination" style="margin: 0 20px 0 20px;">
            </ul>
            
            <div id="lad3">
                <script>
                    ljs3();
                </script>
            </div>
        </div><!-- fl_640 end -->

        <div class="fr_300">
            <div id="rad1">
                <script>
                    rjs1();
                </script>
            </div>
            <div class="side">
                <div class="stit">
                    <h2>推荐阅读</h2><a
                        href="javascript:getmore({limit:5,type_id:{{post.id}},tuijian:1,mode:1,orderby:'rand'});"
                        class="more">换一换</a>
                    <div class="cl"></div>
                </div>
                <ul class="uli chs" id="xglist">{% for row in relate_tuijian_list %}
                    <li><a
                            href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                    </li>{% endfor %}</ul>
                <div class="cl"></div>
            </div>

            <div id="rad3">
                <script>
                    rjs3();
                </script>
            </div>
            <div class="side">
                <div class="stit">
                    <h2>猜你喜欢</h2><a href="javascript:getmore({limit:5,mode:2,orderby:'rand'});" class="more">换一换</a>
                    <div class="cl"></div>
                </div>
                <div class="uli2" id="xglike">{% for row in relate_rand_list %}
                    <div class="suli">
                        {% if row.litpic %}
                        <a class="limg" href="{{row.id|getArticleDetailUrl}}">
                            <img alt="{{row.title}}" src="/static{{row.litpic}}">
                        </a>
                        {% endif %}
                        <a  href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                        <div class="sulii">
                            {% if row.writer %}
                            <span class="time">{{row.writer}}</span>
                            {% elif row.source %} 
                            <span class="time">{{row.source}}</span>
                            {% endif %} 
                            阅读({{ row.click}})</div>
                        <div class="cl"></div>
                    </div>{% endfor %}
                </div>
            </div>

            <div id="rad2">
                <script>
                    rjs2();
                </script>
            </div>
        </div><!-- fr_300 end -->
    </div><!-- box end -->
    <script>
        function getmore(condition) {
            var url = "{{'CMS_BASEHOST'|sysconfig}}/api/article/index";
            //var typeid = "";
            $.post(url, condition, function (res) {
                if (res.code == 0) {
                    var json = res.data.list; //数组
                    var str = '';
                    console.log(res.data)
                    $.each(json, function (index) {
                        //循环获取数据
                        //var title = json[index].title;
                        if (condition.mode == 1) {
                            str = str +
                                '<li><a href=" {{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title + '</a></li>';
                        } else if (condition.mode == 2) {
                            var litpic = '';
                            if (json[index].litpic !== '') {
                                litpic =
                                    '<a class="limg" href="{{getArticleDetailUrl}}' +
                                    json[index].id + '"><img alt="' + json[index].title + '" src="/static' +
                                    json[index].litpic + '"></a>';
                            }
                            str = str + '<div class="suli">' + litpic +
                                '<a href="{{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title +
                                '</a><div class="sulii">阅读(' + json[index].click +
                                ')</div><div class="cl"></div></div>';
                        }
                    });

                    if (str != '' && str != null && condition.mode == 1) {
                        $('#xglist').html(str);
                    } else if (str != '' && str != null && condition.mode == 2) {
                        $('#xglike').html(str);
                    }
                } else {

                }
            }, 'json');
        }
        //进行查询
        function query(e,page){
            window.location.href= '?page='+page
        }

        //这里回调
        $(".pagination").unbind();
        $(".pagination").pagination({
            total_pages:{{ page.total_page }},
            current_page:{{ page.current_page }},
            callback:query
        });
    </script>
    {% include "/index/common/footer.html" %}
</body>

</html>