|
@@ -11,6 +11,7 @@
|
|
|
@push('js')
|
|
|
<script type="text/javascript" src="{{ theme_asset('gt/gt.js') }}"></script>
|
|
|
<script type="text/javascript" src="{{ theme_asset('gt/gt.handle.js') }}"></script>
|
|
|
+ <script src="https://captcha.253.com/TCaptcha.js"></script>
|
|
|
@endpush
|
|
|
|
|
|
@section('content')
|
|
@@ -28,6 +29,9 @@
|
|
|
<div class="user-login">
|
|
|
<form id="form_company" action="{{route('login.company')}}" method="post">
|
|
|
{{ csrf_field() }}
|
|
|
+ <input type="hidden" name="ticket" id="ticket">
|
|
|
+ <input type="hidden" name="bizState" id="bizState">
|
|
|
+ <input type="hidden" name="randstr" id="randstr">
|
|
|
<div id="company_account"></div>
|
|
|
<div id="message_company"></div>
|
|
|
<div class="form-group yhm">
|
|
@@ -76,61 +80,83 @@
|
|
|
@include('module.widgets.thirdlogin')
|
|
|
<script>
|
|
|
$(function () {
|
|
|
- var is_need_geetest=0;//全局,是否使用极验.
|
|
|
- var login_type=1;//登录模式,1用户账号登录,2用户手机登录,3企业登录.
|
|
|
- var gt_call_back=function(captchaObj) {
|
|
|
- captchaObj.onReady(function () {
|
|
|
- //极验加载完成
|
|
|
- });
|
|
|
- captchaObj.onSuccess(function () {
|
|
|
- ajax_login(login_type,captchaObj);
|
|
|
-
|
|
|
- });
|
|
|
- captchaObj.onError(function () {
|
|
|
- show_error(login_type,"请先进行验证");
|
|
|
- });
|
|
|
- captchaObj.onClose(function () {
|
|
|
- show_error(login_type,"请先进行验证");
|
|
|
- });
|
|
|
- $('.login-account').on('click', function () {
|
|
|
- login_type=1;
|
|
|
- //clean_message();
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.bindForm("#form_account");
|
|
|
- captchaObj.verify();
|
|
|
- }
|
|
|
- else{
|
|
|
- ajax_login(login_type,captchaObj);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- $('.login-mobile').on('click', function () {
|
|
|
- login_type=2;
|
|
|
- //clean_message();
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.bindForm("#form_mobile");
|
|
|
- captchaObj.verify();
|
|
|
- }
|
|
|
- else{
|
|
|
- ajax_login(login_type,captchaObj);
|
|
|
- }
|
|
|
- });
|
|
|
+ //var is_need_geetest=0;//全局,是否使用极验.
|
|
|
+ //var login_type=1;//登录模式,1用户账号登录,2用户手机登录,3企业登录.
|
|
|
+ // var gt_call_back=function(captchaObj) {
|
|
|
+ // captchaObj.onReady(function () {
|
|
|
+ // //极验加载完成
|
|
|
+ // });
|
|
|
+ // captchaObj.onSuccess(function () {
|
|
|
+ // ajax_login(login_type,captchaObj);
|
|
|
+ //
|
|
|
+ // });
|
|
|
+ // captchaObj.onError(function () {
|
|
|
+ // show_error(login_type,"请先进行验证");
|
|
|
+ // });
|
|
|
+ // captchaObj.onClose(function () {
|
|
|
+ // show_error(login_type,"请先进行验证");
|
|
|
+ // });
|
|
|
+ // $('.login-account').on('click', function () {
|
|
|
+ // login_type=1;
|
|
|
+ // //clean_message();
|
|
|
+ // if (is_need_geetest==1){
|
|
|
+ // captchaObj.bindForm("#form_account");
|
|
|
+ // captchaObj.verify();
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // ajax_login(login_type,captchaObj);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // $('.login-mobile').on('click', function () {
|
|
|
+ // login_type=2;
|
|
|
+ // //clean_message();
|
|
|
+ // if (is_need_geetest==1){
|
|
|
+ // captchaObj.bindForm("#form_mobile");
|
|
|
+ // captchaObj.verify();
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // ajax_login(login_type,captchaObj);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // $('.login-company').on('click', function () {
|
|
|
+ // login_type=3;
|
|
|
+ // //clean_message();
|
|
|
+ // if (is_need_geetest==1){
|
|
|
+ // captchaObj.bindForm("#form_company");
|
|
|
+ // captchaObj.verify();
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // ajax_login(login_type,captchaObj);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ //
|
|
|
+ // gt_init(gt_call_back);//初始化极验
|
|
|
+
|
|
|
+ var captcha_callback = function(res){
|
|
|
+ if(res.hasOwnProperty('errorMessage')){
|
|
|
+ alert(res.errorMessage)
|
|
|
+ }
|
|
|
+ if(res.ret == 0){
|
|
|
+ console.log('行为验证通过');
|
|
|
+ $("#ticket").val(res.ticket);
|
|
|
+ $("#bizState").val(res.bizState);
|
|
|
+ $("#randstr").val(res.randstr);
|
|
|
+ ajax_login();
|
|
|
+ }else{
|
|
|
+ console.log('用户主动关闭验证码')
|
|
|
+ }
|
|
|
+ console.log('callback:', res);
|
|
|
+ }
|
|
|
|
|
|
- $('.login-company').on('click', function () {
|
|
|
- login_type=3;
|
|
|
- //clean_message();
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.bindForm("#form_company");
|
|
|
- captchaObj.verify();
|
|
|
- }
|
|
|
- else{
|
|
|
- ajax_login(login_type,captchaObj);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
+ var captcha = new TencentCaptcha('196587903', captcha_callback, {});
|
|
|
+ $('.login-company').on('click', function () {
|
|
|
+ captcha.show();
|
|
|
+ });
|
|
|
|
|
|
- gt_init(gt_call_back);//初始化极验
|
|
|
|
|
|
$(".input-login").keydown(function(ev){
|
|
|
ev = ev || window.event;
|
|
@@ -186,134 +212,47 @@
|
|
|
});
|
|
|
|
|
|
|
|
|
- function ajax_login(type, captchaObj) {
|
|
|
- if (type==1) {
|
|
|
- $.ajax({
|
|
|
- method: 'post',
|
|
|
- url: $("#form_account").attr('action'),
|
|
|
- data: $("#form_account").serialize(),
|
|
|
- beforeSend:function () {
|
|
|
- //console.log('请求开始');
|
|
|
- clean_message();
|
|
|
- $('.login-account').addClass("btn-disabled").prop('disabled', true);
|
|
|
- $('.login-account').val("登录中...");
|
|
|
-
|
|
|
- },
|
|
|
- complete:function() {
|
|
|
- //console.log('请求结束');
|
|
|
- $('.login-account').val("登录");
|
|
|
- $('.login-account').removeClass("btn-disabled").prop('disabled', false);
|
|
|
-
|
|
|
- },
|
|
|
- success: function (data) {
|
|
|
- //console.log(data);
|
|
|
- $("#message_account").addClass("successinfo");
|
|
|
- $("#message_account").text("登录成功, 正在跳转...");
|
|
|
- location.href=data.data.redirect_url;
|
|
|
- },
|
|
|
- error: function (errorData) {
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.reset();
|
|
|
- }
|
|
|
- if (errorData.status==422) {//验证错误
|
|
|
- $.each(errorData.responseJSON.errors,function (key,val) {
|
|
|
- $("#"+key).addClass("errinfo");
|
|
|
- $("#"+key).text(val[0]);
|
|
|
- });
|
|
|
- }
|
|
|
- else if(errorData.status==400) {//业务错误
|
|
|
- $("#message_account").addClass("errinfo");
|
|
|
- $("#message_account").text(errorData.responseJSON.message);
|
|
|
- is_need_geetest=errorData.responseJSON.errors.is_need_geetest;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- else if (type==2) {
|
|
|
- $.ajax({
|
|
|
- method: 'post',
|
|
|
- url: $("#form_mobile").attr('action'),
|
|
|
- data: $("#form_mobile").serialize(),
|
|
|
- beforeSend:function () {
|
|
|
- //console.log('请求开始');
|
|
|
- clean_message();
|
|
|
- $('.login-mobile').addClass("btn-disabled").prop('disabled', true);
|
|
|
- $('.login-mobile').val("登录中...");
|
|
|
-
|
|
|
- },
|
|
|
- complete:function() {
|
|
|
- //console.log('请求结束');
|
|
|
- $('.login-mobile').val("登录");
|
|
|
- $('.login-mobile').removeClass("btn-disabled").prop('disabled', false);
|
|
|
- },
|
|
|
- success: function (data) {
|
|
|
- //console.log(data);
|
|
|
- $("#message_mobile").addClass("successinfo");
|
|
|
- $("#message_mobile").text("登录成功, 正在跳转...");
|
|
|
- location.href=data.data.redirect_url;
|
|
|
- },
|
|
|
- error: function (errorData) {
|
|
|
- //console.log(errorData);
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.reset();
|
|
|
- }
|
|
|
- if (errorData.status==422) {//验证错误
|
|
|
- $.each(errorData.responseJSON.errors,function (key,val) {
|
|
|
- $("#"+key).addClass("errinfo");
|
|
|
- $("#"+key).text(val[0]);
|
|
|
- });
|
|
|
- }
|
|
|
- else if(errorData.status==400) {//业务错误
|
|
|
- $("#message_mobile").addClass("errinfo");
|
|
|
- $("#message_mobile").text(errorData.responseJSON.message);
|
|
|
- is_need_geetest=errorData.responseJSON.errors.is_need_geetest;
|
|
|
- }
|
|
|
+ function ajax_login(type) {
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ method: 'post',
|
|
|
+ url: $("#form_company").attr('action'),
|
|
|
+ data: $("#form_company").serialize(),
|
|
|
+ beforeSend:function () {
|
|
|
+ //console.log('请求开始');
|
|
|
+ clean_message();
|
|
|
+ $('.login-company').addClass("btn-disabled").prop('disabled', true);
|
|
|
+ $('.login-company').val("登录中...");
|
|
|
+
|
|
|
+ },
|
|
|
+ complete:function() {
|
|
|
+ //console.log('请求结束');
|
|
|
+ $('.login-company').val("登录");
|
|
|
+ $('.login-company').removeClass("btn-disabled").prop('disabled', false);
|
|
|
+
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ //console.log(data);
|
|
|
+ $("#message_company").addClass("successinfo");
|
|
|
+ $("#message_company").text("登录成功, 正在跳转...");
|
|
|
+ location.href=data.data.redirect_url;
|
|
|
+ },
|
|
|
+ error: function (errorData) {
|
|
|
+ //console.log(errorData);
|
|
|
+
|
|
|
+ if (errorData.status==422) {//验证错误
|
|
|
+ $.each(errorData.responseJSON.errors,function (key,val) {
|
|
|
+ $("#"+key).addClass("errinfo");
|
|
|
+ $("#"+key).text(val[0]);
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- else if (type==3){
|
|
|
- $.ajax({
|
|
|
- method: 'post',
|
|
|
- url: $("#form_company").attr('action'),
|
|
|
- data: $("#form_company").serialize(),
|
|
|
- beforeSend:function () {
|
|
|
- //console.log('请求开始');
|
|
|
- clean_message();
|
|
|
- $('.login-company').addClass("btn-disabled").prop('disabled', true);
|
|
|
- $('.login-company').val("登录中...");
|
|
|
-
|
|
|
- },
|
|
|
- complete:function() {
|
|
|
- //console.log('请求结束');
|
|
|
- $('.login-company').val("登录");
|
|
|
- $('.login-company').removeClass("btn-disabled").prop('disabled', false);
|
|
|
-
|
|
|
- },
|
|
|
- success: function (data) {
|
|
|
- //console.log(data);
|
|
|
- $("#message_company").addClass("successinfo");
|
|
|
- $("#message_company").text("登录成功, 正在跳转...");
|
|
|
- location.href=data.data.redirect_url;
|
|
|
- },
|
|
|
- error: function (errorData) {
|
|
|
- //console.log(errorData);
|
|
|
- if (is_need_geetest==1){
|
|
|
- captchaObj.reset();
|
|
|
- }
|
|
|
- if (errorData.status==422) {//验证错误
|
|
|
- $.each(errorData.responseJSON.errors,function (key,val) {
|
|
|
- $("#"+key).addClass("errinfo");
|
|
|
- $("#"+key).text(val[0]);
|
|
|
- });
|
|
|
- }
|
|
|
- else if(errorData.status==400) {//业务错误
|
|
|
- $("#message_company").addClass("errinfo");
|
|
|
- $("#message_company").text(errorData.responseJSON.message);
|
|
|
- is_need_geetest=errorData.responseJSON.errors.is_need_geetest;
|
|
|
- }
|
|
|
+ else if(errorData.status==400) {//业务错误
|
|
|
+ $("#message_company").addClass("errinfo");
|
|
|
+ $("#message_company").text(errorData.responseJSON.message);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function show_error(type,message) {
|