activityCenterCtrl.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. angular.module('push')
  2. .controller('activityCenterCtrl', function ($scope, $stateParams, ActivityService, $timeout, ConfigService, UtilService, UserService, $ionicModal, $ionicActionSheet) {
  3. if($scope.app){
  4. $scope.setStatusBar(1);
  5. }
  6. $scope.showtoast = false;
  7. var authstatus = 0;// 0 未认证 1 认证
  8. // 获取所有活动信息
  9. var getActivityList = function () {
  10. $scope.showLoadingToast();
  11. ActivityService.getUserAuth().then(function (response) {
  12. authstatus = response.result;
  13. }, function () {
  14. });
  15. ActivityService.getActivityList().then(function (response) {
  16. // console.log(response);
  17. $scope.activitylist = response.recordList;
  18. $scope.hideLoadingToast();
  19. }, function () {
  20. $scope.hideLoadingToast();
  21. })
  22. };
  23. getActivityList();
  24. // 活动页面快捷入口路由跳转
  25. $scope.goNextPage = function (index, act) {
  26. switch (index) {
  27. case 1:
  28. // 通知
  29. $scope.go("activityNotice", {activityid: act.id, title: act.title});
  30. break;
  31. case 2:
  32. // 通知管理
  33. $scope.go("activityNoticeManger", {
  34. activityid: act.id,
  35. title: act.title,
  36. status: act.status,
  37. days: act.activityLeaveDays
  38. });
  39. break;
  40. case 3:
  41. // 报名
  42. if (authstatus == 1 || authstatus == 2) {
  43. $scope.go("activitySignUpConfirm", {activityid: act.id});
  44. } else {
  45. UtilService.showMess("您还未认证!");
  46. $timeout(function () {
  47. $scope.go('personIdentify');
  48. }, 1000);
  49. }
  50. break;
  51. case 4:
  52. // 高校报名管理
  53. $scope.go("activitySchoolSignUpManger", {
  54. activityid: act.id,
  55. title: act.title,
  56. visittime: act.visitclosingdate
  57. });
  58. break;
  59. case 5:
  60. // 企业报名管理
  61. $scope.go("activityCompanySignUpManger", {
  62. activityid: act.id,
  63. title: act.title,
  64. visittime: act.visitclosingdate
  65. });
  66. break;
  67. case 6:
  68. // 参与企业
  69. if (authstatus == 1 || authstatus == 2) {
  70. $scope.go("activityCompanyList", {activityid: act.id});
  71. } else {
  72. UtilService.showMess("您还未认证!");
  73. $timeout(function () {
  74. $scope.go('personIdentify');
  75. }, 1000);
  76. }
  77. break;
  78. case 7:
  79. // 活动统计
  80. $scope.go("activityStatistics", {activityid: act.id});
  81. break;
  82. case 8:
  83. // 活动安排管理
  84. $scope.go("activityArrangeManger", {activityid: act.id});
  85. break;
  86. case 9:
  87. // 签到
  88. checkIntime(act.id);
  89. break;
  90. case 10:
  91. // 反馈(1、非企业用户:1.1 未填写过进入填写页面,1.2 已填写过进入列表 2、企业用户:填写本企业的走访反馈列表)
  92. if (UserService.role[0] <= 8 && UserService.role[0] != 1) {
  93. ActivityService.checkFollowupInfo(act.id).then(function (response) {
  94. if (response.result == 0) {
  95. $scope.go("activityFeedBack", {activityid: act.id, title: act.title});
  96. } else {
  97. $scope.go("activityFeedBackList", {activityid: act.id, title: act.title});
  98. }
  99. }, function () {
  100. });
  101. } else {
  102. $scope.go("activityCompanyViewFeedList", {activityid: act.id});
  103. }
  104. break;
  105. case 11:
  106. // 活动安排
  107. if (UserService.role[0] <= 8 && UserService.role[0] != 1) {
  108. $scope.go("activityArrange", {activityid: act.id});
  109. } else {
  110. $scope.go("activityCompanyArrange", {activityid: act.id});
  111. }
  112. break;
  113. case 12:
  114. // 反馈管理
  115. $scope.go("activityBackManger", {activityid: act.id});
  116. break;
  117. case 13:
  118. // 签到管理
  119. $scope.go("activitySignManger", {activityid: act.id});
  120. break;
  121. case 14:
  122. // 备案
  123. $scope.go("activityRecord");
  124. break;
  125. case 15:
  126. // 备案管理
  127. $scope.go("activityReacordManger");
  128. break;
  129. case 16:
  130. // 选择企业
  131. $scope.go("activityChooseCompany", {activityid: act.id});
  132. break;
  133. case 17:
  134. // 报名信息
  135. $scope.go("activitySignUpInfo", {activityid: act.id});
  136. break;
  137. case 18:
  138. // 选择专家
  139. $scope.go("activityChooseTeacher", {activityid: act.id});
  140. break;
  141. default:
  142. break;
  143. }
  144. };
  145. // 活动是否弹出签到弹窗(否临时人员:弹窗,已报名:直接签到)
  146. var activityid = 0;
  147. var checkIntime = function (actid) {
  148. activityid = actid;
  149. $scope.showLoadingToast();
  150. ActivityService.checkIntime(activityid).then(function (response) {
  151. // console.log(response);
  152. if (response.result == 1) {
  153. $scope.userinfo = response.userinfo;
  154. $scope.categoryModal.show();
  155. $scope.hideLoadingToast();
  156. } else {
  157. checkIn();
  158. }
  159. }, function () {
  160. $scope.hideLoadingToast();
  161. })
  162. };
  163. // 签到
  164. var checkIn = function () {
  165. ActivityService.getCheckInStatus(activityid).then(function (response) {
  166. // 0未签到,1已签到
  167. if (response.result == 0) {
  168. ActivityService.checkIn(activityid, ConfigService.location.lat, ConfigService.location.lng).then(function (response) {
  169. // console.log(response);
  170. if (response.result == 1) {
  171. UtilService.showMess("签到成功");
  172. } else {
  173. UtilService.showMess("网络不给力,请重试");
  174. }
  175. $scope.hideLoadingToast();
  176. }, function () {
  177. $scope.hideLoadingToast();
  178. UtilService.showMess("网络不给力,请重试");
  179. });
  180. } else {
  181. UtilService.showMess("您已成功签到");
  182. $scope.hideLoadingToast();
  183. }
  184. }, function () {
  185. UtilService.showMess("网络不给力,请重试");
  186. $scope.hideLoadingToast();
  187. });
  188. };
  189. // 临时人员签到
  190. $scope.tempCheckin = function () {
  191. if (!UtilService.isDefined($scope.userinfo.name)) {
  192. UtilService.showMess("姓名不能为空");
  193. return;
  194. }
  195. if (!UtilService.isDefined($scope.userinfo.university)) {
  196. UtilService.showMess("所属院校不能为空");
  197. return;
  198. }
  199. $scope.showLoadingToast();
  200. ActivityService.tempCheckIn(activityid, ConfigService.location.lat, ConfigService.location.lng, $scope.userinfo).then(function (response) {
  201. // console.log(response);
  202. if (response.result == 1) {
  203. UtilService.showMess("签到成功");
  204. $timeout(function () {
  205. $scope.categoryModal.hide();
  206. }, 300);
  207. } else {
  208. UtilService.showMess("网络不给力,请重试");
  209. }
  210. $scope.hideLoadingToast();
  211. }, function () {
  212. UtilService.showMess("网络不给力,请重试");
  213. $scope.hideLoadingToast();
  214. });
  215. };
  216. //关闭报名入口
  217. $scope.closeCategoryModal = function () {
  218. $scope.categoryModal.hide();
  219. };
  220. $ionicModal.fromTemplateUrl("templates/modal.html", {
  221. scope: $scope,
  222. animation: 'slide-in-up'
  223. }).then(function (modal) {
  224. $scope.categoryModal = modal;
  225. });
  226. //获取研究领域标签
  227. var buttons = [];
  228. var getLabelList = function () {
  229. ActivityService.getCategory().then(function (response) {
  230. // console.log(response);
  231. angular.forEach(response, function (value, index) {
  232. var temphtml = {
  233. text: '<a class="action-sheet-push">' + value.name + '</a>',
  234. category: value.name,
  235. id: value.id
  236. };
  237. buttons.push(temphtml);
  238. });
  239. }, function () {
  240. })
  241. };
  242. getLabelList();
  243. //选择研究领域
  244. $scope.showDockingStatus = function () {
  245. $ionicActionSheet.show({
  246. buttons: buttons,
  247. cancelText: '取消',
  248. buttonClicked: function (index) {
  249. $scope.userinfo.categoryid = buttons[index].id;
  250. $scope.userinfo.category = buttons[index].category;
  251. return true;
  252. }
  253. });
  254. };
  255. });