|
在5.2.7时,我们用下面的代码做了一个系统集成页面,提供给其他系统来调用,是可行的
但是现在在5.3.8里想做同样功能的页面,但是打开时报错.
请看一下如何改.
html文件:
- <head>
- <script type="text/javascript" src="jquery-1.8.2.js"></script>
- <script type="text/javascript" src="jquery.form.js"></script>
- <script type="text/javascript" src="md5.js"></script>
- <script type="text/javascript" src="config.js"></script>
- <script>
-
- // 登录并返回bsessionid,判读前一个bsessionid是否过期,过期则重新登录
- function x5Login(username, password, oldSessionID) {
- var newSessionID = null;
- $.ajax({
- async: false,
- type: 'POST',
- dataType: 'json',
- url: X5_LOGIN_URL,
- data: {
- username: username,
- password: hex_md5(password),
- bsessionid: oldSessionID
- },
- error: function(error, status, text) {
- alert('登录失败1:' + text);
- },
- success: function(result){
- if (result.flag) {
- newSessionID = result.bsessionid;
- } else {
- alert('登录失败2:' + result.message);
- };
- }
- });
- return newSessionID;
- }
- // 注销
- function x5Logout(bsessionid) {
- $.ajax({
- async: false,
- type: 'POST',
- dataType: 'json',
- url: X5_LOGOUT_URL + '?bsessionid=' + bsessionid,
- data: {},
- error: function(error, status, text) {
- alert('注销失败:' + text);
- },
- success: function(result){
- if (result.flag) {
- // alert("X5注销成功!");
- } else {
- alert('注销失败:' + result.message);
- };
- }
- });
- }
- // 全局变量,记录X5 bsessionid
- var _x5_session_id = null;
- // 页面关闭时注销
- $(window).unload(function() {
- x5Logout(_x5_session_id);
- });
-
- function closeX5Window() {
- // alert('由外层决定如何关闭X5Window');
- $('#x5Iframe').attr('src', '');
- }
-
- function load() {
- _x5_session_id = x5Login(username, password, _x5_session_id);
- if (_x5_session_id != null && _x5_session_id != '') {
- var URL = url_KC_Warning + window.location.search + '&process=' + process + '&activity=' + activity + '&bsessionid=' + _x5_session_id;
- $('#x5Iframe').attr('src', URL);
- }
- }
- </script>
- </head>
- <body style="" onload="load()">
- <iframe id="x5Iframe" style="width:100%;height:95%;" onload="this.contentWindow.justep.Portal.closeWindow = closeX5Window;" frameborder="no" border="0" marginwidth="0" marginheight="0" allowtransparency="yes"></iframe>
- </body>
复制代码 config.js文件:
- var X5_LOGIN_URL = '$UI/JY/General/process/mailcontent/x5Login.j';
- var X5_LOGOUT_URL = '$UI/JY/General/process/mailcontent/x5Logout.j';
- var url_KC_Warning = '$UI/JY/WarehouseManage/process/Inventory/queryKCBJJL.w';
- var url_PDCY_Warning = '$UI/JY/WarehouseManage/process/Inventory/queryKCBJJL.w';
- var process = '/JY/WarehouseManage/process/Inventory/inventoryProcess';
- var activity = 'queryKCBJ';
- var username = 'system';
- var password = '123456';
复制代码 打开时报错图片:
|
|