瀏覽代碼

卖家账户管理,获取身份信息

yangc 8 年之前
父節點
當前提交
42f0b4112b
共有 1 個文件被更改,包括 27 次插入15 次删除
  1. 27 15
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

+ 27 - 15
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -4,26 +4,38 @@
  */
 define(['app/app'], function(app) {
     "use strict";
-    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal','BaseService','ngTableParams','$http', function($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http) {
+    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal','BaseService','ngTableParams','$http', 'AuthenticationService', function($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService) {
         $rootScope.active = 'vendor_account_management';
 		$scope.tab = 'base';
         $scope.userInfo = $rootScope.userInfo;
 		$scope.updateState = false;
-        // 获取企业信息
-        Enterprise.getEnterpriseInfo({enuu : $scope.userInfo.enterprise.uu}, function(data) {
-			$scope.enterpriseInfo = data;
-			$scope.enterpriseInfoBackup = angular.copy($scope.enterpriseInfo);
-			$scope.enAdminuu = $scope.enterpriseInfo.enAdminuu;
-			User.getUserByUU({uu: $scope.enAdminuu}, {}, function(data){
-		        	$scope.adminInfo = data;
-		        	console.log($scope.adminInfo);
-		        }, function(){
-		        	toaster.pop('error', '获取管理员信息失败');
-		        });
-		},function(response) {
-			toaster.pop('error', '获取企业信息失败');
-		});
 
+		var getEnterprise = function () {
+			// 获取企业信息
+			Enterprise.getEnterpriseInfo({enuu : $scope.userInfo.enterprise.uu}, function(data) {
+				$scope.enterpriseInfo = data;
+				$scope.enterpriseInfoBackup = angular.copy($scope.enterpriseInfo);
+				$scope.enAdminuu = $scope.enterpriseInfo.enAdminuu;
+				User.getUserByUU({uu: $scope.enAdminuu}, {}, function(data){
+					$scope.adminInfo = data;
+					console.log($scope.adminInfo);
+				}, function(){
+					toaster.pop('error', '获取管理员信息失败');
+				});
+			},function(response) {
+				toaster.pop('error', '获取企业信息失败');
+			});
+		}
+		if ($scope.userInfo.enterprise) {
+			getEnterprise();
+		} else {
+			AuthenticationService.getAuthentication().success(function (data) {
+				$scope.userInfo = data;
+				getEnterprise();
+			}, function (error) {
+				toaster.pop('error', '获取用户信息失败');
+			})
+		}
 		$scope.tableParams = new ngTableParams({
 			page : 1, // show first page
 			count : 10 // count per page