thirdlogin_binding_new.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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. @endpush
  11. @section('content')
  12. <div class="split-block"></div>
  13. <div class="bind-top-box qs-center">
  14. @if('wechat' == $type)
  15. <img src="{{session('wechatUser.headimgurl')}}" class="b-img">
  16. <div class="b-nickname">{{session('wechatUser.nickname')}}</div>
  17. @else
  18. <img src="{{session('qqUser.figureurl_qq_1')}}" class="b-img">
  19. <div class="b-nickname">{{session('qqUser.nickname')}}</div>
  20. @endif
  21. <div class="font12 txt-color-9">您已登录{{$type_name}}账号</div>
  22. </div>
  23. <div class="split-block"></div>
  24. <div class="b-list-group-tip">
  25. <div class="txt-color-3">注册并绑定新账号</div>
  26. <div class="link_blue font12 txt-color-9">如果您已有{{subsite_config('aix.system.site.site.site_name')}}账号,请<a href="{{route($sub_site.'mobile.auth.thirdlogin.bind', ['login_type'=>$type])}}">立即绑定</a></div>
  27. </div>
  28. <div class="qs-top-nav x2 list_height">
  29. <div class="n-cell active">注册个人账号<div class="b-line"></div></div>
  30. <div class="n-cell" onclick="javascript:location.href='{{route($sub_site.'mobile.auth.thirdlogin.bind.new.company', ['login_type'=>$type])}}'">注册企业账号<div class="b-line"></div></div>
  31. <div class="clear"></div>
  32. </div>
  33. <div class="split-block"></div>
  34. <form action="{{route($sub_site.'mobile.auth.thirdlogin.bind.new.post', ['login_type'=>$type, 'utype'=>2])}}" method="post" id="regMobileForm">
  35. {{csrf_field()}}
  36. <div class="loging-input-group">
  37. <div class="group-list id_card">
  38. <input id="id_card" name="id_card" type="text" class="l-input font14" placeholder="请输入身份证号码" autocomplete="off">
  39. </div>
  40. <div class="group-list had-remind-box1 qs-center link_blue" style="display: none;background-image:none;padding: 0px;background: rgba(255,214,0,0.14);font-weight: 400;"></div>
  41. <div class="group-list mobile">
  42. <input id="mobile" name="mobile" type="text" class="l-input font14" placeholder="请输入手机号码" autocomplete="off" value="">
  43. <a href="javascript:;" id="getVerfyCode" class="qs-btn qs-btn-inline qs-btn-medium qs-btn-border-gray font14">获取验证码</a>
  44. </div>
  45. <div class="group-list had-remind-box qs-center link_blue" onclick="javascript:location.href='{{route($sub_site.'mobile.login')}}'"><a href="javascript:;"><span class="mal"></span><span class="txt-o-red">点击立即登录</span></a></div>
  46. <div class="group-list verfy">
  47. <input id="mobile_vcode" name="mobile_vcode" type="text" class="l-input font14" placeholder="请输入手机验证码" autocomplete="off">
  48. </div>
  49. <div class="group-list pwd">
  50. <input id="password" name="password" type="password" class="l-input font14" placeholder="请输入账户密码" autocomplete="off">
  51. </div>
  52. <div class="group-list pwd">
  53. <input id="password_confirmation" name="password_confirmation" type="password" class="l-input font14" placeholder="请确认账户密码" autocomplete="off">
  54. </div>
  55. </div>
  56. <div class="l-tool-bar list_height">
  57. <div class="read-agreement">
  58. <div class="for-checkbox active" id="for-checkbox">我已阅读并同意
  59. </div>
  60. </div>
  61. <div class="agreement link_gray6"><a href="#userAgreenment" id="reg_agreement">《用户服务协议》</a></div>
  62. <div class="clear"></div>
  63. </div>
  64. <div class="split-block"></div>
  65. <div class="btn-spacing btn-spacing-nmb"><a id="btnRegPersonal" href="javascript:;" class="qs-btn qs-btn-blue font18">注册并绑定</a></div>
  66. <input type="hidden" name="reg_type" value="1" />
  67. <input type="hidden" name="utype" value="2" />
  68. <input type="hidden" name="reg_source" value="2" />
  69. <input type="hidden" name="agreement" value="1" />
  70. </form>
  71. <input type="hidden" id="J_config_varify_reg" value="1"/>
  72. <!--用户服务协议-->
  73. <script type="text/html" id="agreementTxt">
  74. <div class="headernavfixed">
  75. <div class="headernav font18"><div class="title">用户服务协议<div class="return js-back"></div><div class="rbtn"></div></div></div>
  76. </div>
  77. <div class="agreement-content">{!! str_replace(["\r\n","\n"], ["",""], config('aix.system.register_agreement.register_agreement.reg_agreement')) !!}</div>
  78. </script>
  79. @endsection
  80. @section('script')
  81. <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
  82. <script type="text/javascript" src="{{ theme_asset('mobile/js/popWin.js') }}"></script>
  83. <script>
  84. // 用户服务协议
  85. $('#for-checkbox').on('click', function() {
  86. $(this).toggleClass('active');
  87. if ($(this).hasClass('active')) {
  88. $('input[name=agreement]').val(1);
  89. } else {
  90. $('input[name=agreement]').val(0);
  91. }
  92. })
  93. var agreementTemp = $('#agreementTxt').html();
  94. $("#reg_agreement").on("click",function(){
  95. popWin.init({
  96. from:"right",
  97. html:agreementTemp,
  98. handle:function (a) {
  99. }
  100. })
  101. });
  102. var config_varify_reg = eval($('#J_config_varify_reg').val());
  103. // 配置极验
  104. if (config_varify_reg) {
  105. //手机注册
  106. var handlerRegMobile = function(captchaObj) {
  107. captchaObj.bindForm("#regMobileForm");
  108. captchaObj.onSuccess(function() {
  109. regPerByMobileHandler();
  110. });
  111. captchaObj.onError(function() {
  112. });
  113. $('#btnRegPersonal').on('click', function () {
  114. var id_cardValue = $.trim($('input[name=id_card]').val());
  115. var mobileValue = $.trim($('input[name=mobile]').val());
  116. var verifycodeValue = $.trim($('input[name=mobile_vcode]').val());
  117. var passwordValue = $.trim($('input[name=password]').val());
  118. var password_confirmation = $.trim($('input[name=password_confirmation]').val());
  119. if (id_cardValue == '') {
  120. qsToast({type:2,context: '请输入身份证号码'});
  121. return false;
  122. }
  123. if(!validateIdCard(id_cardValue)) {
  124. qsToast({type:2,context: '身份证格式不正确'});
  125. return false;
  126. }
  127. if (mobileValue == '') {
  128. qsToast({type:2,context: '请输入手机号码'});
  129. return false;
  130. }
  131. if (mobileValue != "" && !regularMobile.test(mobileValue)) {
  132. qsToast({type:2,context: '手机号码格式不正确'});
  133. return false;
  134. }
  135. if (verifycodeValue == '') {
  136. qsToast({type:2,context: '请输入手机验证码'});
  137. return false;
  138. }
  139. if (passwordValue == '') {
  140. qsToast({type:2,context: '请输入密码'});
  141. return false;
  142. }
  143. if(!inputRegValiPassword(passwordValue)){
  144. qsToast({type:2,context: '密码长度要求为6-16个字符'});
  145. return false;
  146. }
  147. if (passwordValue != password_confirmation) {
  148. qsToast({type:2,context: '两次密码不一致'});
  149. return false;
  150. }
  151. captchaObj.verify();
  152. });
  153. };
  154. //发送短信
  155. var handler = function(captchaObj) {
  156. captchaObj.appendTo("#popup-captcha");
  157. captchaObj.onSuccess(function() {
  158. var result = captchaObj.getValidate();
  159. toSetSms(result);
  160. });
  161. captchaObj.onError(function() {
  162. });
  163. $('#getVerfyCode').on('click', function () {
  164. if ($('#getVerfyCode').hasClass('qs-btn-border-disabled')) {
  165. return false;
  166. }
  167. var mobileValue = $.trim($('input[name=mobile]').val());
  168. if (mobileValue == '') {
  169. qsToast({type:2,context: '请输入手机号'});
  170. return false;
  171. }
  172. if (!regularMobile.test(mobileValue)) {
  173. qsToast({type:2,context: '手机号码格式不正确'});
  174. return false;
  175. }
  176. captchaObj.verify();
  177. });
  178. };
  179. gt_init(handlerRegMobile);
  180. gt_init(handler);
  181. }
  182. $('input[name=id_card]').keyup(function () {
  183. var currentValue = $(this).val();
  184. if (currentValue.length >= 18) {
  185. if(validateIdCard(currentValue) && !remoteValid('id_card',currentValue)) {
  186. $('.had-remind-box1').text('身份证 ' + currentValue + ' 已注册');
  187. $('.had-remind-box1').show();
  188. } else {
  189. $('.had-remind-box1').hide();
  190. }
  191. } else {
  192. $('.had-remind-box1').hide();
  193. }
  194. });
  195. $('input[name=mobile]').keyup(function () {
  196. var currentValue = $(this).val();
  197. if (currentValue.length >= 11) {
  198. if(regularMobile.test(currentValue) && !remoteValid('mobile',currentValue)) {
  199. $('.had-remind-box .mal').text('手机号 ' + currentValue + ' 已注册,');
  200. $('.had-remind-box').show();
  201. } else {
  202. $('.had-remind-box').hide();
  203. }
  204. } else {
  205. $('.had-remind-box').hide();
  206. }
  207. });
  208. // 发送手机验证码
  209. function toSetSms(geet_result) {
  210. var mobileValue = $.trim($('input[name=mobile]').val());
  211. function settime(countdown) {
  212. if (countdown == 0) {
  213. $('#getVerfyCode').removeClass('qs-btn-border-disabled');
  214. $('#getVerfyCode').text('获取验证码');
  215. countdown = 180;
  216. return;
  217. } else {
  218. $('#getVerfyCode').addClass('qs-btn-border-disabled');
  219. $('#getVerfyCode').text('重新发送' + countdown + '秒');
  220. countdown--;
  221. }
  222. setTimeout(function() {
  223. settime(countdown)
  224. },1000)
  225. }
  226. $('#getVerfyCode').prop("disabled", !0);
  227. $('#getVerfyCode').addClass('qs-btn-border-disabled');
  228. $('#getVerfyCode').text('发送中...');
  229. geet_result.mobile= mobileValue;
  230. geet_result.type= "register";
  231. $.ajax({
  232. url: "{{route($sub_site.'sms.send')}}",
  233. type: 'POST',
  234. dataType: 'json',
  235. data: geet_result,
  236. success: function (data) {
  237. // console.log(data);
  238. setTimeout(function() {
  239. qsToast({type:2,context: '验证码已发送,请注意查收'});
  240. // 开始倒计时
  241. var countdowns = 180;
  242. settime(countdowns);
  243. },1000)
  244. },
  245. error: function (errorData) {
  246. // console.log(errorData);
  247. var response=$.parseJSON(errorData.response);
  248. if (errorData.status==422) {//验证错误
  249. $.each(response.errors,function (key,val) {
  250. qsToast({type:2,context: val[0]});
  251. return false;
  252. });
  253. }
  254. else if(errorData.status==400) {//业务错误
  255. qsToast({type:2,context: response.message});
  256. }
  257. setTimeout(function() {
  258. $('#getVerfyCode').prop("disabled", 0);
  259. $('#getVerfyCode').removeClass('qs-btn-border-disabled');
  260. $('#getVerfyCode').text('获取验证码');
  261. },1500)
  262. }
  263. });
  264. }
  265. // 个人手机注册处理程序
  266. function regPerByMobileHandler() {
  267. $('#btnRegPersonal').text('注册中...').addClass('btn_disabled').prop('disabled', !0);
  268. $.ajax({
  269. url: "{{route($sub_site.'mobile.auth.thirdlogin.bind.new.post', ['login_type'=>$type, 'utype'=>2])}}",
  270. type: 'POST',
  271. dataType: 'json',
  272. data: $('#regMobileForm').serialize(),
  273. success: function (data) {
  274. qsToast({type:2,context: "注册成功,正在为你跳转.."});
  275. setTimeout(function () {
  276. window.location.href = data.data.url;
  277. },1000)
  278. },
  279. error:function(errorData) {
  280. $('#btnRegPersonal').text('注册并绑定').removeClass('btn_disabled').prop('disabled', 0);
  281. var response=$.parseJSON(errorData.response);
  282. if (errorData.status==422) {//验证错误
  283. $.each(response.errors,function (key,val) {
  284. qsToast({type:2,context: val[0]});
  285. return false;
  286. });
  287. }
  288. else if(errorData.status==400) {//业务错误
  289. qsToast({type:2,context: response.message});
  290. }
  291. }
  292. });
  293. }
  294. /**
  295. * 验证用户名等是否重复
  296. * @param validType 验证类型
  297. * @param validValue 值
  298. * @returns {boolean|*}
  299. */
  300. function remoteValid(validType, validValue){
  301. var result = false;
  302. $.ajax({
  303. url: "{{route($sub_site.'register.check', ['utype'=>2])}}",
  304. cache: false,
  305. async: false,
  306. type: 'post',
  307. dataType: 'json',
  308. data: { type: validType, param: validValue },
  309. success: function(json) {
  310. result= true;
  311. }
  312. });
  313. return result;
  314. }
  315. /**
  316. * 验证密码长度
  317. * @param value 密码
  318. * @returns {boolean}
  319. */
  320. function inputRegValiPassword(value){
  321. achoice = true;
  322. if(value.length>16 || value.length<6){
  323. achoice = false;
  324. }
  325. return achoice;
  326. }
  327. </script>
  328. @endsection