<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="renderer" content="webkit">

        <title>文章管理列表</title>
        <link href="lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
        <link href="css/all.css" rel="stylesheet" type="text/css" />
        <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
        <script src="lib/ligerUI/js/core/base.js" type="text/javascript"></script>
        <script src="lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
        <script src="lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
    </head>
    <body>
        <div class="m-form-control f-ml10" style="margin-top: 20px;margin-left: 25px;margin-bottom: 25px;">
            <div id="btn_search"
                 class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam">
                <span>添加</span>
            </div>
        </div>
        <div id="div_feedback_list">

        </div>
    </body>
    <script>
        function edit(id){
            //iframe层
            parent.layer.open({
                type: 2,
                title: '编辑页',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: 'toEdit?id="+id;' //iframe的url
            });
        }

        $("#div_feedback_list").ligerGrid({
            columns: [
                {display: '主键',hide:"true", name: 'id'},
                {display: '标题', name: 'title', minWidth: 60},
                {display: '简介', name: 'contentFirst', minWidth: 60},
                {display: '关键字', name: 'keyword', minWidth: 60},
                {display: '类型', name: 'typeName', minWidth: 60},
                {
                    display: '操作', name: 'operator',
                    render: function (row) {
                        var html = '';
                        html += '<a  onclick="edit(\''+row.id+'\')">查看</a><a style="margin-left: 15px" onclick="del(\''+row.id+'\')">删除</a>';
                        return html;
                    }
                }
            ],
            url: "list",
            pageSize: 20,
            width: '100%',
            height: '99%',
            checkbox: true
        });
        $("#btn_search").click(function(){
            parent.layer.open({
                type: 2,
                title: '添加页',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: 'toAdd' //iframe的url
            });
        });

        function del(id){
            //询问框
            parent.layer.confirm('确定删除该条记录吗？', {
                btn: ['删除','取消'], //按钮
                shade: false //不显示遮罩
            }, function(){
                //删除
                $.ajax({
                    url:"del?id="+id,
                    success: function (data) {
                        var json = eval('(' + data + ')');
                        if(json.status=='200'){
                            parent.layer.msg('删除成功', {icon: 1});
                        }else{
                            parent.layer.msg('服务器忙', {icon: 2});
                        }
                        $("#div_feedback_list").ligerGrid().reload();
                    }

                })
            }, function(){

            });
        }
    </script>

</html>