activitySignUpConfirmCtrl.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. angular.module('push')
  2. .controller('activitySignUpConfirmCtrl', function ($scope, $stateParams, ActivityService, UtilService, UserService) {
  3. /* $scope.setStatusBar(1);*/
  4. // $scope.usertype = $stateParams.usertype;
  5. $scope.usertype = UserService.role[0];// 用户角色类型
  6. var orgtype = $scope.usertype == 9 ? 1 : 2;//1企业 2高校
  7. var activityid = $stateParams.activityid;
  8. var count = 0;
  9. var getSignInfo = function () {
  10. $scope.showLoadingToast();
  11. ActivityService.queryIfHasSignupInfo(activityid, orgtype).then(function (response) {
  12. //0:未填写报名信息 1: 已填写报名信息 2:已报名
  13. $scope.ifhassignup = response.ifhassignup;
  14. $scope.weburl = response.weburl;
  15. count++;
  16. hideLoading();
  17. }, function () {
  18. count++;
  19. hideLoading();
  20. });
  21. // 根据不同角色进行查询
  22. if ($scope.usertype == 9) {
  23. // 获取企业报名信息
  24. ActivityService.getCompanySignupInfo().then(function (response) {
  25. // console.log(response);
  26. if (angular.isDefined(response.company) && response.company.length > 0) {
  27. $scope.company = response.company[0];
  28. }
  29. $scope.product = response.company_product_lk;
  30. $scope.techrequirement = response.company_techrequirement_lk;
  31. count++;
  32. hideLoading();
  33. }, function () {
  34. count++;
  35. hideLoading();
  36. });
  37. } else {
  38. // 获取专家报名信息
  39. ActivityService.getSignupInfo().then(function (response) {
  40. // console.log(response);
  41. if (angular.isDefined(response.signupdata) && response.signupdata.length > 0) {
  42. $scope.signinfo = response.signupdata[0];
  43. }
  44. $scope.researchfinding = response.researchfinding;
  45. $scope.teammember = response.teammember;
  46. count++;
  47. hideLoading();
  48. }, function () {
  49. count++;
  50. hideLoading();
  51. });
  52. }
  53. };
  54. getSignInfo();
  55. // 关闭加载动画
  56. var hideLoading = function () {
  57. if (count == 2) {
  58. $scope.hideLoadingToast();
  59. count = 0;
  60. }
  61. };
  62. // 报名
  63. $scope.goSignup = function () {
  64. $scope.showLoadingToast();
  65. var signupid = $scope.usertype == 9 ? $scope.company.companyid : $scope.signinfo.signupid;
  66. ActivityService.signup(activityid, signupid, orgtype).then(function (response) {
  67. // console.log(response);
  68. UtilService.showMess("您已报名成功");
  69. $scope.ifhassignup = 2;
  70. $scope.hideLoadingToast();
  71. }, function () {
  72. $scope.hideLoadingToast();
  73. })
  74. };
  75. });