<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>二维码列表</title>
</head>
<script src="/web/admin/js/common/jquery-2.2.4.min.js" type="text/javascript" charset="utf-8"></script>
<body>
<table style="" border="1" >
    <?php
    $i = 0;
    foreach ($list as $val) {
        if ($i % 4 === 0) {
            echo '<tr>';
        }  ?>
        <td style="max-width: 200px;" onclick="alert('<?php echo $val['nickname'] ?>');">
            <div title="<?php echo $val['nickname'] ?>"><img src="<?php echo $val['img_url']; ?>" style="max-width: 100%;"></div>
            <div style="font-size: 13px;height: 13px;text-align: center;" title="<?php echo $val['nickname'] ?>"><?= $val['qr_id']; ?></div>
        </td>
        <?php
        $i++;
        if ($i % 4 === 0) {
            echo '</tr>';
        }
    }

    ?>
</table>
<div style="margin-top: 15px;">
    <input type="text" id="qr_id" value="" placeholder="输入编号20000-25000之间" style="width: 250px;">
    <input type="button" onclick="addNew();" value="生成二维码">
</div>
<script type="text/javascript">
    function addNew() {
        var data = {
            qr_id: $('#qr_id').val()
        };
        $.ajax({
            url: '/admin/?r=user/fx-user/add-qr-codes', //请求地址
            type: "post", //请求方式
            data: data,
            async: false,
            dataType: "json",
            success: function (data) {
                if (data.flag == true) {
                    alert('生成成功！');
                    window.location.reload();
                } else {
                    alert(data.msg);
                }
            },
            fail: function () {
                alert('接口异常');
            }
        });
    }
</script>
</body>
</html>