Просмотр исходного кода

wesmiler 更新第5期更新代码合并

wesmiler 4 лет назад
Родитель
Сommit
0ba8085c8f
1 измененных файлов с 102 добавлено и 16 удалено
  1. 102 16
      public/themes/admin_simpleboot3/admin/sale.html

+ 102 - 16
public/themes/admin_simpleboot3/admin/sale.html

@@ -25,36 +25,69 @@
             }, 0);
         }
     </script>
+    <style>
+        .form-group .time {
+            cursor: pointer;
+            position: absolute;
+            right: 1px;
+            top: 1px;
+            width: 150px;
+            height: 32px;
+        }
+        .login-type {
+            color: #0b6cbc;
+            text-align: right;
+            margin-top: 10px;
+            float: right;
+            font-size: 16px;
+        }
+    </style>
 </head>
 <body>
 <div class="wrap">
     <div class="container">
         <div class="row">
             <div class="col-md-4 col-md-offset-4">
-                <h1 class="text-center">销售管理后台</h1>
+                <h1 class="text-center">销售管理后台 <a class="login-type"><span style="display: none;">账号登录</span><span>验证码登录</span></a></h1>
                 <form class="js-ajax-form" action="{:url('public/doLogin')}" method="post">
-                    <div class="form-group">
-                        <input type="text" id="input_username" class="form-control" name="username"
-                               placeholder="{:lang('USERNAME_OR_EMAIL')}" title="{:lang('USERNAME_OR_EMAIL')}"
-                               value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required="">
-                    </div>
+                    <div id="type1" class="typeBox">
+                        <div class="form-group">
+                            <input type="text" id="input_username" class="form-control" name="username"
+                                   placeholder="{:lang('USERNAME_OR_EMAIL')}" title="{:lang('USERNAME_OR_EMAIL')}"
+                                   value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required="">
+                        </div>
 
-                    <div class="form-group">
-                        <input type="password" id="input_password" class="form-control" name="password"
-                               placeholder="{:lang('PASSWORD')}" title="{:lang('PASSWORD')}" data-rule-required="true"
-                               data-msg-required="">
-                    </div>
+                        <div class="form-group">
+                            <input type="password" id="input_password" class="form-control" name="password"
+                                   placeholder="{:lang('PASSWORD')}" title="{:lang('PASSWORD')}" data-rule-required="true"
+                                   data-msg-required="">
+                        </div>
 
-                    <div class="form-group">
-                        <div style="position: relative;">
-                            <input type="text" name="captcha" placeholder="验证码" class="form-control captcha">
-                            <captcha height="32" width="150" font-size="18"
-                                     style="cursor: pointer;position:absolute;right:1px;top:1px;"/>
+                        <div class="form-group">
+                            <div style="position: relative;">
+                                <input type="text" name="captcha" placeholder="验证码" class="form-control captcha">
+                                <captcha height="32" width="150" font-size="18"
+                                         style="cursor: pointer;position:absolute;right:1px;top:1px;"/>
+                            </div>
                         </div>
                     </div>
+                    <div id="type2" class="typeBox" style="display: none;">
+                        <div class="form-group">
+                            <input type="text" id="mobile" class="form-control" name="mobile"
+                                   placeholder="{:lang('USERNAME_OR_EMAIL')}" title="{:lang('USERNAME_OR_EMAIL')}"
+                                   value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required="">
+                        </div>
 
+                        <div class="form-group">
+                            <div style="position: relative;">
+                                <input type="text" name="code" placeholder="验证码" class="form-control captcha">
+                                <button type="button" class="time" onclick="getCode()">获取验证码</button>
+                            </div>
+                        </div>
+                    </div>
                     <div class="form-group">
                         <input type="hidden" name="redirect" value="">
+                        <input id="loginType" type="hidden" name="loginType" value="1">
                         <button class="btn btn-primary btn-block js-ajax-submit" type="submit" style="margin-left: 0px"
                                 data-loadingmsg="{:lang('LOADING')}">
                             {:lang('LOGIN')}
@@ -79,10 +112,63 @@
 <script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
 <script src="__STATIC__/js/wind.js"></script>
 <script src="__STATIC__/js/admin.js"></script>
+<script src="__STATIC__/js/layer/layer.js"></script>
 <script>
     (function () {
         document.getElementById('input_username').focus();
+
+        $(".login-type span").click(function(){
+            var index = $(this).index()+1;
+            $("#loginType").val(index);
+            $(".typeBox").hide();
+            $("#type"+index).show();
+            console.log(index)
+            $(this).hide().siblings('span').show();
+        })
+
     })();
+
+    function getCode(){
+        var mobile = $("#mobile").val();
+        if(mobile=='' || mobile == null || mobile.length < 8){
+            layer.msg('请填写手机号');
+            return false;
+        }
+
+        if(time<60){
+            layer.msg('请不要频繁操作');
+            return false;
+        }
+
+        timeLock();
+        $.post("/admin/public/verifyCode", {mobile: mobile}, function(res){
+            if (res.code == 1) {
+                layer.msg(res.msg)
+            } else {
+                time = 60;
+                clearInterval(timerId);
+                $(".time").text('获取验证码');
+                layer.msg(res.msg)
+            }
+        },'json')
+
+    }
+
+    var time = 60;
+    var timerId = null;
+    function timeLock(){
+        clearInterval(timerId);
+        timerId = setInterval(function(){
+            time--;
+            if(time<=0){
+                time = 60;
+                clearInterval(timerId);
+                $(".time").text('获取验证码');
+            }else{
+                $(".time").text(time+'s');
+            }
+        },1000)
+    }
 </script>
 </body>
 </html>