|
|
|
@ -4,11 +4,54 @@ $(document).ready(function() { |
|
|
|
if (toPage) { |
|
|
|
destination = toPage; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var doPointLogin = function(data) { |
|
|
|
// 先拿用户信息
|
|
|
|
|
|
|
|
} |
|
|
|
if (url.indexOf("code")){doPointLogin(data)} |
|
|
|
var url = window.location.href; |
|
|
|
//回调地址的所有参数
|
|
|
|
var str = url.split('?')[1]; |
|
|
|
//参数的值
|
|
|
|
var code = str.split('=')[1]; |
|
|
|
$.cookie('loginType', 'sso', {path: contextPath + '/'}); |
|
|
|
var data = { |
|
|
|
code: code |
|
|
|
}; |
|
|
|
$.ajax({ |
|
|
|
type: 'POST', // 请求类型
|
|
|
|
url: '/system/point/getUser', // 后端接口地址
|
|
|
|
data: data, // 要发送的数据
|
|
|
|
dataType: 'json', // 期望的数据类型
|
|
|
|
success: function(response) { |
|
|
|
var pointUserInfo = response.data; |
|
|
|
console.log(pointUserInfo); |
|
|
|
console.log("===response.data.data==="); |
|
|
|
console.log(pointUserInfo.data); |
|
|
|
var data1 = { |
|
|
|
url : '/doLogin', |
|
|
|
username : pointUserInfo.cngName, |
|
|
|
password : pointUserInfo.password, |
|
|
|
checkCode : null |
|
|
|
}; |
|
|
|
//验证登录
|
|
|
|
$.ajax({ |
|
|
|
type: 'POST', // 请求类型
|
|
|
|
url: data1.url, |
|
|
|
data: data1, // 要发送的数据
|
|
|
|
dataType: 'text', // 期望的数据类型
|
|
|
|
}).done( |
|
|
|
function(msg) { |
|
|
|
if (msg === 'authentication success') { |
|
|
|
window.location.href = destination; |
|
|
|
} else { |
|
|
|
//门户网站地址
|
|
|
|
// window.location.href = url;
|
|
|
|
window.open(url) |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
}, |
|
|
|
error: function(xhr, status, error) { |
|
|
|
// 请求失败时的处理
|
|
|
|
console.error('Error:', error); |
|
|
|
// 这里处理错误情况
|
|
|
|
window.location.href = url; |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |