|
@@ -16,42 +16,36 @@ define([ 'app/app' ], function(app) {
|
|
|
if(--i < 1) Loading.hide();
|
|
if(--i < 1) Loading.hide();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- var url = arguments[0].url;
|
|
|
|
|
- return {
|
|
|
|
|
- request: function(cfg){
|
|
|
|
|
- if(cfg.url) {
|
|
|
|
|
- if(cfg.url.indexOf('api/chat/message') < 0) {
|
|
|
|
|
- startLoading();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return cfg;
|
|
|
|
|
- },
|
|
|
|
|
- requestError: function(rejection) {
|
|
|
|
|
- if(url && url.indexOf('api/chat/message') < 0) {
|
|
|
|
|
- endLoading();
|
|
|
|
|
- }
|
|
|
|
|
- // endLoading();
|
|
|
|
|
- return $q.reject(rejection);
|
|
|
|
|
- },
|
|
|
|
|
- response: function(res) {
|
|
|
|
|
- if(res.config.url) {
|
|
|
|
|
- if(res.config.url.indexOf('api/chat/message') < 0) {
|
|
|
|
|
- endLoading();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return res;
|
|
|
|
|
- },
|
|
|
|
|
- responseError: function(rejection) {
|
|
|
|
|
- if(url && url.indexOf('api/chat/message') < 0) {
|
|
|
|
|
- endLoading();
|
|
|
|
|
- }
|
|
|
|
|
- // endLoading();
|
|
|
|
|
- if(rejection.status == 401) {
|
|
|
|
|
- window.location.href = rejection.data.loginUrl || 'index';
|
|
|
|
|
- }
|
|
|
|
|
- return $q.reject(rejection);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var im_api_url = 'api/chat/message';
|
|
|
|
|
+ return {
|
|
|
|
|
+ request: function(cfg){
|
|
|
|
|
+ if(cfg.url && cfg.url.indexOf(im_api_url) < 0) {
|
|
|
|
|
+ startLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ return cfg;
|
|
|
|
|
+ },
|
|
|
|
|
+ requestError: function(rejection) {
|
|
|
|
|
+ if(rejection.config.url && rejection.config.url.indexOf(im_api_url) < 0) {
|
|
|
|
|
+ endLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ return $q.reject(rejection);
|
|
|
|
|
+ },
|
|
|
|
|
+ response: function(res) {
|
|
|
|
|
+ if(res.config.url && res.config.url.indexOf(im_api_url) < 0) {
|
|
|
|
|
+ endLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ return res;
|
|
|
|
|
+ },
|
|
|
|
|
+ responseError: function(rejection) {
|
|
|
|
|
+ if(rejection.config.url && rejection.config.url.indexOf(im_api_url) < 0) {
|
|
|
|
|
+ endLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(rejection.status == 401) {
|
|
|
|
|
+ window.location.href = rejection.data.loginUrl || 'index';
|
|
|
|
|
+ }
|
|
|
|
|
+ return $q.reject(rejection);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}]);
|
|
}]);
|
|
|
|
|
|
|
|
// 修改页面标题
|
|
// 修改页面标题
|