<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="utf-8"> <title>10.0单点登录示例</title> </head> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#login').click(function () { $.ajax({ url: 'http://10.1.16.22:8080/finereport/decision/login/cross/domain', data: {'fine_username': 'XXX', 'fine_password': 'XXX', 'validity': -1}, dataType: 'jsonp', callback: 'callback', success: function (data) {
if(!data.errorCode) { // $('#wb1').trigger("click"); //window.open('http://10.1.16.22:8080/finereport/decision/view/report?viewlet=10.0/Hyperlinks/HS_GROUP/GROUP_TC_SY.cpt&op=view') window.parent.FS.tabPane.addItem({title:"投产表",src:"http://10.1.16.22:8080/finereport/decision/view/report?viewlet=10.0/Hyperlinks/HS_GROUP/GROUP_TC_SY.cpt&op=view"}) } else{ alert("登录失败") } }, error: function () { alert('登录失败'); } }); }); $('#wb1').click(function () { window.open('http://10.1.16.22:8080/finereport/decision/view/report?viewlet=10.0/Hyperlinks/HS_GROUP/GROUP_TC_SY.cpt&op=view') }); });
function setCookie(name, value) { document.cookie = name + "=" + escape(value); }
function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) { return unescape(arr[2]); } else { return null; } } function load(){ document.getElementById("login").click(); }
</script> <body onload="load()"> <button id="login">点击我登录</button> <a id="wb1">点击访问利润表.cpt</a>
</body> </html> |