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

personalInfo.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var qs = parseQueryString(window.location.href),user_id,userInfoData;
  2. // var request = 'http://182.92.118.1:5090';
  3. var request = '';
  4. $().ready(function(){
  5. if(qs.user_id){
  6. user_id = qs.user_id;
  7. }
  8. if(!getCookie('user_id') || getCookie('user_id') != user_id){
  9. window.location.href="index.html"
  10. }
  11. userInfo();//用户信息
  12. })
  13. function userInfo () {
  14. //用户信息
  15. $(".loading").show();
  16. $.ajax({
  17. type: 'get',
  18. url: request + '/userInfo',
  19. data:{
  20. 'user_id':user_id
  21. },
  22. success: function (res) {
  23. $(".loading").hide();
  24. console.log(res)
  25. if(res.status == 200){
  26. userInfoData = res.data;
  27. $(".perfectInfo .top .userImg").attr('src',res.data.user_header_url);
  28. $("#phone").html(res.data.mobile);
  29. $("#name").html(res.data.name);
  30. $("#email").html(res.data.email);
  31. $("#company").html(res.data.platform_account);
  32. $("#address").html(res.data.address);
  33. $("#ID").html(res.data.id_card_num);
  34. $("#justIDImg").attr('src',res.data.id_card_facade_url);
  35. $("#backIDImg").attr('src',res.data.id_card_back_url);
  36. }else{
  37. showMsg(res.msg)
  38. }
  39. },
  40. fail: function () {
  41. showMsg('网络错误,请稍后再试~')
  42. $(".loading").hide();
  43. }
  44. })
  45. }
  46. //获取地址栏参数
  47. function parseQueryString(url) {
  48. var urlObj = {};
  49. var reg = /([^?=&]+)=([^?=&]+)/g;
  50. url.replace(reg, function($0, $1, $2) {
  51. urlObj[$1] = decodeURIComponent($2);
  52. })
  53. return urlObj;
  54. }
  55. // 展示错误提示信息
  56. function showMsg(msg) {
  57. var msgBox = document.getElementsByClassName('alert-info')[0];
  58. msgBox.getElementsByTagName("p")[0].innerHTML=msg;
  59. msgBox.style.display="block";
  60. setTimeout(function() {
  61. msgBox.style.display="none";
  62. }, 2000);
  63. }
  64. //取Cookie的值
  65. function getCookie(name) {
  66. var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  67. if (arr = document.cookie.match(reg)){
  68. return arr[2];
  69. }else{
  70. return false
  71. }
  72. }
  73. //写入到Cookie
  74. //name:cookie名称 value:cookie值
  75. function setCookie(name,value){
  76. var exp = new Date();
  77. exp.setTime(exp.getTime() + 12 * 60 * 60000);//过期时间 12小时
  78. // exp.setTime(exp.getTime() + 60 * 10000);//过期时间 10分钟
  79. document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
  80. }