Преглед изворни кода

开店申请页面获取不到企业信息问题

yangc пре 7 година
родитељ
комит
cda5e7c774

+ 6 - 0
src/main/webapp/resources/js/vendor/app.js

@@ -690,6 +690,12 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 
 			if ($rootScope.applyStatus === 'NONE' && $location.$$path === '/index') {
                 AuthenticationService.getAuthentication().success(function (data) {
+                    angular.forEach(data.enterprises, function (item) {
+                        if (item.current) {
+                            data.enterprise = item;
+                        }
+                    });
+                    $rootScope.userInfo = data;
                     if (!(!data.pwdEnable || !data.haveUserQuestion||!data.emailValidCode || data.emailValidCode != 2)) {
                         $state.go('vendor_store_apply');
                     }

+ 43 - 33
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_store_apply_ctrl.js

@@ -50,41 +50,51 @@ define(['app/app', 'jquery-uploadify'], function (app) {
 		 */
 		function activate() {
 			// 获取企业信息
-			var enterprise = $rootScope.userInfo.enterprise;
-			Enterprise.getEnterpriseInfo({ enuu : enterprise.uu}, {}, function (enterprise) {
-				$scope.enterprise = enterprise || {};
-
-				StoreInfo.findLastUnPassApplyByEnuu({}, {}, function (result) {
-					console.log('UN_PASS_APPLY', result);
-					if (result) {
-						switchTab(result.type);
-						if (result.qualifications) {
-							angular.forEach(result.qualifications, function (qualification) {
-								$scope.qualifications[qualification.type] = qualification;
-							});
-						}else {
-							Enterprise.getEnterpriseDetailInfo({ enuu : enterprise.uu},{},function (enterpriseDetail) {
-								$scope.enBuinesssCode = enterpriseDetail.businessCodeImage;
-                                $scope.qualifications[$scope.qType.businessLicense] = generateQualification($scope.enBuinesssCode, $scope.qType.businessLicense);;
-                            });
-						}
-						if (result.brands) {
-							$scope.brands = [];
-							angular.forEach(result.brands, function (brand) {
-								var newBrand = {};
-								newBrand.name = brand.name;
-								newBrand.url = brand.url;
-								$scope.brands.push(newBrand);
-							});
-						}
-						$scope.reason = result.reason;
+			AuthenticationService.getAuthentication().success(function (data) {
+				angular.forEach(data.enterprises, function (item) {
+					if (item.current) {
+						data.enterprise = item;
 					}
-				}, function (error) {
-					console.log('INITIAL_ERROR', error);
 				});
-			}, function () {
-				toaster.pop('error', '获取企业信息失败');
-			});
+				$rootScope.userInfo = data;
+				var enterprise = $rootScope.userInfo.enterprise;
+				Enterprise.getEnterpriseInfo({ enuu : enterprise.uu}, {}, function (enterprise) {
+					$scope.enterprise = enterprise || {};
+
+					StoreInfo.findLastUnPassApplyByEnuu({}, {}, function (result) {
+						console.log('UN_PASS_APPLY', result);
+						if (result) {
+							switchTab(result.type);
+							if (result.qualifications) {
+								angular.forEach(result.qualifications, function (qualification) {
+									$scope.qualifications[qualification.type] = qualification;
+								});
+							}else {
+								Enterprise.getEnterpriseDetailInfo({ enuu : enterprise.uu},{},function (enterpriseDetail) {
+									$scope.enBuinesssCode = enterpriseDetail.businessCodeImage;
+									$scope.qualifications[$scope.qType.businessLicense] = generateQualification($scope.enBuinesssCode, $scope.qType.businessLicense);;
+								});
+							}
+							if (result.brands) {
+								$scope.brands = [];
+								angular.forEach(result.brands, function (brand) {
+									var newBrand = {};
+									newBrand.name = brand.name;
+									newBrand.url = brand.url;
+									$scope.brands.push(newBrand);
+								});
+							}
+							$scope.reason = result.reason;
+						}
+					}, function (error) {
+						console.log('INITIAL_ERROR', error);
+					});
+				}, function () {
+					toaster.pop('error', '获取企业信息失败');
+				});
+			}).error(function (error) {
+				toaster.pop('error', '获取登录信息失败');
+			})
 		}
 		// 获取已登录的用户信息
 		var getAuthentication = function() {