yangc 7 лет назад
Родитель
Сommit
dbf016bfd5

+ 4 - 2
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -1825,7 +1825,7 @@ define([ 'app/app' ], function(app) {
   /**
    * 左侧导航栏控制器
    */
-	app.controller('leftNavCtrl', ["$scope", "toaster", "$modal", "$rootScope", function($scope, toaster, $modal, $rootScope){
+	app.controller('leftNavCtrl', ["$scope", "toaster", "$modal", "$rootScope", '$q', function($scope, toaster, $modal, $rootScope, $q){
         //安全设置提醒框
         // $scope.openHomeCenterModel = function() {
         //     var modalInstance = $modal.open({
@@ -1846,7 +1846,9 @@ define([ 'app/app' ], function(app) {
 				$scope.openHomeCenterModel();
 			}*/
 		// };
-		$rootScope.isPcbStore = true;
+		$q.all[$rootScope.pcbPromise].then(function (res) {
+			$rootScope.isPcbStore = res == 1;
+		})
 	}]);
 
     function checkNullStr (str) {

+ 5 - 1
src/main/webapp/resources/js/common/query/storeInfo.js

@@ -201,7 +201,11 @@ define([ 'ngResource' ], function() {
 			 */
 			getContactInfo: {
 				url: 'store-service/storeids',
-				method: 'GET',
+				method: 'GET'
+			},
+			isPcb: {
+				url: '/api/store-service/ispcb',
+				method: 'GET'
 			}
         });
     }]).factory('ConsignmentAgreementRecord', ['$resource', 'BaseService', function ($resource, BaseService) {

+ 24 - 13
src/main/webapp/resources/js/vendor/app.js

@@ -677,6 +677,15 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 		});
 		var applyPromise = deferred1.promise;
 
+		// 是否pcb
+		var deferred2 = $q.defer();
+		StoreInfo.isPcb({enuu: $rootScope.userInfo.enterprise.uu}, function (result) {
+			deferred1.resolve(result);
+		}, function (error) {
+			deferred1.reject(error);
+		});
+		$rootScope.pcbPromise = deferred2.promise;
+
 		// 合并多个Promise对象
 		$q.all([storePromise, applyPromise]).then(function (result) {
 			$rootScope.store = result[0] && result[0].uuid ? result[0] : null;
@@ -687,24 +696,26 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 			} else {
 				$rootScope.applyStatus = 'NONE';
 			}
-
-			if ($location.$$path === '/index') {
-                AuthenticationService.getAuthentication().success(function (data) {
-                    angular.forEach(data.enterprises, function (item) {
-                        if (item.current) {
-                            data.enterprise = item;
-                        }
-                    });
-                    $rootScope.userInfo = data;
+			AuthenticationService.getAuthentication().success(function (data) {
+				angular.forEach(data.enterprises, function (item) {
+					if (item.current) {
+						data.enterprise = item;
+					}
+				});
+				$rootScope.userInfo = data;
+				if ($location.$$path === '/index') {
 					if ($rootScope.applyStatus === 'NONE') {
 						$state.go('vendor_store_apply');
 					} else if ($rootScope.applyStatus === 'PASS') {
 						$state.go('vendor_store_maintain');
 					}
-                }).error(function (error) {
-                    toaster.pop('error', '获取登录信息失败');
-                })
-			}
+				}
+				$q.all[$rootScope.pcbPromise].then(function (res) {
+					$rootScope.isPcbStore = res == 1;
+				})
+			}).error(function (error) {
+				toaster.pop('error', '获取登录信息失败');
+			})
 
 			$rootScope.$on('$stateChangeStart', function (event, toState) {