<!DOCTYPE html>
<html lang="en">

{% set  URI='/static/' %}
<head>
    <meta charset="utf-8"/>
    <title>{{ anget_name }}登录页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <!-- basic styles -->

    <link href="{{ URI }}assets/ace/assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="{{ URI }}assets/ace/assets/css/font-awesome.min.css"/>


    <!--[if lte IE 7]>
		  <link rel="stylesheet" href="{{URI}}assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

    <!-- ace styles -->

    <link rel="stylesheet" href="{{ URI }}assets/ace/assets/css/ace.min.css"/>
    <link rel="stylesheet" href="{{ URI }}assets/ace/assets/css/ace-rtl.min.css"/>


    <!--[if lte IE 8]>
		  <link rel="stylesheet" href="{{URI}}assets/ace/assets/css/ace-ie.min.css" />
		<![endif]-->


    <!--[if lt IE 9]>
		<script src="{{URI}}assets/ace/assets/js/html5shiv.js"></script>
		<script src="{{URI}}assets/ace/assets/js/respond.min.js"></script>
		<![endif]-->
    <link rel="stylesheet" href="{{ URI }}icon/iconfont.css">
    <style>
        .widget-box {
            top: 3em;
        }


    </style>
</head>

<body class="login-layout" style="min-height:600px">
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">

                    <div class="position-relative">

                        <div id="phone-login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h2 class="header blue lighter bigger">
                                        <i class="icon-leaf green"></i>
                                        <span class="blue">{{ settings.TITLE }}</span>
                                        <small>v2.5</small>
                                    </h2>

                                    <div class="space-6"></div>

                                    <form action="/myadmin/phone_login" method="post">
                                        <fieldset>
                                            <label class="block clearfix">
														<span class="block input-icon input-icon-left">
															<input type="text"
                                                                   class="form-control"
                                                                   name="phone"
                                                                   placeholder="输入手机号"
                                                                   value="{{ data.phone }}"/>
															<i class="icon-user"></i>
														</span>
                                            </label>


                                            <label class="block">

                                                <input type="text" size="10" style="widht:100px"
                                                       class=""
                                                       name="verify"
                                                       placeholder="验证码"/>


                                                <img class="" id="verify-code-image"
                                                     onclick="this.setAttribute('src','/get_verify_code_image/?nocache='+Math.random());"
                                                     src="/get_verify_code_image/"
                                                     alt="CheckCode"
                                                     title="点我刷新"/>
                                                <a href="javascript:;"
                                                   id="send-verify-code-btn"
                                                   class="btn btn-success btn-xs">获取手机验证码</a>

                                            </label>
                                            <label class="block clearfix ">
														<span class="block input-icon input-icon-left">
															<input type="text"
                                                                   class="form-control"
                                                                   name="smsVerifyCode"
                                                                   placeholder="手机验证码"
                                                                   value="{{ data.sms_verify_code }}"/>
															<i class="icon-lock"></i>
														</span>
                                            </label>


                                            <div class="space"></div>

                                            {% if  'IE' in request.META.HTTP_USER_AGENT %}
                                                <div class="alert alert-danger">
                                                    <button type="button" class="close" data-dismiss="alert">
                                                        <i class="icon-remove"></i>
                                                    </button>
                                                    <strong>Sorry!</strong>
                                                    不支持IE内核的浏览器!请使用Chrome,火狐,或将360浏览器切换到极速模式.
                                                    <br>
                                                </div>
                                            {% else %}
                                                <div class="clearfix">
                                                    <button type="submit" class="btn btn-primary btn-block">
                                                        <i class="icon-key"></i>{{ anget_name }}登录
                                                    </button>
                                                </div>
                                            {% endif %}
                                            <div class="space-4"></div>
                                            {% if code != 0 %}
                                                <div class="alert alert-danger">
                                                        {{ msg|safe }}
                                                    </div>
                                            {% endif %}


                                        </fieldset>
                                    </form>
                                    <div class="social-or-login center">
                                        <span class="bigger-110"></span>
                                    </div>
                                </div><!-- /widget-main -->


                                <div class="toolbar  clearfix">
                                    {% if not must_phone_login %}
                                        <div><a href="/myadmin/login"
                                                class="white">
                                            <i class="icon-arrow-left"></i>
                                            返回账号登录
                                        </a>
                                        </div>
                                    {% endif %}

                                </div>


                            </div>
                        </div>
                    </div>
                </div><!-- /.main-container -->

            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    window.jQuery || document.write("<script src='{{ URI }}assets/jquery/jquery-1.11.1.min.js'>" + "<" + "/script>");
</script>
<script type="text/javascript">
    $(function () {
        function show_box(id) {
            jQuery('.widget-box.visible').removeClass('visible');
            jQuery('#' + id).addClass('visible');
        }

        $('#send-verify-code-btn').click(function () {
            var num = 60
            var $btn = $(this)
            var tmp_text = $btn.text()

            $.post('/myadmin/sms/send_verification_code/', $('form').serialize(), function (rsp) {
                if (rsp.msg) {
                    alert(rsp.msg)
                } else {
                    alert('请查看手机验证码!')
                    $('#verify-code-image').trigger('click')
                    $btn.attr("disabled", "true");
                    var t = setInterval(function () {
                        num -= 1
                        $btn.text(num)
                        if (num <= 0) {
                            $btn.removeAttr("disabled");
                            clearInterval(t)
                            $btn.text(tmp_text)
                        }
                    }, 1000)
                }
            }, 'json')
        })
    })

</script>
</html>
