password_mobile.blade.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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.password.request.email', ['utype'=>$utype])}}'">已绑定邮箱找回<div class="b-line"></div></div>
  16. <div class="clear"></div>
  17. </div>
  18. <div class="split-block"></div>
  19. <form id="getPassByMobileForm" action="{{route($sub_site."mobile.password.request")}}" method="post">
  20. {{csrf_field()}}
  21. <div class="loging-input-group">
  22. <div class="group-list mobile">
  23. <input id="mobile" name="mobile" type="text" class="l-input font14" placeholder="请输入手机号码" autocomplete="off">
  24. <a href="javascript:;" id="getVerfyCode" class="qs-btn qs-btn-inline qs-btn-medium qs-btn-border-gray font14">获取验证码</a>
  25. </div>
  26. <div class="group-list verfy">
  27. <input id="mobile_vcode" name="mobile_vcode" type="text" class="l-input font14" placeholder="请输入手机验证码" autocomplete="off">
  28. </div>
  29. </div>
  30. <div class="l-tool-bar list_height">
  31. <div class="for-pwd link_gray6"><a href="{{route("mobile.appeal")}}">账号申诉</a></div>
  32. <div class="clear"></div>
  33. </div>
  34. <input type="hidden" name="utype" value="{{$utype}}" />
  35. <input type="hidden" name="type" value="mobile" />
  36. <div id="pop" style="display:none"></div>
  37. </form>
  38. <div class="btn-spacing"><a id="nextBtn" href="javascript:;" class="qs-btn qs-btn-blue font18">下一步</a></div>
  39. @endsection
  40. @section('script')
  41. <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
  42. <script>
  43. //发送短信
  44. // var handler = function(captchaObj) {
  45. // captchaObj.appendTo("#popup-captcha");
  46. // captchaObj.onSuccess(function() {
  47. // var result = captchaObj.getValidate();
  48. // toSetSms(result);
  49. // });
  50. //
  51. // captchaObj.onError(function() {
  52. //
  53. // });
  54. // $('#getVerfyCode').on('click', function () {
  55. // if ($('#getVerfyCode').hasClass('qs-btn-border-disabled')) {
  56. // return false;
  57. // }
  58. // var mobileValue = $.trim($('input[name=mobile]').val());
  59. // if (mobileValue == '') {
  60. // qsToast({type:2,context: '请输入手机号码'});
  61. // return false;
  62. // }
  63. // if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  64. // qsToast({type:2,context: '手机号码格式不正确'});
  65. // return false;
  66. // }
  67. // if (remoteValid('mobile',mobileValue)) {
  68. // qsToast({type:2,context: '该手机号没有注册账号'});
  69. // return false;
  70. // }
  71. // captchaObj.verify();
  72. //
  73. // });
  74. // };
  75. // gt_init(handler);
  76. var captcha_callback = function(res){
  77. if(res.hasOwnProperty('errorMessage')){
  78. alert(res.errorMessage)
  79. }
  80. if(res.ret == 0){
  81. console.log('行为验证通过');
  82. $("#ticket").val(res.ticket);
  83. $("#bizState").val(res.bizState);
  84. $("#randstr").val(res.randstr);
  85. toSetSms(res);
  86. }else{
  87. console.log('用户主动关闭验证码')
  88. }
  89. console.log('callback:', res);
  90. }
  91. var captcha = new TencentCaptcha('196587903', captcha_callback, {});
  92. $('#getVerfyCode').on('click', function () {
  93. if ($('#getVerfyCode').hasClass('qs-btn-border-disabled')) {
  94. return false;
  95. }
  96. var mobileValue = $.trim($('input[name=mobile]').val());
  97. if (mobileValue == '') {
  98. qsToast({type:2,context: '请输入手机号码'});
  99. return false;
  100. }
  101. if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  102. qsToast({type:2,context: '手机号码格式不正确'});
  103. return false;
  104. }
  105. if (remoteValid('mobile',mobileValue)) {
  106. qsToast({type:2,context: '该手机号没有注册账号'});
  107. return false;
  108. }
  109. captcha.show();
  110. });
  111. // 发送手机验证码
  112. function toSetSms(geet_result) {
  113. var mobileValue = $.trim($('input[name=mobile]').val());
  114. function settime(countdown) {
  115. if (countdown == 0) {
  116. $('#getVerfyCode').removeClass('qs-btn-border-disabled');
  117. $('#getVerfyCode').text('获取验证码');
  118. countdown = 180;
  119. return;
  120. } else {
  121. $('#getVerfyCode').addClass('qs-btn-border-disabled');
  122. $('#getVerfyCode').text('重新发送' + countdown + '秒');
  123. countdown--;
  124. }
  125. setTimeout(function() {
  126. settime(countdown)
  127. },1000)
  128. }
  129. $('#getVerfyCode').prop("disabled", !0);
  130. $('#getVerfyCode').addClass('qs-btn-border-disabled');
  131. $('#getVerfyCode').text('发送中...');
  132. geet_result.mobile= mobileValue;
  133. geet_result.type= "check";
  134. $.ajax({
  135. url: "{{route('sms.send')}}",
  136. type: 'POST',
  137. dataType: 'json',
  138. data: geet_result,
  139. success: function (data) {
  140. // console.log(data);
  141. setTimeout(function() {
  142. qsToast({type:2,context: '验证码已发送,请注意查收'});
  143. // 开始倒计时
  144. var countdowns = 180;
  145. settime(countdowns);
  146. },1000)
  147. },
  148. error: function (errorData) {
  149. // console.log(errorData);
  150. var response=$.parseJSON(errorData.response);
  151. if (errorData.status==422) {//验证错误
  152. $.each(response.errors,function (key,val) {
  153. qsToast({type:2,context: val[0]});
  154. return false;
  155. });
  156. }
  157. else if(errorData.status==400) {//业务错误
  158. qsToast({type:2,context: response.message});
  159. }
  160. setTimeout(function() {
  161. $('#getVerfyCode').prop("disabled", 0);
  162. $('#getVerfyCode').removeClass('qs-btn-border-disabled');
  163. $('#getVerfyCode').text('获取验证码');
  164. },1500)
  165. }
  166. });
  167. }
  168. /**
  169. * 验证用户名等是否重复
  170. * @param validType 验证类型
  171. * @param validValue 值
  172. * @returns {boolean|*}
  173. */
  174. function remoteValid(validType, validValue){
  175. var result = false;
  176. $.ajax({
  177. url: "{{route('register.check', ['utype'=>$utype])}}",
  178. cache: false,
  179. async: false,
  180. type: 'post',
  181. dataType: 'json',
  182. data: { type: validType, param: validValue },
  183. success: function(json) {
  184. result= true;
  185. }
  186. });
  187. return result;
  188. }
  189. /**
  190. * 下一步
  191. */
  192. $('#nextBtn').on('click', function() {
  193. var mobileValue = $.trim($('input[name=mobile]').val());
  194. var mobile_vcodeValue = $.trim($('input[name=mobile_vcode]').val());
  195. if (mobileValue == '') {
  196. qsToast({type:2,context: '请输入手机号码'});
  197. return false;
  198. }
  199. if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  200. qsToast({type:2,context: '手机号码格式不正确'});
  201. return false;
  202. }
  203. if (mobile_vcodeValue == '') {
  204. qsToast({type:2,context: '请输入手机验证码'});
  205. return false;
  206. }
  207. var url = "{{route($sub_site.'mobile.password.request')}}";
  208. $.ajax({
  209. url: url,
  210. type: 'POST',
  211. dataType: 'json',
  212. data: $('#getPassByMobileForm').serialize(),
  213. success: function (data) {
  214. //qsToast({type:2,context: "注册成功,正在为你跳转.."});
  215. setTimeout(function () {
  216. window.location.href = data.data.url;
  217. },1000)
  218. },
  219. error:function(errorData) {
  220. //$('#btnRegPersonal').text('注册个人会员').removeClass('btn_disabled').prop('disabled', 0);
  221. var response=$.parseJSON(errorData.response);
  222. if (errorData.status==422) {//验证错误
  223. $.each(response.errors,function (key,val) {
  224. qsToast({type:2,context: val[0]});
  225. return false;
  226. });
  227. }
  228. else if(errorData.status==400) {//业务错误
  229. qsToast({type:2,context: response.message});
  230. }
  231. }
  232. });
  233. })
  234. </script>
  235. @endsection