layui.use(['form', 'table', 'util'], function () {
    var $ = layui.jquery,
        form = layui.form,
        table = layui.table,
        util = layui.util;
    table.render({
    elem: '#currentTableId',
    url: API_USER_LIST,
    cols: [[
        {type: "checkbox", width: 50, fixed: "left"},
        {field: 'uid', width: 80, title: 'ID', sort: true},
        {field: 'username', width: 80, title: '用户名'},
        {field: 'email', width: 80, title: '邮箱', sort: true},
        {field: 'gander', width: 80, title: '性别',
            templet: function (data) {  //自定义方法
                if (data.gander == 1) {
                    return "男";
                } else if (data.gander == 2) {
                    return "女";
                } else {
                    return "未设置性别";                        }
            }
        },
        {field: 'avatar', width: 80, title: '头像', sort: true,
            templet:function (data) {
                return "<img src='"+data.avatar+"' width='100%'>";
            }
        },
        {field: 'register_time', title: '注册时间', minWidth: 150,
            templet: function (d) {
                return util.toDateString(d.register_time*1000)   //格式化时间
            }
        },
        {field: 'status', width: 80, title: '状态', sort: true},
        {title: '操作', minWidth: 50, templet: '#currentTableBar', fixed: "right", align: "center"}
    ]],
    limits: [10, 15, 20, 25, 50, 100],
    limit: 15,
    page: true
});