<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>手机号：</label>
                            <input type="number" name="phone"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
<!--                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i-->
<!--                                    class="fa fa-refresh"></i>&nbsp;重置</a>-->
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var detailFlag = [[${@permission.hasPermi('smile:performances:detail')}]];
    var smilePrefix = ctx + "smile/user";
    console.log(smilePrefix);

    //     // createUrl: prefix + "/add",
    //     // updateUrl: prefix + "/edit/{id}",
    //     // removeUrl: prefix + "/remove",
    //     // exportUrl: prefix + "/export",
    //     // modalName: "订单",
    $(function() {
        var options = {
            updateUrl: smilePrefix + "/smileDetail",
            url: smilePrefix + "/list",
            columns: [{
                checkbox: true
            },
                {
                    field: 'uid',
                    title: '用户id'
                },
                {
                    field: 'img',
                    title: '生活照',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value,"300", "300");
                    }
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                        if (value == 1) {
                            return '男';
                        } else {
                            return '女';
                        }
                    }
                },
                {
                    field: 'birthday',
                    title: '生日'
                },
                {
                    field: 'phone',
                    title: '手机号'
                },
                {
                    field: 'identity',
                    title: '身份',
                    formatter: function(value, row, index) {
                        if (value == 1) {
                            return '在校学生';
                        } else {
                            return '已毕业';
                        }
                    }
                },
                {
                    field: 'schoolName',
                    title: '学校/公司名称'
                },
                {
                    field: 'province',
                    title: '地区'
                },
                {
                    field: 'type',
                    title: '类型',
                    formatter: function(value, row, index) {
                        if (value == 1) {
                            return '总代';
                        } else {
                            return '普代';
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="goDetail(\'' + row.uid + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);

        console.log(options)
    });
    function goDetail (id) {
        var url = ctx+'local/smileDetail?id=' + id;
        $.modal.openTab("用户详情", url);
    }
    // var updateFlag = [[${@permission.hasPermi('sweet:integralActivity:create')}]];
    // var isOnlineFlag = [[${@permission.hasPermi('sweet:integralActivity:isOnline')}]];
    // var drawListFlag = [[${@permission.hasPermi('sweet:integralActivityDraw:list')}]];
    // var exportExcelFlag = [[${@permission.hasPermi('sweet:integralActivityDraw:exportExcel')}]];

    // var prefix = ctx + "sweet/integralActivity";

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