1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var qs = parseQueryString(window.location.href),user_id,userInfoData;
- // var request = 'http://182.92.118.1:5090';
- var request = '';
- $().ready(function(){
- if(qs.user_id){
- user_id = qs.user_id;
- }
- if(!getCookie('user_id') || getCookie('user_id') != user_id){
- window.location.href="index.html"
- }
- userInfo();//用户信息
- })
- function userInfo () {
- //用户信息
- $(".loading").show();
- $.ajax({
- type: 'get',
- url: request + '/userInfo',
- data:{
- 'user_id':user_id
- },
- success: function (res) {
- $(".loading").hide();
- console.log(res)
- if(res.status == 200){
- userInfoData = res.data;
- $(".perfectInfo .top .userImg").attr('src',res.data.user_header_url);
- $("#phone").html(res.data.mobile);
- $("#name").html(res.data.name);
- $("#email").html(res.data.email);
- $("#company").html(res.data.platform_account);
- $("#address").html(res.data.address);
- $("#ID").html(res.data.id_card_num);
- $("#justIDImg").attr('src',res.data.id_card_facade_url);
- $("#backIDImg").attr('src',res.data.id_card_back_url);
-
- }else{
- showMsg(res.msg)
- }
- },
- fail: function () {
- showMsg('网络错误,请稍后再试~')
- $(".loading").hide();
- }
- })
- }
- //获取地址栏参数
- function parseQueryString(url) {
- var urlObj = {};
- var reg = /([^?=&]+)=([^?=&]+)/g;
- url.replace(reg, function($0, $1, $2) {
- urlObj[$1] = decodeURIComponent($2);
- })
- return urlObj;
- }
- // 展示错误提示信息
- function showMsg(msg) {
- var msgBox = document.getElementsByClassName('alert-info')[0];
- msgBox.getElementsByTagName("p")[0].innerHTML=msg;
- msgBox.style.display="block";
- setTimeout(function() {
- msgBox.style.display="none";
- }, 2000);
- }
- //取Cookie的值
- function getCookie(name) {
- var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
- if (arr = document.cookie.match(reg)){
- return arr[2];
- }else{
- return false
- }
- }
- //写入到Cookie
- //name:cookie名称 value:cookie值
- function setCookie(name,value){
- var exp = new Date();
- exp.setTime(exp.getTime() + 12 * 60 * 60000);//过期时间 12小时
- // exp.setTime(exp.getTime() + 60 * 10000);//过期时间 10分钟
- document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
- }
|