angular.module('push') .controller('FanCenterCtrl', function ($scope, $stateParams, CommentService, SearchResultService, UtilService, ConstantService, UserService) { //TODO if($scope.app){ $scope.setStatusBar(0); } $scope.defaultLan = UserService.defaultLan; var userId = $stateParams.userid; // var userId = 653; $scope.A_Concerned = function (List) { var w_User = angular.element(document.getElementsByClassName("my_searchButton" + List.userId)); //如果是未关注那么后台去关注 if (List.isFocus == 2) { $scope.showLoadingToast(); SearchResultService.doFocus(2, List.userId).then(function (response) { if (response.status == true) { UtilService.showMess("关注成功!"); } $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }) } w_User.addClass("w_User"); w_User.html("已关注"); List.isFocus = 1; }; //存放粉丝列表 $scope.Fans = []; //存放关注列表 $scope.Users = []; //存放7天访客列表 $scope.Visitors = []; var activity = ['activity', 'personal', 'group']; //第一次点击进内页显示数据 if ($stateParams.act == 'activity') { $scope.showLoadingToast(); CommentService.getMyAttentionList(userId, 0, ConstantService.TRACE_TYPE_2617).then(function (response) { $scope.Users = response.data; $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }); } else if ($stateParams.act == 'personal') { $scope.showLoadingToast(); CommentService.getMyAttentionList(userId, 1, ConstantService.TRACE_TYPE_2617).then(function (response) { $scope.Fans = response.data; $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }); }/* else if ($stateParams.act == 'group') { $scope.showLoadingToast(); CommentService.getMyAttentionList(UserService.id, 2, userId).then(function (response) { $scope.Visitors = response.userList; $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }) }*/ //获取前台传来的第一次点击类型,并切换对应页面 $scope.act = $stateParams.act; $scope.changeAct = function (num) { $scope.showLoadingToast(); //获取关注/粉丝列表(访客列表暂时不做)0关注,1粉丝,2访客 CommentService.getMyAttentionList(userId, num, ConstantService.TRACE_TYPE_2617).then(function (response) { console.log(response.data); if (num == 0) { $scope.Users = response.data; } else if (num == 1) { $scope.Fans = response.data; }/*else if (num == 2) { $scope.Visitors = response.userList; }*/ $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }); //切换到对应页面 $scope.act = activity[num]; }; });