Browse Source

enter登录

313392073 5 years ago
parent
commit
2eb5b0b11c
3 changed files with 68 additions and 8 deletions
  1. 65 7
      page/login.html
  2. 2 1
      page/user/billcb.html
  3. 1 0
      page/user/billjf.html

+ 65 - 7
page/login.html

@@ -32,7 +32,7 @@
                     <img class="img-code" onclick="changePic()" id="img-code" src="http://htt.55128.cn/Util/VerifyCode?0.49822945461860857" alt="">
                 </div>
                 <div class="form-button">
-                    <button id="btn">登录</button>
+                    <button id="btn" onclick="submitForm()">登录</button>
                 </div>
             </div>
         </div>
@@ -62,12 +62,12 @@
                 return;
             }
         })
-        $("#btn").on("click",function() {
+        function submitForm() {
             var username = $.trim($("#username").val());
             var pwd = $.trim($("#pwd").val());
             var code = $.trim($("#code").val());
             var uregs = /^[a-zA-Z0-9]{4,12}$/
-            var pregs = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/
+            var pregs = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/;
             if(!uregs.test(username) || username == ''){
                 layer.tips('请输入正确的用户名格式',$("#username"));
                 $("#username").focus();
@@ -90,16 +90,74 @@
             }
             $.ajax({
                 type:'post',
-                url:'',
+                url:'/Login/CheckLogin',
                 dataType:'json',
-                data:{'username':username,'pwd':pwd,'code':code},
+                data: { 'username': username, 'password': pwd,'verifycode':code},
                 success:function(res) {
-                    if(res.code == 0) {
-                        window.location.href = './index.html'
+                    if (res.code == 0) {
+                        window.location.href = '/Login/Index';
+                    } else {
+                        layer.msg("登录失败", { icon: 5 });
+                        changePic();
+                        $("#code").val("");
                     }
+                },
+                error:function() {
+                    layer.msg("登录失败", { icon: 6 });
+                    changePic();
+                    $("#code").val("");
                 }
             })
+        }
+
+        $(function() {
+            document.onkeydown = function (e) { // 回车提交表单
+                var theEvent = window.event || e;
+                var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
+                if (code == 13) {
+                    submitForm();
+                }
+            }
         })
+
+        // $("#btn").on("click",function() {
+        //     var username = $.trim($("#username").val());
+        //     var pwd = $.trim($("#pwd").val());
+        //     var code = $.trim($("#code").val());
+        //     var uregs = /^[a-zA-Z0-9]{4,12}$/
+        //     var pregs = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/
+        //     if(!uregs.test(username) || username == ''){
+        //         layer.tips('请输入正确的用户名格式',$("#username"));
+        //         $("#username").focus();
+        //         return;
+        //     }
+        //     if(!pregs.test(pwd) || pwd == ''){
+        //         layer.tips('请输入正确的密码格式',$("#pwd"));
+        //         $("#pwd").focus();
+        //         return;
+        //     }
+        //     if(code == '') {
+        //         layer.tips('请输入验证码',$("#code"));
+        //         $("#code").focus();
+        //         return;
+        //     }
+        //     if(code.length != 4) {
+        //         layer.tips('请输入合法的验证码',$("#code"));
+        //         $("#code").focus();
+        //         return;
+        //     }
+        //     $.ajax({
+        //         type:'post',
+        //         url:'',
+        //         dataType:'json',
+        //         data:{'username':username,'pwd':pwd,'code':code},
+        //         success:function(res) {
+        //             if(res.code == 0) {
+        //                 window.location.href = './index.html'
+        //             }
+        //         }
+        //     })
+        // })
     </script>
 </body>
 </html>

+ 2 - 1
page/user/billcb.html

@@ -266,7 +266,7 @@
                                         <option value="0">请选择打赏类型</option>
                                         <option value="1">作者打赏</option>
                                         <option value="2">文章打赏</option>
-                                        <option value="3">指标打赏</option>
+                                        <option value="3">文章指标打赏</option>
                                     </select>
                                 </div>
                                 <span class="searchname">文章类型:</span>
@@ -365,6 +365,7 @@
                     39: '蓝球杀三',
                     40: '蓝球杀五',
                     41: '蓝球定三',
+                    54: '蓝球定四',
                     42: '蓝球定五',
                 }
             },

+ 1 - 0
page/user/billjf.html

@@ -334,6 +334,7 @@
                     39: '蓝球杀三',
                     40: '蓝球杀五',
                     41: '蓝球定三',
+                    54: '蓝球定四',
                     42: '蓝球定五',
                 }
             },