participantListCtrl.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * Created by pushkeji on 2018/12/27.
  3. */
  4. angular.module('push')
  5. .controller('participantListCtrl', ['$scope', 'activitiesModuleService', '$timeout', '$q', 'UserService', '$stateParams', 'ResourceLibraryService', '$ionicSlideBoxDelegate', 'CommentService', 'ConfigService', 'ScienceCircleService', 'CommonService', '$ionicScrollDelegate', 'ConstantService', '$ionicActionSheet', 'UtilService', 'ShareService', 'dataToolsService', '$sce', '$ionicPopup', function ($scope, activitiesModuleService, $timeout, $q, UserService, $stateParams, ResourceLibraryService, $ionicSlideBoxDelegate, CommentService, ConfigService, ScienceCircleService, CommonService, $ionicScrollDelegate, ConstantService, $ionicActionSheet, UtilService, ShareService, dataToolsService, $sce, $ionicPopup) {
  6. console.log($stateParams);
  7. $scope.isShowApplayStatusList = ["5302"];
  8. $scope.isShowApplay = true; // 显示【添加报名】按钮
  9. // 判断是否显示【添加报名】按钮
  10. if ($scope.isShowApplayStatusList.includes($stateParams.status)) {
  11. $scope.isShowApplay = false;
  12. }
  13. $scope.showModal = false;
  14. if (localStorage.applyShowModal == 'true') {
  15. $scope.showModal = true;
  16. $scope.applyerDetail = JSON.parse(localStorage.applyerDetail);
  17. }
  18. var activityid = $stateParams.activityid;
  19. var pagenum = 1, pagesize = 15;
  20. var getAllData = function () {
  21. activitiesModuleService.participantList(activityid, pagenum, pagesize).then(function (res) {
  22. if (res.code == 3350) {
  23. $scope.allList = res.data;
  24. }
  25. })
  26. }
  27. getAllData();
  28. $scope.addApplyPerson = function () {
  29. $scope.go('activityApply', { settingItems: $stateParams.settingItems, activityid: activityid, comfrom: 'participantList' });
  30. }
  31. // 删除报名
  32. $scope.deleteActivityUsers = function (targetid, name) {
  33. // var alertPopup = $ionicPopup.alert({
  34. // title: '警告',
  35. // template: '确定要删除该报名人员吗?'
  36. // });
  37. // alertPopup.then(function() {
  38. // activitiesModuleService.deleteActivityUsers(activityid,targetid).then(function(res){
  39. // console.log(res);
  40. // if(res.code==3350){
  41. // getAllData();
  42. // if($scope.app){
  43. // UtilService.showMess("报名人员移除成功");
  44. // }else{
  45. // CommonService.showMessage("报名人员移除成功",$scope);
  46. // }
  47. // }
  48. // })
  49. // });
  50. var confirmPopup = $ionicPopup.confirm({
  51. title: '警告',
  52. template: '确定要删除 ' + name + ' 吗?'
  53. });
  54. confirmPopup.then(function (res) {
  55. if (res) {
  56. activitiesModuleService.deleteActivityUsers(activityid, targetid).then(function (res) {
  57. if (res.code == 3350) {
  58. getAllData();
  59. if ($scope.app) {
  60. UtilService.showMess("报名人员移除成功");
  61. } else {
  62. CommonService.showMessage("报名人员移除成功", $scope);
  63. }
  64. }
  65. })
  66. } else {
  67. // console.log('You are not sure');
  68. }
  69. });
  70. };
  71. $scope.gobackToWhere = function () {
  72. localStorage.applyShowModal = false;
  73. $scope.applyerDetail = {};
  74. $scope.go('activityDetail', { activityid: activityid });
  75. }
  76. // 获取报名人员详情
  77. $scope.getApplyDetail = function (userid) {
  78. $scope.showModal = true;
  79. activitiesModuleService.getApplyDetail(activityid, userid).then(function (res) {
  80. if (res.code == 3350) {
  81. $scope.applyerDetail = res.data;
  82. localStorage.applyerDetail = JSON.stringify(res.data);
  83. }
  84. })
  85. }
  86. $scope.goPublisher = function (id) {
  87. // console.log(id);
  88. if (id != 0) {
  89. $scope.go('publisher', { Id: id });
  90. }
  91. }
  92. $scope.goToResourceDetail = function (list) {
  93. localStorage.applyShowModal = true;
  94. $scope.go('resourceCommonInfoDetailsPage', {
  95. resid: list.itemvalue,
  96. isAllVisitor: 0,
  97. pagecode: list.item.pagecode,
  98. node: list.item.node,
  99. comfrom: 'participantList',//录入信息
  100. orgtype: list.item.orgtype,
  101. templettype: list.item.pageid,
  102. // label:JSON.stringify(resource.otherObj),
  103. });
  104. }
  105. //添加报名人员
  106. $scope.addApplyPeople = function () {
  107. $scope.go('activityApply', { settingItems: $stateParams.settingItems, activityid: activityid });
  108. }
  109. }]);