<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<?php echo e(URL::asset('admin/frame/layui/css/layui.css')); ?>" media="all">
    <link rel="stylesheet" href="<?php echo e(URL::asset('admin/css/welcome.css')); ?>" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<!--<div class="layui-btn-group demoTable">
    <button class="layui-btn" data-type="getCheckData">获取选中行数据</button>
    <button class="layui-btn" data-type="getCheckLength">获取选中数目</button>
    <button class="layui-btn" data-type="isAll">验证是否全选</button>
</div>-->


<table class="layui-hide" id="LAY_table_user" lay-filter="demo"></table>

<script type="text/html" id="switchTpl">
    <!-- 这里的 checked 的状态只是演示 -->
    <input type="checkbox" name="sex" value="@{{d.table_name}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="sexDemo"
           @{{ d.LAY_CHECKED== 1 ? 'checked' : '' }}>
</script>


<script src="<?php echo e(URL::asset('admin/js/jquery-1.11.3.js')); ?>" charset="utf-8"></script>
<script src="<?php echo e(URL::asset('admin/frame/layui/layui.js')); ?>" charset="utf-8"></script>
<script src="<?php echo e(URL::asset('admin/js/configure.js')); ?>" charset="utf-8"></script>
<script>
    var url2 = '/admin/game/GameStatus';
    var url1 = '<?php echo e(URL::asset("admin/json/package.json")); ?>';


    layui.use(['laydate', 'laypage', 'layer', 'table'], function () {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , laytpl = layui.laytpl;

        layer = layui.layer //弹层
            , table = layui.table //表格
            , form = layui.form;

        //获取表头
        var thead = type('/admin/game/GameClose');
        //获取数据
        var returnData = getData(url2, {status: 1})
        //执行一个 table 实例
        table.render({
            elem: '#LAY_table_user'
            , even: true
            , cols: [
                thead
            ]
            , data: returnData.data
            //, page: true //是否显示分页
        });

        //监听checked
        form.on('switch(sexDemo)', function (obj) {

            var closeinfo = $(this).parents('tr').find('.laytable-cell-1-closeinfo').text()
            var deliveryData = {
                game: this.value,
                status: obj.elem.checked,
                closeinfo: closeinfo
            }
            $.ajax({
                type: 'post',
                url: '/admin/game/GameClose',
                data: deliveryData,
                dataType: 'json',
                success: function (json) {
                    if(json.status==1){
                        layer.msg(json.msg)
                    }
                },
                error: function (req) {

                }
            })
        });

        //监听单元格编辑


    });
</script>
</body>
</html>