fanCenterCtrl.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. angular.module('push')
  2. .controller('FanCenterCtrl', function ($scope, $stateParams, CommentService, SearchResultService, UtilService, ConstantService, UserService) {
  3. //TODO
  4. if($scope.app){
  5. $scope.setStatusBar(0);
  6. }
  7. $scope.defaultLan = UserService.defaultLan;
  8. var userId = $stateParams.userid;
  9. // var userId = 653;
  10. $scope.A_Concerned = function (List) {
  11. var w_User = angular.element(document.getElementsByClassName("my_searchButton" + List.userId));
  12. //如果是未关注那么后台去关注
  13. if (List.isFocus == 2) {
  14. $scope.showLoadingToast();
  15. SearchResultService.doFocus(2, List.userId).then(function (response) {
  16. if (response.status == true) {
  17. UtilService.showMess("关注成功!");
  18. }
  19. $scope.hideLoadingToast();
  20. }, function () {
  21. $scope.hideLoadingToast();
  22. })
  23. }
  24. w_User.addClass("w_User");
  25. w_User.html("已关注");
  26. List.isFocus = 1;
  27. };
  28. //存放粉丝列表
  29. $scope.Fans = [];
  30. //存放关注列表
  31. $scope.Users = [];
  32. //存放7天访客列表
  33. $scope.Visitors = [];
  34. var activity = ['activity', 'personal', 'group'];
  35. //第一次点击进内页显示数据
  36. if ($stateParams.act == 'activity') {
  37. $scope.showLoadingToast();
  38. CommentService.getMyAttentionList(userId, 0, ConstantService.TRACE_TYPE_2617).then(function (response) {
  39. $scope.Users = response.data;
  40. $scope.hideLoadingToast();
  41. }, function () {
  42. $scope.hideLoadingToast();
  43. });
  44. } else if ($stateParams.act == 'personal') {
  45. $scope.showLoadingToast();
  46. CommentService.getMyAttentionList(userId, 1, ConstantService.TRACE_TYPE_2617).then(function (response) {
  47. $scope.Fans = response.data;
  48. $scope.hideLoadingToast();
  49. }, function () {
  50. $scope.hideLoadingToast();
  51. });
  52. }/* else if ($stateParams.act == 'group') {
  53. $scope.showLoadingToast();
  54. CommentService.getMyAttentionList(UserService.id, 2, userId).then(function (response) {
  55. $scope.Visitors = response.userList;
  56. $scope.hideLoadingToast();
  57. }, function () {
  58. $scope.hideLoadingToast();
  59. })
  60. }*/
  61. //获取前台传来的第一次点击类型,并切换对应页面
  62. $scope.act = $stateParams.act;
  63. $scope.changeAct = function (num) {
  64. $scope.showLoadingToast();
  65. //获取关注/粉丝列表(访客列表暂时不做)0关注,1粉丝,2访客
  66. CommentService.getMyAttentionList(userId, num, ConstantService.TRACE_TYPE_2617).then(function (response) {
  67. console.log(response.data);
  68. if (num == 0) {
  69. $scope.Users = response.data;
  70. } else if (num == 1) {
  71. $scope.Fans = response.data;
  72. }/*else if (num == 2) {
  73. $scope.Visitors = response.userList;
  74. }*/
  75. $scope.hideLoadingToast();
  76. }, function () {
  77. $scope.hideLoadingToast();
  78. });
  79. //切换到对应页面
  80. $scope.act = activity[num];
  81. };
  82. });