login_back.blade.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. @extends('mobile.module.layouts.content')
  2. @push('meta')
  3. @endpush
  4. @push('css')
  5. <link href="{{ theme_asset('mobile/css/members.css') }}" rel="stylesheet">
  6. @endpush
  7. @push('js')
  8. <script type="text/javascript" src="{{ theme_asset('gt/gt.js') }}"></script>
  9. <script type="text/javascript" src="{{ theme_asset('gt/gt.handle.js') }}"></script>
  10. <script src="https://captcha.253.com/TCaptcha.js"></script>
  11. @endpush
  12. @section('content')
  13. <div class="qs-top-nav x2 list_height">
  14. <div class="n-cell active">账号密码登录<div class="b-line"></div></div>
  15. <div class="n-cell" onclick="javascript:location.href='{{route($sub_site.'mobile.login.mobile')}}'">手机动态码登录<div class="b-line"></div></div>
  16. <div class="clear"></div>
  17. </div>
  18. <div class="split-block"></div>
  19. <form method="post" id="form_account" action="{{route($sub_site.'mobile.login')}}">
  20. <input type="hidden" name="ticket" id="ticket">
  21. <input type="hidden" name="bizState" id="bizState">
  22. <input type="hidden" name="randstr" id="randstr">
  23. {{ csrf_field() }}
  24. <div class="loging-input-group">
  25. <div class="group-list">
  26. <div class="g-close"></div>
  27. <input id="account" name="account" type="text" class="l-input j-l-input font14" placeholder="请输入用户名/手机/邮箱" autocomplete="off">
  28. </div>
  29. <div class="group-list pwd">
  30. <div class="g-close"></div>
  31. <input id="password" name="password" type="text" onfocus="this.type='password'" class="l-input j-l-input font14" placeholder="请输入密码" autocomplete="off">
  32. </div>
  33. </div>
  34. <div class="l-tool-bar list_height">
  35. <div class="auto-loging">
  36. <div class="for-checkbox active" id="for-checkbox">下次自动登录</div>
  37. </div>
  38. <div class="for-pwd link_gray6"><a href="{{route($sub_site.'mobile.password.request')}}">忘记密码</a></div>
  39. <div class="clear"></div>
  40. </div>
  41. <div id="pop" style="display:none"></div>
  42. <input type="hidden" name="autoLogin" id="autoLogin" value="1" >
  43. </form>
  44. <div class="btn-spacing login-account"><a id="loginBtn" href="javascript:;" class="qs-btn qs-btn-blue font18">登录</a></div>
  45. <div class="qs-center login-btn-group">
  46. <div class="login-btn-group-box">
  47. <a url="{{route($sub_site.'mobile.register.index')}}" class="qs-btn qs-btn-medium qs-btn-border-orange font14 register_user" url="{{route($sub_site.'register.index')}}" href="javascript:;" style="width: 2.45rem;">立即注册</a>
  48. <a href="{{route($sub_site.'mobile.login.company')}}" class="qs-btn qs-btn-medium qs-btn-border-blue font14" style="width: 2.45rem;margin-left: .5rem">企业用户登录</a>
  49. <div class="clear"></div>
  50. </div>
  51. </div>
  52. <div class="qs-center coop-title">使用合作账号登录/注册</div>
  53. <div class="coop-group qs-center" >
  54. <div class="coop-cell" id="other-thirdlogin">
  55. </div>
  56. <div class="clear"></div>
  57. </div>
  58. @endsection
  59. @section('script')
  60. @include('mobile.module.widgets.thirdlogin')
  61. <script>
  62. $(function () {
  63. $(".register_user").click(function(){
  64. var url=$(this).attr("url")
  65. $.getJSON("{{route($sub_site.'register.status')}}", function (result) {
  66. if (result.status == 0) {
  67. qsToast({type:2,context: result.msg});
  68. } else{
  69. location.href=url;
  70. }
  71. });
  72. })
  73. //gt_init(gt_call_back);//初始化极验
  74. var captcha_callback = function(res){
  75. if(res.hasOwnProperty('errorMessage')){
  76. alert(res.errorMessage)
  77. }
  78. if(res.ret == 0){
  79. console.log('行为验证通过');
  80. $("#ticket").val(res.ticket);
  81. $("#bizState").val(res.bizState);
  82. $("#randstr").val(res.randstr);
  83. ajax_login();
  84. }else{
  85. console.log('用户主动关闭验证码')
  86. }
  87. console.log('callback:', res);
  88. };
  89. var captcha = new TencentCaptcha('196587903', captcha_callback, {});
  90. $('.login-account').on('click', function () {
  91. var usernameValue = $.trim($('input[name=account]').val());
  92. var passwordValue = $.trim($('input[name=password]').val());
  93. if (usernameValue == '') {
  94. qsToast({type:2,context: '请输入用户名/手机号'});
  95. return false;
  96. }
  97. if (passwordValue == '') {
  98. qsToast({type:2,context: '请输入密码'});
  99. return false;
  100. }
  101. //ajax_login(1);
  102. captcha.show();
  103. });
  104. // 自动登录
  105. $('#for-checkbox').on('click', function() {
  106. $(this).toggleClass('active');
  107. if ($(this).hasClass('active')) {
  108. $('#autoLogin').val('1');
  109. } else {
  110. $('#autoLogin').val('0');
  111. }
  112. })
  113. function ajax_login() {
  114. $.ajax({
  115. type: 'post',
  116. url: $("#form_account").attr('action'),
  117. data: $("#form_account").serialize(),
  118. beforeSend:function () {
  119. //console.log('请求开始');
  120. },
  121. complete:function() {
  122. //console.log('请求结束');
  123. },
  124. success: function (data) {
  125. //console.log(data);
  126. qsToast({type:2,context: "登录成功, 正在跳转..."});
  127. location.href=data.data.redirect_url+'?token='+data.data.token;
  128. },
  129. error: function (errorData) {
  130. //console.log(errorData);
  131. var response=$.parseJSON(errorData.response);
  132. if (errorData.status==422) {//验证错误
  133. $.each(response.errors,function (key,val) {
  134. qsToast({type:2,context: val[0]});
  135. return false;
  136. });
  137. }
  138. else if(errorData.status==400) {//业务错误
  139. qsToast({type:2,context: response.message});
  140. }
  141. }
  142. });
  143. };
  144. });
  145. $('.gohome').on('click', function () {
  146. location.href="{{route($sub_site.'home')}}";
  147. });
  148. </script>
  149. @endsection