<?= view('layout/header')->send(); ?>
<style type="text/css">
    .panel-body{
        background-color: #fff;
    }
</style>
<div class="cv-login">

    <div class="cv-login-panel">
        <div class="easyui-panel" style="width:100%;padding:30px 60px;">
            <div style="width: 100%;text-align: center;">
                <img src="<?= asset('dash/img/brand.png'); ?>" />
            </div>
            <form id="cv-form" method="post" style="margin-top: 15px;">
                <div style="margin-bottom:20px">
                    <input required prompt="请输入账号" class="easyui-textbox" name="username" style="width:100%" data-options="
                    iconWidth: 22,
                    iconAlign: 'left',
                    icons: [{
                        iconCls:'icon-login-user'
                    }]">
                </div>
                <div style="margin-bottom:20px">
                    <input required prompt="请输入密码" class="easyui-textbox" name="plain_password" style="width:100%" data-options="
                    iconWidth: 22,
                    iconAlign: 'left',
                    icons: [{
                        iconCls:'icon-login-pass'
                    }]">
                </div>
            </form>
            <div style="text-align:center;padding:5px 0">
                <a href="javascript:void(0);" onclick="saveForm();" class="easyui-linkbutton c8" style="width:100%;margin-bottom: 15px;">登录</a>
            </div>
        </div>
    </div>

</div>

<?= view('layout/footer')->send(); ?>

<script type="text/javascript">
    function saveForm(){
        $("#cv-form").form('submit',{
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
                var response = JSON.parse(result);
                if (!response.success){
                    message(response.message);
                }else {
                    window.location.href='<?= $success_url; ?>';
                }
            }
        });
    }
</script>