<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib  uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]-->
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/html5shiv.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/respond.min.js"></script>
    <!--[endif]-->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/page.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/index/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/layer.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/laydate/laydate.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <title>分类管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>首页 <span class="c-gray en">&gt;</span>手机Banner管理  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" title="添加轮播图" href="${pageContext.request.contextPath}/admin/add_banners.html" ><i class="Hui-iconfont">&#xe600;</i> 添加轮播图</a>
        </span>
        <span class="r data_num">共有数据：<strong id="total">${fn:length(list)}</strong> 条</span>
    </div>

    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="100">编号</th>
                <th width="150">所属板块</th>
                <th width="150">名称</th>
                <th width="150">展示图</th>
                <th width="150">外链路径</th>
                <th width="100">排序值</th>
                <th width="150">更新时间</th>
                <th width="200">操作</th>
            </tr>
            </thead>
            <tbody>

            <c:forEach items="${list}" var="p">
                <tr class="text-c">
                    <td>${p.id}</td>
                    <td><span class="label label-success radius">
                        <c:if test="${p.id==1}">关于汉思</c:if>
                        <c:if test="${p.id==2}">汉思动态</c:if>
                        <c:if test="${p.id!=1 && p.id!=2}">轮播图</c:if>
                    </span></td>
                    <td>${p.name}</td>
                    <td><img src="${p.img}" width="auto" height="40px"></td>
                    <td>${p.hrefs}</td>
                    <td>${p.sort}</td>
                    <td>${p.time}</td>
                    <td class="f-14 td-manage">
                        <a style="text-decoration:none" class="ml-5" href="${pageContext.request.contextPath}/admin/update_banners.html?pid=${p.id}" title="编辑"><i class="Hui-iconfont">&#xe6df;</i>编辑</a>
                        <c:if test="${p.identity==0}">
                            <a style="text-decoration:none" class="ml-5" onClick="delete_text(this,${p.id})" title="删除"><i class="Hui-iconfont">&#xe6e2;</i>删除</a></td>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>

            </tbody>
        </table>
    </div>


</div>
</div>
<script type="text/javascript">

    function delete_text(obj,id){
        layer.confirm('确认要删除吗？',function(){
            $.ajax({
                url : 'delete_banners.html',
                type : 'POST',
                async: false,
                data : {'pid' : id},
                dataType : 'text',
                success : function(data){
                    if(data == 'ok'){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                },
                error : function(data) {
                    console.log(data.msg);
                },
            });
        });
    }



</script>
</body>
</html>