Keine Beschreibung

registerThree.js 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. var countDown = '',count_down = '';
  2. var source = '';
  3. var scrollTop = '';
  4. var scrollTop02 = '';
  5. var qs = parseQueryString(window.location.href);
  6. $().ready(function () {
  7. if(qs.source) {source = qs.source}
  8. countLandingPage({click_source:'money_phone',source:source})
  9. $(window).scroll(function(){
  10. scrollTop = $(this).scrollTop(); //scrollTop() 方法返回或设置匹配元素的滚动条的垂直位置
  11. })
  12. })
  13. //点击获取验证码
  14. function getYzmEvent () {
  15. var myreg = /^[0-9]{11}$/;
  16. if (!myreg.test($("#phone").val())) {
  17. //手机号码未填写及填写不正确
  18. showMsg('请正确填写手机号')
  19. return;
  20. }
  21. countLandingPage({click_source:'achieve',source:source})
  22. $("#mask").css({'visibility': 'visible'});
  23. $('#picCode .modal-inner img').attr("src", "/user/VerifyImage/getImageCode?phone=" + $("#phone").val() + "&time=" + new Date().getTime())
  24. scrollTop02 = scrollTop;
  25. $('body').css({'position':'fixed',"top":-scrollTop});
  26. }
  27. //关闭弹层
  28. function closePanel(){
  29. $('#mask').css({'visibility': 'hidden'});
  30. //$('#maskMoney').css({'visibility': 'hidden'});
  31. $("#imgYzm").val('');
  32. $("body").css({"position":"initial"});
  33. $(window).scrollTop(scrollTop02);
  34. }
  35. /* 点击更换图片验证码*/
  36. function getChangeCodeImg(){
  37. $('#picCode .modal-inner img').attr("src", "/user/VerifyImage/getImageCode?phone=" + $("#phone").val() + "&time=" + new Date().getTime());
  38. }
  39. // 输入图片验证码后点击确定请求短信验证码
  40. function goResPanel(){
  41. if($("#imgYzm").val() == ''){
  42. showMsg('请输入图片验证码')
  43. return;
  44. }
  45. registerSecond();
  46. }
  47. //发送短信验证码
  48. function registerSecond () {
  49. $.ajax({
  50. type:"post",
  51. url:"/user/user/registerSecond",
  52. dataType:'json',
  53. data:{
  54. phone:$("#phone").val(),
  55. smstype:1,
  56. qrcode:2,
  57. image_code:$("#imgYzm").val(),
  58. source:source
  59. },
  60. success:function (res){
  61. console.log(res)
  62. if(res && res.errno == 0){
  63. closePanel();
  64. countDown = res.rst.wait_time;
  65. count_down = countDown;
  66. var that = this;
  67. $("#getYzm").attr("disabled","true").css({'color':"#ccc"});
  68. $("#getYzm").html(count_down);
  69. count_down = count_down-1;
  70. var time = setInterval(function () {
  71. $("#getYzm").html(count_down);
  72. count_down--;
  73. if(count_down < 0){
  74. $("#getYzm").removeAttr("disabled")
  75. .html('发送验证码')
  76. .css({'color':'#F63439'});
  77. clearInterval(time);
  78. count_down = countDown;
  79. }
  80. },1000)
  81. }else{
  82. showMsg(res.err)
  83. }
  84. }
  85. });
  86. }
  87. //登录
  88. function loginEvent () {
  89. var myreg = /^[0-9]{11}$/;
  90. if (!myreg.test($("#phone").val())) {
  91. //手机号码未填写及填写不正确
  92. showMsg('请正确填写手机号')
  93. return;
  94. }
  95. if($("#phoneYzm").val() == ""){
  96. showMsg('请输入短信验证码')
  97. return;
  98. }
  99. loginCodeEvent();
  100. }
  101. //短信验证码登录
  102. function loginCodeEvent () {
  103. countLandingPage({click_source:'click',source:source})
  104. $.ajax({
  105. type:"post",
  106. url:"/user/user/loginCode",
  107. dataType:'json',
  108. data:{
  109. phone:$("#phone").val(),
  110. code:$("#phoneYzm").val(),
  111. source:source
  112. },
  113. success:function(res) {
  114. console.log(res)
  115. if(res && res.errno == 0){
  116. goAppEvent();//下载
  117. // $("#maskMoney").css({'visibility': 'visible'});
  118. // scrollTop02 = scrollTop;
  119. // $('body').css({'position':'fixed',"top":-scrollTop});
  120. }else{
  121. showMsg(res.err)
  122. }
  123. }
  124. });
  125. }
  126. //点击下载app
  127. function goAppEvent () {
  128. countLandingPage({click_source:'download',source:source})
  129. showMsg('注册成功')
  130. var downLoad = [{
  131. source:'40017',
  132. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aiqiyi05.apk'
  133. },{
  134. source:'40018',
  135. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aiqiyi06.apk'
  136. },{
  137. source:'40083',
  138. url:'http://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/mm_40083.apk'
  139. },{
  140. source:'40084',
  141. url:'http://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/mm_40084.apk'
  142. },{
  143. source:'40081',
  144. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/mm_40081.apk'
  145. },{
  146. source:'40082',
  147. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/mm_40082.apk'
  148. },{
  149. source:'40013',
  150. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_01_40013.apk'
  151. },{
  152. source:'40014',
  153. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_02_40014.apk'
  154. },{
  155. source:'40015',
  156. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_03_40015.apk'
  157. },{
  158. source:'40016',
  159. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_04_40016.apk'
  160. },{
  161. source:'40002',
  162. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_01_40002.apk'
  163. },{
  164. source:'40003',
  165. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_02_40003.apk'
  166. },{
  167. source:'40004',
  168. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_03_40004.apk'
  169. },{
  170. source:'40005',
  171. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_07_40005.apk'
  172. },{
  173. source:'40006',
  174. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_08_40006.apk'
  175. },{
  176. source:'40007',
  177. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_09_40007.apk'
  178. },{
  179. source:'40008',
  180. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_10_40008.apk'
  181. },{
  182. source:'40009',
  183. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_11_40009.apk'
  184. }]
  185. if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){//小花猪ios下载链接
  186. window.location.href = 'https://itunes.apple.com/cn/app/%E5%B0%8F%E8%8A%B1%E7%8C%AA-%E5%88%86%E6%9C%9F%E6%97%A0%E5%BF%A7-%E9%80%89%E6%8B%A9%E5%A4%9A%E6%A0%B7/id1440274732?mt=8';
  187. return;
  188. }
  189. downLoad.forEach(function (item, index) {
  190. if(source == item.source){
  191. setTimeout(function () {
  192. window.location.href = item.url;
  193. },1000)
  194. return;
  195. }
  196. })
  197. }
  198. //埋点
  199. function countLandingPage (data) {
  200. $.ajax({
  201. type:'post',
  202. url:'/user/log/countLandingPage',
  203. dataType:'json',
  204. data:data,
  205. success:function (res) {
  206. console.log(res)
  207. }
  208. })
  209. }
  210. //提示信息
  211. function showMsg(msg) {
  212. var msg = msg;
  213. var msgBox = $('.alert-info');
  214. msgBox.children('p').text(msg);
  215. msgBox.show();
  216. setTimeout(function() {
  217. msgBox.hide();
  218. }, 2000);
  219. }
  220. //获取地址栏参数
  221. function parseQueryString(url) {
  222. var urlObj = {};
  223. var reg = /([^?=&]+)=([^?=&]+)/g;
  224. url.replace(reg, ($0, $1, $2) => {
  225. urlObj[$1] = decodeURIComponent($2);
  226. })
  227. return urlObj;
  228. }