No Description

registerSeven.js 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. if(source == '40064'){
  9. document.title='厦门小小雨点金融信息服务有限公司';
  10. $("#company").html('厦门小小雨点金融信息服务有限公司')
  11. }
  12. if(source == '40054' || source == '40055' || source == '40056' || source == '40057'){
  13. $(".xiaohuazhu-icon").html('<img src="img/WechatIMG132.jpeg" />')
  14. }
  15. countLandingPage({click_source:'money_phone',source:source})
  16. $(window).scroll(function(){
  17. scrollTop = $(this).scrollTop(); //scrollTop() 方法返回或设置匹配元素的滚动条的垂直位置
  18. })
  19. })
  20. //点击获取验证码
  21. function getYzmEvent () {
  22. var myreg = /^[0-9]{11}$/;
  23. if (!myreg.test($("#phone").val())) {
  24. //手机号码未填写及填写不正确
  25. showMsg('请正确填写手机号')
  26. return;
  27. }
  28. countLandingPage({click_source:'achieve',source:source})
  29. $("#mask").css({'visibility': 'visible'});
  30. $('#picCode .modal-inner img').attr("src", "/user/VerifyImage/getImageCode?phone=" + $("#phone").val() + "&time=" + new Date().getTime())
  31. scrollTop02 = scrollTop;
  32. $('body').css({'position':'fixed',"top":-scrollTop});
  33. }
  34. //关闭弹层
  35. function closePanel(){
  36. $('#mask').css({'visibility': 'hidden'});
  37. //$('#maskMoney').css({'visibility': 'hidden'});
  38. $("#imgYzm").val('');
  39. $("body").css({"position":"initial"});
  40. $(window).scrollTop(scrollTop02);
  41. }
  42. /* 点击更换图片验证码*/
  43. function getChangeCodeImg(){
  44. $('#picCode .modal-inner img').attr("src", "/user/VerifyImage/getImageCode?phone=" + $("#phone").val() + "&time=" + new Date().getTime());
  45. }
  46. // 输入图片验证码后点击确定请求短信验证码
  47. function goResPanel(){
  48. if($("#imgYzm").val() == ''){
  49. showMsg('请输入图片验证码')
  50. return;
  51. }
  52. registerSecond();
  53. }
  54. //发送短信验证码
  55. function registerSecond () {
  56. $.ajax({
  57. type:"post",
  58. url:"/user/user/registerSecond",
  59. dataType:'json',
  60. data:{
  61. phone:$("#phone").val(),
  62. smstype:1,
  63. qrcode:2,
  64. image_code:$("#imgYzm").val(),
  65. source:source
  66. },
  67. success:function (res){
  68. console.log(res)
  69. if(res && res.errno == 0){
  70. closePanel();
  71. countDown = res.rst.wait_time;
  72. count_down = countDown;
  73. var that = this;
  74. $("#getYzm").attr("disabled","true").css({'background':'#ccc','color':"#ffffff"});
  75. $("#getYzm").html(count_down);
  76. count_down = count_down-1;
  77. var time = setInterval(function () {
  78. $("#getYzm").html(count_down);
  79. count_down--;
  80. if(count_down < 0){
  81. $("#getYzm").removeAttr("disabled")
  82. .html('发送验证码')
  83. .css({'background':'#fbde3a','color':'#fe474b'});
  84. clearInterval(time);
  85. count_down = countDown;
  86. }
  87. },1000)
  88. }else{
  89. showMsg(res.err)
  90. }
  91. }
  92. });
  93. }
  94. //登录
  95. function loginEvent () {
  96. var myreg = /^[0-9]{11}$/;
  97. if (!myreg.test($("#phone").val())) {
  98. //手机号码未填写及填写不正确
  99. showMsg('请正确填写手机号')
  100. return;
  101. }
  102. if($("#phoneYzm").val() == ""){
  103. showMsg('请输入短信验证码')
  104. return;
  105. }
  106. loginCodeEvent();
  107. }
  108. //短信验证码登录
  109. function loginCodeEvent () {
  110. countLandingPage({click_source:'click',source:source})
  111. $.ajax({
  112. type:"post",
  113. url:"/user/user/loginCode",
  114. dataType:'json',
  115. data:{
  116. phone:$("#phone").val(),
  117. code:$("#phoneYzm").val(),
  118. source:source
  119. },
  120. success:function(res) {
  121. console.log(res)
  122. if(res && res.errno == 0){
  123. goAppEvent();//下载
  124. // $("#maskMoney").css({'visibility': 'visible'});
  125. // scrollTop02 = scrollTop;
  126. // $('body').css({'position':'fixed',"top":-scrollTop});
  127. }else{
  128. showMsg(res.err)
  129. }
  130. }
  131. });
  132. }
  133. //点击下载app
  134. function goAppEvent () {
  135. countLandingPage({click_source:'download',source:source})
  136. showMsg('注册成功')
  137. var downLoad = [{
  138. source:'40020',
  139. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/BNDXJDqutoutiao07_v1.0.0_2018-11-13_100_jiagu_sign.apk'
  140. },{
  141. source:'40028',
  142. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xiaohuazhu_smss03.apk'
  143. },{
  144. source:'40032',
  145. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_smss07.apk'
  146. },{
  147. source:'40033',
  148. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_smss08.apk'
  149. },{
  150. source:'40034',
  151. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_smss09.apk'
  152. },{
  153. source:'40035',
  154. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_smss10.apk'
  155. },{
  156. source:'40036',
  157. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_smss11.apk'
  158. },{
  159. source:'40044',
  160. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/qtt_03.apk'
  161. },{
  162. source:'40054',
  163. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_01.apk'
  164. },{
  165. source:'40055',
  166. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_02.apk'
  167. },{
  168. source:'40056',
  169. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_03.apk'
  170. },{
  171. source:'40057',
  172. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/aqy_04.apk'
  173. },{
  174. source:'40064',
  175. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/uc_01.apk'
  176. },{
  177. source:'40065',
  178. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/xhz_tg40065.apk'
  179. },{
  180. source:'40074',
  181. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/ss_uc_03.apk'
  182. },{
  183. source:'40075',
  184. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/ss_uc_04.apk'
  185. },{
  186. source:'40076',
  187. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/ss_uc_05.apk'
  188. },{
  189. source:'4001',
  190. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/search360.apk'
  191. },{
  192. source:'40004',
  193. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_03_40004.apk'
  194. },{
  195. source:'40005',
  196. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_07_40005.apk'
  197. },{
  198. source:'40006',
  199. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_08_40006.apk'
  200. },{
  201. source:'40007',
  202. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_09_40007.apk'
  203. },{
  204. source:'40008',
  205. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_10_40008.apk'
  206. },{
  207. source:'40009',
  208. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_11_40009.apk'
  209. },{
  210. source:'40002',
  211. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_01_40002.apk'
  212. },{
  213. source:'40003',
  214. url:'https://kx-loans.oss-cn-beijing.aliyuncs.com/xiaohuazhu/smss_02_40003.apk'
  215. }]
  216. if(source != '40065' && source != '40024' && source != '40025'){
  217. if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
  218. 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';
  219. return;
  220. }
  221. }
  222. downLoad.forEach(function (item, index) {
  223. if(source == item.source){
  224. setTimeout(function () {
  225. window.location.href = item.url;
  226. },1000)
  227. return;
  228. }
  229. })
  230. }
  231. //埋点
  232. function countLandingPage (data) {
  233. $.ajax({
  234. type:'post',
  235. url:'/user/log/countLandingPage',
  236. dataType:'json',
  237. data:data,
  238. success:function (res) {
  239. console.log(res)
  240. }
  241. })
  242. }
  243. //提示信息
  244. function showMsg(msg) {
  245. var msg = msg;
  246. var msgBox = $('.alert-info');
  247. msgBox.children('p').text(msg);
  248. msgBox.show();
  249. setTimeout(function() {
  250. msgBox.hide();
  251. }, 2000);
  252. }
  253. //获取地址栏参数
  254. function parseQueryString(url) {
  255. var urlObj = {};
  256. var reg = /([^?=&]+)=([^?=&]+)/g;
  257. url.replace(reg, ($0, $1, $2) => {
  258. urlObj[$1] = decodeURIComponent($2);
  259. })
  260. return urlObj;
  261. }