Ver Fonte

Merge remote-tracking branch 'origin/feature-b2b-ssr-wangcz' into feature-b2b-ssr-wangcz

shenjj há 8 anos atrás
pai
commit
4ff0a1ad14

+ 45 - 63
src/main/webapp/resources/js/common/b2bServices.js

@@ -285,24 +285,6 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                 }
             });
         }])
-        .factory('B2bCurrentRole', ['$resource', 'BaseService', function($resource, BaseService) {
-            var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + '/account/role', {}, {
-                //当前企业对应的角色是否是销售经理或管理员
-                roles: {
-                    url: b2bPath + '/account/role/currentRole',
-                    method: 'GET'
-                },
-                isManager: {
-                    url: b2bPath + '/account/role/isManager',
-                    method: 'GET'
-                },
-                isUser: {
-                    url: b2bPath + '/account/role/isUser',
-                    method: 'GET'
-                }
-            })
-        }])
         .factory('B2bPurcChange', ['$resource', 'BaseService', function($resource, BaseService) {
           var b2bPath = BaseService.getB2bUrl();
           return $resource(b2bPath + '/sale/changes/info/search', {}, {
@@ -383,9 +365,9 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
         }])
         .factory('B2bProduct', ['$resource', 'BaseService', function($resource, BaseService){
             var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + 'product', {}, {
+            return $resource(b2bPath + '/product', {}, {
                 vendPord: {
-                    url: b2bPath + 'product/vend'
+                    url: b2bPath + '/product/vend'
                 }
             })
         }])
@@ -429,49 +411,49 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
         }])
         .factory('B2bPurcOrder', ['$resource', 'BaseService', function($resource, BaseService) {
           var rootPath = BaseService.getB2bUrl();
-          return $resource(rootPath + 'sale/orders/:id/info', {}, {
+          return $resource(rootPath + '/sale/orders/:id/info', {}, {
             setRead: {
-              url: rootPath + 'sale/orders/display',
+              url: rootPath + '/sale/orders/display',
               method: 'POST',
               params: {
                 _state: 'read'
               }
             },
             setUnRead: {
-              url: rootPath + 'sale/orders/display',
+              url: rootPath + '/sale/orders/display',
               method: 'POST',
               params: {
                 _state: 'unread'
               }
             },
             setTop: {
-              url: rootPath + 'sale/orders/display',
+              url: rootPath + '/sale/orders/display',
               method: 'POST',
               params: {
                 _state: 'top'
               }
             },
             printCount: {
-              url: rootPath + 'sale/orders/printCount/:id',
+              url: rootPath + '/sale/orders/printCount/:id',
               method: 'POST'
             },
             printPermission: {
-              url: rootPath + 'sale/orders/printCount/permission',
+              url: rootPath + '/sale/orders/printCount/permission',
               method: 'POST'
             },
             custPrintCount: {
-              url: rootPath + 'sale/orders/custPrintCount/:id',
+              url: rootPath + '/sale/orders/custPrintCount/:id',
               method: 'POST'
             },
             custPrintPermission: {
-              url: rootPath + 'sale/orders/custPrintCount/permission',
+              url: rootPath + '/sale/orders/custPrintCount/permission',
               method: 'POST'
             }
           });
         }])
         .factory('B2bPurcOrderItem', ['$resource', 'BaseService', function($resource, BaseService) {
           var rootPath = BaseService.getB2bUrl();
-          return $resource(rootPath + 'sale/orders/info/search', {}, {
+          return $resource(rootPath + '/sale/orders/info/search', {}, {
             getTodo: {
               params: {
                 _state: 'todo'
@@ -503,21 +485,21 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
               }
             },
             replyByBatch: {
-              url: rootPath +  'sale/orders/items/reply',
+              url: rootPath +  '/sale/orders/items/reply',
               method: 'POST',
               headers: {
                 'Content-Type' : 'application/text;charset=UTF-8'
               }
             },
             reply: {
-              url: rootPath + 'sale/orders/items/:orderItemId/reply',
+              url: rootPath + '/sale/orders/items/:orderItemId/reply',
               method: 'POST',
               params: {
                 orderItemId: 'orderItemId'
               }
             },
             getReply: {
-              url: rootPath + 'sale/orders/items/:orderItemId/reply/all',
+              url: rootPath + '/sale/orders/items/:orderItemId/reply/all',
               method: 'GET',
               isArray: true,
               params: {
@@ -525,54 +507,54 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
               }
             },
             setRead:{
-              url: rootPath + 'sale/orders/setRead',
+              url: rootPath + '/sale/orders/setRead',
               method: 'POST'
             },
             setReadByState:{
-              url: rootPath + 'sale/orders/setReadByState',
+              url: rootPath + '/sale/orders/setReadByState',
               method: 'GET'
             },
             getUnreadIds:{
-              url: rootPath + 'sale/orders/getUnreadIds',
+              url: rootPath + '/sale/orders/getUnreadIds',
               method: 'GET'
             },
             getUnreadCount:{
-              url: rootPath + 'sale/orders/unread',
+              url: rootPath + '/sale/orders/unread',
               method: 'GET'
             },
             exportXls: {
-              url: rootPath + 'sale/orders/xls/permission',
+              url: rootPath + '/sale/orders/xls/permission',
               method: 'GET'
             }
           });
         }])
         .factory('B2bMakeChange', ['$resource', 'BaseService', function($resource, BaseService) {
           var rootPath = BaseService.getB2bUrl();
-          return $resource(rootPath + 'make/changes/info/search', {}, {
+          return $resource(rootPath + '/make/changes/info/search', {}, {
             reply: {
-              url: rootPath + 'make/changes/:itemId/reply',
+              url: rootPath + '/make/changes/:itemId/reply',
               method: 'POST',
               params: {
                 itemId: 'itemId'
               }
             },
             getAll: {
-              url: rootPath + 'make/changes/info/search',
+              url: rootPath + '/make/changes/info/search',
               method: 'GET',
             },
             getItem: {
-              url: rootPath + 'make/changes/:id/info',
+              url: rootPath + '/make/changes/:id/info',
               method: 'GET',
             },
             exportXls: {
-              url: rootPath + 'make/changes/xls/permission',
+              url: rootPath + '/make/changes/xls/permission',
               method: 'GET',
             }
           });
       }])
         .factory('B2bQuotation', ['$resource', 'BaseService', function($resource, BaseService) {
         var b2bPath = BaseService.getB2bUrl();
-        return $resource(b2bPath + 'sale/quotation/info/search', {}, {
+        return $resource(b2bPath + '/sale/quotation/info/search', {}, {
             getTodo: {
                 params: {
                     _state: 'todo'
@@ -599,7 +581,7 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                 }
             },
             save: {
-                url: b2bPath + 'sale/quotation/save',
+                url: b2bPath + '/sale/quotation/save',
                 method: 'POST',
                 isArray: false,
                 headers: {
@@ -607,7 +589,7 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                 }
             },
             submit: {
-                url: b2bPath + 'sale/quotation/submit',
+                url: b2bPath + '/sale/quotation/submit',
                 method: 'POST',
                 isArray: false,
                 headers: {
@@ -616,80 +598,80 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
             },
             getItem: {
                 isArray: false,
-                url: b2bPath + 'sale/quotation/:id/info'
+                url: b2bPath + '/sale/quotation/:id/info'
             },
             deleteById: {
-                url: b2bPath + 'sale/quotation/deleteById/:id',
+                url: b2bPath + '/sale/quotation/deleteById/:id',
                 method: 'DELETE'
             },
             exportXls: {
-                url: b2bPath + 'sale/quotation/xls/permission',
+                url: b2bPath + '/sale/quotation/xls/permission',
                 method: 'GET'
             }
         });
         }])
         .factory('B2bVendorInfo', ['$resource', 'BaseService', function($resource, BaseService){
             var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + 'purchase', {}, {
+            return $resource(b2bPath + '/purchase', {}, {
                 getVendorInfo: {
-                    url: b2bPath + 'purchase/getVendorInfo',
+                    url: b2bPath + '/purchase/getVendorInfo',
                     method: 'GET'
                 },
                 getProdInfo: {
-                    url: b2bPath + 'purchase/getProdInfo/:id',
+                    url: b2bPath + '/purchase/getProdInfo/:id',
                     method: 'GET'
                 },
                 customerInfo: {
-                    url: b2bPath + 'purchase/customerInfo/:custuu',
+                    url: b2bPath + '/purchase/customerInfo/:custuu',
                     method: 'GET'
                 },
                 relieve: {
-                    url: b2bPath + 'purchase/relieve/:id',
+                    url: b2bPath + '/purchase/relieve/:id',
                     method: 'POST'
                 },
                 activeVend: {
-                    url: b2bPath + 'purchase/activeVend/:id',
+                    url: b2bPath + '/purchase/activeVend/:id',
                     method: 'POST'
                 },
                 relieveServicer: {
-                    url: b2bPath + 'purchase/relieveServicer/:id',
+                    url: b2bPath + '/purchase/relieveServicer/:id',
                     method: 'POST'
                 },
                 activeServicer: {
-                    url: b2bPath + 'purchase/activeServicer/:id',
+                    url: b2bPath + '/purchase/activeServicer/:id',
                     method: 'POST'
                 },
                 disableCust: {
-                    url: b2bPath + 'purchase/disableCust/:id',
+                    url: b2bPath + '/purchase/disableCust/:id',
                     method: 'POST'
                 },
                 activeCust: {
-                    url: b2bPath + 'purchase/activeCust/:id',
+                    url: b2bPath + '/purchase/activeCust/:id',
                     method: 'POST'
                 }
             });
         }])
         .factory('B2bCurrentRole', ['$resource', 'BaseService', function($resource, BaseService) {
             var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + 'account/role', {}, {
+            return $resource(b2bPath + '/account/role', {}, {
                 //当前企业对应的角色是否是销售经理或管理员
                 roles: {
-                    url: b2bPath + 'account/role/currentRole',
+                    url: b2bPath + '/account/role/currentRole',
                     method: 'GET'
                 },
                 isManager: {
-                    url: b2bPath + 'account/role/isManager',
+                    url: b2bPath + '/account/role/isManager',
                     method: 'GET'
                 },
                 isUser: {
-                    url: b2bPath + 'account/role/isUser',
+                    url: b2bPath + '/account/role/isUser',
                     method: 'GET'
                 }
             })
         }])
         .factory('B2bCustomer', ['$resource', 'BaseService', function($resource, BaseService){
             var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + 'vendor/customer/info/search', {}, {});
+            return $resource(b2bPath + '/vendor/customer/info/search', {}, {});
         }])
         .factory('B2bAuthenticationService', ['$http', 'SessionService', 'BaseService', 'SerializerUtil', function($http, SessionService, BaseService, SerializerUtil) {
             var cacheSession = function() {

+ 17 - 2
src/main/webapp/resources/js/common/services.js

@@ -63,7 +63,7 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 				}
 			}
 		};
-	}).factory('BaseService', ['$rootScope', function($rootScope) {
+	}).factory('BaseService', ['$rootScope', '$http', '$q', function($rootScope, $http, $q) {
 		return {
             getRootPath: function() {
             	var pathName = window.location.pathname.substring(1);
@@ -138,7 +138,22 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 				}
 			},
 			getB2bUrl: function () {
-				return 'http://10.1.51.88:8090/platform-b2b/';
+				if (!$rootScope.b2bUrl) {
+					// var defer = $q.defer();
+					// $http({
+					// 	method: 'get',
+					// 	url: 'b2b/sale/accessUrl'
+					// }).success(function (data) {
+					// 	defer.resolve(data);
+					// }).error(function (error) {
+					// 	defer.reject(error);
+					// });
+					// defer.promise.then(function (resolve) {
+					// 	$rootScope.b2bUrl = resolve.url;
+					// });
+					$rootScope.b2bUrl = this.getRootPath().indexOf('usoftmall.com') > -1 ? 'http://uas.ubtob.com' : 'http://192.168.253.12:9000/b2b-test';
+				}
+				return $rootScope.b2bUrl;
 			}
 		};
 	}]).factory('AuthenticationService', ['$http', 'SessionService', 'BaseService', 'SerializerUtil', function($http, SessionService, BaseService, SerializerUtil) {