|
|
@@ -1,6 +1,6 @@
|
|
|
define(['app/app', 'jquery-uploadify'], function (app) {
|
|
|
"use strict";
|
|
|
- app.register.controller('vendorStoreApplyCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', '$q', 'BrandActiveAPI', 'Search', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, $q, BrandActiveAPI, Search) {
|
|
|
+ app.register.controller('vendorStoreApplyCtrl', ['$scope', '$rootScope', 'Enterprise', 'StoreInfo', '$modal', 'toaster', '$timeout', '$state', '$q', 'BrandActiveAPI', 'Search','AuthenticationService', function($scope, $rootScope, Enterprise, StoreInfo, $modal, toaster, $timeout, $state, $q, BrandActiveAPI, Search, AuthenticationService) {
|
|
|
$rootScope.active = "vendor_store";
|
|
|
$scope.tab = 'ORIGINAL_FACTORY';
|
|
|
|
|
|
@@ -38,7 +38,6 @@ define(['app/app', 'jquery-uploadify'], function (app) {
|
|
|
$scope.deleteTypeName = '';
|
|
|
$scope.triggerDeleteTip = triggerDeleteTip;
|
|
|
$scope.closeDeleteTip = closeDeleteTip;
|
|
|
- activate();
|
|
|
|
|
|
/**
|
|
|
* 初始化数据获取
|
|
|
@@ -76,7 +75,38 @@ define(['app/app', 'jquery-uploadify'], function (app) {
|
|
|
toaster.pop('error', '获取企业信息失败');
|
|
|
});
|
|
|
}
|
|
|
+ // 获取已登录的用户信息
|
|
|
+ var getAuthentication = function() {
|
|
|
+ return AuthenticationService.getAuthentication().success(function(data) {
|
|
|
+ if(data && data.enterprises) {
|
|
|
+ //data.enterprise = data.enterprises[data.enterprises.length - 1];
|
|
|
+ if(data.enterprises.length > 1) {
|
|
|
+ var enSelect = [];
|
|
|
+ angular.forEach(data.enterprises, function(e){
|
|
|
+ if(e.current)
|
|
|
+ data.enterprise = e;
|
|
|
+ else
|
|
|
+ enSelect.push(e);
|
|
|
+ });
|
|
|
+ data.enSelect = enSelect;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.userInfo = data;
|
|
|
+ // 增加收藏功能的代码
|
|
|
+ $rootScope.userInfo = data;
|
|
|
+ $rootScope.brandCount = 0;
|
|
|
+ $rootScope.componentCount = 0;
|
|
|
|
|
|
+ $scope.isAuthed = data != null && data.userUU;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ //根据用户的信息
|
|
|
+ $q.all([getAuthentication()]).then(function () {
|
|
|
+ if(AuthenticationService.isAuthed()) {
|
|
|
+ activate();
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ });
|
|
|
/**
|
|
|
* 验证分类信息
|
|
|
*/
|