Browse Source

验证码

linwu 2 days ago
parent
commit
d7708590cd
1 changed files with 40 additions and 0 deletions
  1. 40 0
      public/themes/default/views/mobile/app/auth/login_mobile.blade.php

+ 40 - 0
public/themes/default/views/mobile/app/auth/login_mobile.blade.php

@@ -108,7 +108,47 @@
                 if ($('#getVerfyCode').hasClass('qs-btn-border-disabled')) {
                     return false;
                 }
+                submit_data={
+                    "mobile":$("input[name='mobile']").val(),
+                    "type":"login",
+                };
+                $.ajax({
+                    type: 'post',
+                    url: '{{route('sms.send')}}',
+                    data: submit_data,
+                    beforeSend:function () {
+                        // console.log('请求开始');
+                        // $(".errinfo").text("");
+                        // $(".errinfo").removeClass("errinfo");
 
+                    },
+                    complete:function() {
+                        console.log('请求结束');
+                    },
+                    success: function (data) {
+                        // console.log(data);
+                        qsToast({type:2,context: '验证码已发送,请注意查收'});
+                        settime();
+                    },
+                    error: function (errorData) {
+                        // console.log(errorData);
+                        if (countdown == 60) {
+                            $('#getVerfyCode').removeClass('qs-btn-border-disabled');
+                            $('#getVerfyCode').text('获取验证码');
+                        }
+                        var response=$.parseJSON(errorData.response);
+                        if (errorData.status==422) {//验证错误
+                            $.each(response.errors,function (key,val) {
+                                qsToast({type:2,context: val[0]});
+                                return false;
+                            });
+                        }
+                        else if(errorData.status==400) {//业务错误
+                            qsToast({type:2,context: response.message});
+                            //is_need_geetest=response.errors.is_need_geetest;
+                        }
+                    }
+                });
             });
 
             $('.login-mobile').on('click', function () {