Ext判断用户session:
if(Ext.data.Connection){ Ext.override(Ext.data.Connection,{ handleResponse : function(response){ var resultData = response.responseText; if('logout'==resultData){ alert("未登陆或过期,请重新登陆"); window.self.close(); return; } this.transId = false; var options = response.argument.options; response.argument = options ? options.argument : null; this.fireEvent("requestcomplete", this, response, options); Ext.callback(options.success, options.scope, [response, options]); Ext.callback(options.callback, options.scope, [options, true, response]); } }); }
下面是网上说更好的方法:
Ext.override(Ext.data.Connection, { handleResponse : Ext.data.Connection.prototype.handleResponse.createInterceptor( function(response) { var resultData = response.responseText; if('logout'==resultData){ alert("未登陆或过期,请重新登陆"); window.self.close(); return false; } return true; }) });