Browse Source

企业排序

yangc 8 years ago
parent
commit
9efeb2c202

+ 8 - 1
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -131,7 +131,14 @@ define([ 'app/app' ], function(app) {
 						}
 					}
 					$scope.userInfo = data;
-					// 增加收藏功能的代码
+                    $scope.sortEnterprises = $scope.userInfo.enterprises || [];
+                    if ($scope.sortEnterprises.length) {
+                        $scope.sortEnterprises.sort(function (a, b) {
+                            return b.lastLoginTime - a.lastLoginTime;
+                        })
+                    }
+
+                    // 增加收藏功能的代码
 					$rootScope.userInfo = data;
 					$rootScope.brandCount = 0;
 					$rootScope.componentCount = 0;

+ 1 - 1
src/main/webapp/resources/js/sale/app.js

@@ -57,7 +57,7 @@ define([ 'angularAMD', 'ngRoute', 'ui-bootstrap', 'ngLocal', 'common/services',
 	    $scope.userInfo = {};
 	    AuthenticationService.getAuthentication().success(function(data){
 	    	$scope.userInfo = data;
-	    	
+
 			//增加收藏功能的代码
 			$rootScope.userInfo = data;
 			$rootScope.brandCount = 0;

+ 1 - 1
src/main/webapp/resources/view/common/site-nav.html

@@ -199,7 +199,7 @@
                 </p>-->
             <div ng-if="userInfo.enterprises && userInfo.enterprises.length > 0" class="switch-enterprise-title">您可切换至以下账户:</div>
                 <ul class="unstyled" style="-webkit-padding-start: 0;">
-                    <li ng-repeat="en in userInfo.enterprises" ng-if="!en.current && userInfo.enterprises" class="switch-enterprises">
+                    <li ng-repeat="en in sortEnterprises" ng-if="!en.current && userInfo.enterprises" class="switch-enterprises">
                         <a href="javascript:void(0)"  ng-bind="en.enName" title="{{en.enName}}" ng-click="switchto(en.uu)"></a>
                     </li>
                     <!--<li ng-if="!userInfo.enterprises">