Commit 0410eea38bbd8016c55b51e7e4d1c5d0e726f171
1 parent
78bbf1c4
提交
Showing
2 changed files
with
14 additions
and
10 deletions
resource/js/unit.js
| @@ -11,7 +11,7 @@ sysComm = { | @@ -11,7 +11,7 @@ sysComm = { | ||
| 11 | //阿里云测试环境,别删 | 11 | //阿里云测试环境,别删 |
| 12 | 12 | ||
| 13 | //var parkcloudbaseUrl = 'http://localhost:8101/';// url公用地址 | 13 | //var parkcloudbaseUrl = 'http://localhost:8101/';// url公用地址 |
| 14 | -var parkcloudbaseUrl = 'http://192.168.1.196:8101/';// url公用地址 | 14 | +var parkcloudbaseUrl = 'http://47.96.41.38:8101/';// url公用地址 |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| @@ -129,24 +129,20 @@ var fn ={ | @@ -129,24 +129,20 @@ var fn ={ | ||
| 129 | }, | 129 | }, |
| 130 | //登出系统 | 130 | //登出系统 |
| 131 | loginOut: function () { | 131 | loginOut: function () { |
| 132 | - | 132 | + fn.toLoginPage(); |
| 133 | + sessionStorage.clear(); | ||
| 134 | + fn.setToken(''); | ||
| 133 | var token = fn.getToken(); | 135 | var token = fn.getToken(); |
| 134 | - | ||
| 135 | if (token != "" && token != null) { | 136 | if (token != "" && token != null) { |
| 136 | - | ||
| 137 | var opt = { | 137 | var opt = { |
| 138 | method: "post", | 138 | method: "post", |
| 139 | url: dataUrl.util.getLoginOut(), | 139 | url: dataUrl.util.getLoginOut(), |
| 140 | success: function(res){ | 140 | success: function(res){ |
| 141 | - sessionStorage.clear() | ||
| 142 | - fn.setToken(''); | ||
| 143 | - fn.toLoginPage(); | ||
| 144 | - | 141 | + console.log(" redis session has been cleared...") |
| 145 | } | 142 | } |
| 146 | }; | 143 | }; |
| 147 | sysAjax(opt); | 144 | sysAjax(opt); |
| 148 | 145 | ||
| 149 | - | ||
| 150 | } | 146 | } |
| 151 | 147 | ||
| 152 | }, | 148 | }, |
| @@ -336,9 +332,16 @@ function sysAjax(opts) { | @@ -336,9 +332,16 @@ function sysAjax(opts) { | ||
| 336 | //设置请求头 | 332 | //设置请求头 |
| 337 | //xhr.setRequestHeader("User-Agent", "headertest"); | 333 | //xhr.setRequestHeader("User-Agent", "headertest"); |
| 338 | console.log(fn.getToken()); | 334 | console.log(fn.getToken()); |
| 339 | - xhr.setRequestHeader("X-Auth-Token", fn.getToken()); | 335 | + if(fn.getToken() == null || fn.getToken() == "" || fn.getToken() == undefined){ |
| 336 | + //window.location.href = '../../workreport/login/login.html' | ||
| 337 | + xhr.setRequestHeader("X-Auth-Token", ""); | ||
| 338 | + }else{ | ||
| 339 | + xhr.setRequestHeader("X-Auth-Token", fn.getToken()); | ||
| 340 | + } | ||
| 341 | + | ||
| 340 | }, | 342 | }, |
| 341 | success: function (res, status, xhr) { | 343 | success: function (res, status, xhr) { |
| 344 | + debugger; | ||
| 342 | var msg = (typeof res.msg == 'string') && (res.msg.constructor == String) ? res.msg : res.errMsg; | 345 | var msg = (typeof res.msg == 'string') && (res.msg.constructor == String) ? res.msg : res.errMsg; |
| 343 | //成功 | 346 | //成功 |
| 344 | if (res.code=='2003') { | 347 | if (res.code=='2003') { |
topages/workfill/workfill.js
| @@ -65,6 +65,7 @@ var fun = { | @@ -65,6 +65,7 @@ var fun = { | ||
| 65 | //退出 | 65 | //退出 |
| 66 | logout:function(){ | 66 | logout:function(){ |
| 67 | documentBindFunc.on('click','#logoutId',function(){ | 67 | documentBindFunc.on('click','#logoutId',function(){ |
| 68 | + debugger; | ||
| 68 | fn.loginOut(); | 69 | fn.loginOut(); |
| 69 | }); | 70 | }); |
| 70 | }, | 71 | }, |