{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>产品展厅列表页</title>
    <link rel="stylesheet" href="{% static '/lib/font/fontIcon/iconfont.css' %}">
    <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
    <link rel="stylesheet" href="{% static '/lib/css/reset.css' %}">
    <link rel="stylesheet" href="{% static '/css/common.css' %}">
    <link rel="stylesheet" href="{% static '/css/module.css' %}">
    <link rel="stylesheet" href="{% static '/css/exhibitionList.css' %}">
</head>

<body>
    <div class="header">
        <div class="headerTxt">
            <div class="wrapper">
                <p class="logoNameCn">休闲农业旅游网</p>
                <p class="logoNameEn">Leisure agricultural tourism network</p>
            </div>

        </div>
        <!-- 广告 -->
        <div class="bjColor advImg"></div>
    </div>
    <!-- 主体部分 -->
    <div class="content">
        <div class="wrapper">
            <div class="newsDiv">
                <!-- 面包屑导航 -->
                <div class="breadcrumb">
                    <span class="layui-breadcrumb">
                        <a href="home">首页</a>
                        <a>
                            <cite>产品展厅</cite>
                        </a>
                    </span>
                    <div class="searchDiv">
                        <input type="text" id="searchTitlt" value="{{con|default:''}}" placeholder="请输入标题" autocomplete="off" class="layui-input" >
                        <button type="button" onclick="searchCon()" class="layui-btn layui-btn-ms"><i class="layui-icon">&#xe615;</i></button>
                    </div>
                </div>
                <!-- 新闻列表 -->
                <div class="innerDiv">
                    <ul class="videoList">
                        {% if product|length %} {% for productItem in product %}
                        <li class="videoItem">
                            <a href="equip_show_detail?id={{productItem.id}}">
                                <div class="videoImg">
                                    <img src="{{productItem.head_img}}" alt="">
                                </div>
                                <div class="videoMsg">
                                    <h2>产品名称：{{productItem.title}}</h2>
                                </div>
                            </a>
                        </li>
                        {% endfor %} {% else %}
                        <li class="videoItem" style=" width: 100%;">
                            <div style="text-align:center;line-height:200px;font-size:18px">暂无数据</div>
                        </li>
                        <li class="videoItem">
                            <a href="equip_show_detail?id=1">
                                <div class="videoImg">
                                    <img src="{% static '/imgs/fruit/fruit2.jpg' %}" alt="">
                                </div>
                                <div class="videoMsg">
                                    <h2>产品名称：青苹果</h2>
                                </div>
                            </a>
                        </li>
                       
                        {% endif %}
                    </ul>
                    <!-- 分页 -->
                    {% if product|length %}
                    <div id="page"></div>
                    <input type="hidden" value="{{nums}}" id="nums">
                    <input type="hidden" value="{{page}}" id="currPage"> {% else %} {% endif %}
                </div>
            </div>
        </div>
    </div>
    <!-- 底部版权 -->
    <div class="footer bjColor">
        <div class="wrapper">
            <div class="floatDiv">
                <div class="copyrightTxt">
                    <div>休闲农业旅游网</div>
                    <div>联系人：李四　　联系电话：13811111111</div>
                    <div>地址：河南省郑州市XXXXXXXXXXXXXXXXXXXXXXXXXX</div>
                </div>
                <div class="WeChatCode">
                    <img src="{% static '/imgs/WeChatCode.jpg' %}" alt="">
                    <p>关注公众号</p>
                </div>
            </div>
            <div class="copyright">
                版权所有XXXXXXXXXXXXXXXXXXXXXX
            </div>
        </div>
    </div>

    <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
    <script src="{% static '/lib/layui/layui.js'%}"></script>
    <script>
        //注意：导航 依赖 element 模块，否则无法进行功能性操作
        layui.use(['element', 'laypage'], function () {
            var element = layui.element;

            //…
            var laypage = layui.laypage;
            var currPage = $('#currPage').val();
            //执行一个laypage实例
            laypage.render({
                elem: 'page' //注意，这里的 test1 是 ID，不用加 # 号
                , count: $('#nums').val() //数据总数，从服务端得到
                , limit: 20
                , curr: currPage
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    console.log(obj.limit); //得到每页显示的条数
                    var searchTitlt = $('#searchTitlt').val();
                    //首次不执行
                    if (!first) {
                        window.location.href = 'equip_show_list?page=' + obj.curr + '&condition=' + searchTitlt;
                    }
                }
            });
        });


        $('#searchTitlt').on('keypress', function (e) {
            if (e && e.keyCode == 13) { // 按 Esc 
                searchCon()
            }
        })

        function searchCon() {
            var searchTitlt = $('#searchTitlt').val();
            window.location.href = 'equip_show_list?page=1' + '&condition=' + searchTitlt;
        }
    </script>
</body>

</html>