{% load staticfiles %}
<!DOCTYPE html>
<html lang='zh-CN'>
<head>
	<title>用户注册 - MrDoc</title>
	<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
	<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}" crossorigin="anonymous">
    <link rel="icon" href="{% static 'favicon_16.png' %}"/>
    <style>
        body{
            background-color: #fafafa;
            text-align: center;
        }
        .container{
            display: flex;
            display: -webkit-flex;
            justify-content: center;
            align-items: center;
        }
        .login-form{
            margin-top: 15%;
            {#width: 400px;#}
            padding: 20px 50px 20px 60px;
            background-color: #fff;
            -webkit-box-shadow: #666 0px 0px 10px;
           -moz-box-shadow: #666 0px 0px 10px;
           box-shadow: #666 0px 0px 10px;
        }
        .register-link{
            font-size: 12px;
        }
        /* 移动端输入框样式 */
        @media screen and (max-width: 450px){
            .layui-form-item .layui-input-inline {
                display: block;
                float: none;
                left: -3px;
                width: auto;
                margin: 0;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div></div>
        <div></div>
        <div class="login-form">
            <form class="layui-form" action="{% url 'register' %}"  method='POST'>
                {% csrf_token %}
                <div class="layui-form-item">
                    <h2><strong>注册 - MrDoc</strong></h2>
                </div>
                <span style='color:red;margin-bottom: 10px;'>{{ errormsg }}</span>
                {% if enable_register_code %}
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                      <input type="text" name="register_code" required  lay-verify="required" placeholder="请输入注册码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                {% endif %}
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                      <input type="text" name="username" required  lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                      <input type="email" name="email" required  lay-verify="required" placeholder="请输入电子邮箱" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                      <input type="password" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" placeholder="请输入验证码" name="check_code">
                            <img src="{% url 'check_code' %}" onclick="ChangeCode(this);">
                            <script>
                                // 点击一次,更改图片内容,
                                function ChangeCode(ths){
                                    ths.src = ths.src + '?';
                                }
                            </script>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <button class="layui-btn layui-btn-fluid layui-btn-radius  layui-btn-normal" lay-submit lay-filter="formDemo" type="submit">注册并登录</button>
                    </div>
                </div>
                 <a href="{% url 'login' %}" class="register-link">返回登录</a>
                 <a href="{% url 'pro_list' %}" class="register-link">返回首页</a>
            </form>
        </div>
    </div>
</body>
</html>