新媒体-合同签约,CA签约

index-01.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. var qs = parseQueryString(window.location.href),user_id,userInfoData;
  2. var request = 'http://182.92.118.1:5090';
  3. var key = '',userInfoKey = '',send_cms_key = '',checkCodeKey = '',tpl_id = '';
  4. $().ready(function(){
  5. if(qs.user_id){
  6. user_id = qs.user_id;
  7. }
  8. if(qs.tpl_id){
  9. tpl_id = qs.tpl_id;
  10. }
  11. if(qs.key){
  12. key = qs.key;
  13. }
  14. userInfo();//获取用户信息
  15. })
  16. function userInfo () {
  17. //用户信息
  18. $(".loading").show();
  19. $.ajax({
  20. type: 'get',
  21. url: request + '/userInfo',
  22. data:{
  23. 'user_id':user_id,
  24. 'key':key
  25. },
  26. success: function (res) {
  27. $(".loading").hide();
  28. console.log(res)
  29. if(res.status == 200){
  30. userInfoData = res.data;
  31. userInfoKey = res.key;
  32. $(".SMS_verification .phone").html(userInfoData.mobile.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2"));
  33. $(".SMS_verification .title").html(userInfoData.name + '手机号验证');
  34. }else{
  35. showMsg(res.msg)
  36. }
  37. },
  38. fail: function () {
  39. showMsg('网络错误,请稍后再试~')
  40. $(".loading").hide();
  41. }
  42. })
  43. }
  44. function send_cms () {
  45. //发送验证码
  46. $(".loading").show();
  47. $.ajax({
  48. type: 'get',
  49. url: request + '/send_cms',
  50. data:{
  51. 'user_id':user_id,
  52. 'key':userInfoKey
  53. },
  54. success: function (res) {
  55. $(".loading").hide();
  56. console.log(res)
  57. if(res.code == 200){
  58. send_cms_key = res.key;
  59. $(".authorization_authentication .yzm_button").addClass('yzm_button_active');
  60. var downCount = 60;
  61. var time = setInterval(function () {
  62. $(".authorization_authentication .yzm_button").html(downCount + 's');
  63. downCount--;
  64. if(downCount < 0){
  65. clearInterval(time);
  66. $(".authorization_authentication .yzm_button").removeClass('yzm_button_active');
  67. $(".authorization_authentication .yzm_button").html('获取验证码');
  68. }
  69. },1000)
  70. }else{
  71. showMsg(res.msg)
  72. }
  73. },
  74. fail: function () {
  75. showMsg('网络错误,请稍后再试~')
  76. $(".loading").hide();
  77. }
  78. })
  79. }
  80. function nextStepEnvet(){
  81. //下一步
  82. $(".SMS_verification").hide();
  83. $(".authorization_authentication").show();
  84. document.title='授权认证'
  85. $(".authorization_authentication .title span").html(userInfoData.mobile.substring(7));
  86. send_cms();//发送短信
  87. }
  88. function getYzmButton () {
  89. //获取验证码按钮
  90. if($(".authorization_authentication .yzm_button").attr('class').indexOf('yzm_button_active') == -1){
  91. send_cms();//发送短信
  92. }
  93. }
  94. function submissionEventYzm(){
  95. //提交验证码
  96. console.log($(".authorization_authentication .yzm_div input").val());
  97. var userCode = $(".authorization_authentication .yzm_div input").val();
  98. if(userCode.trim() == ''){
  99. showMsg('请输入手机验证码');
  100. return;
  101. }
  102. $(".loading").show();
  103. $.ajax({
  104. type: 'get',
  105. url: request + '/checkCode',
  106. data:{
  107. 'code':userCode,
  108. // 'mobile':userInfoData.mobile,
  109. 'user_id':user_id,
  110. 'key':send_cms_key
  111. },
  112. success: function (res) {
  113. $(".loading").hide();
  114. console.log(res)
  115. if(res.code == 200){
  116. checkCodeKey = res.key;
  117. window.location.href='mySigning.html?user_id=' + user_id
  118. }else{
  119. showMsg(res.msg)
  120. }
  121. },
  122. fail: function () {
  123. showMsg('网络错误,请稍后再试~')
  124. $(".loading").hide();
  125. }
  126. })
  127. }
  128. //获取地址栏参数
  129. function parseQueryString(url) {
  130. var urlObj = {};
  131. var reg = /([^?=&]+)=([^?=&]+)/g;
  132. url.replace(reg, function($0, $1, $2) {
  133. urlObj[$1] = decodeURIComponent($2);
  134. })
  135. return urlObj;
  136. }
  137. // 展示错误提示信息
  138. function showMsg(msg) {
  139. var msgBox = document.getElementsByClassName('alert-info')[0];
  140. msgBox.getElementsByTagName("p")[0].innerHTML=msg;
  141. msgBox.style.display="block";
  142. setTimeout(function() {
  143. msgBox.style.display="none";
  144. }, 2000);
  145. }