activityChooseTeacherCtrl.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. angular.module('push')
  2. .controller('activityChooseTeacherCtrl', function ($scope, $stateParams, ActivityService, UtilService, $timeout) {
  3. /* $scope.setStatusBar(1);*/
  4. var activityid = $stateParams.activityid;
  5. var getIntentionStatus = function () {
  6. $scope.showLoadingToast();
  7. ActivityService.getIntentionStatus(activityid).then(function (response) {
  8. // console.log(response);
  9. // result 0未选择 1已选择
  10. $scope.intentionstatus = response.result;
  11. getSelUnivInfo();
  12. }, function () {
  13. $scope.hideLoadingToast();
  14. $scope.hideLoadingToast();
  15. })
  16. };
  17. getIntentionStatus();
  18. // 获取参与专家列表
  19. var getSelUnivInfo = function () {
  20. $scope.showLoadingToast();
  21. ActivityService.getSelUnivInfo(" ", " ", activityid).then(function (response) {
  22. // console.log(response);
  23. $scope.expertlist = response.teachers;
  24. $scope.hideLoadingToast();
  25. }, function () {
  26. $scope.hideLoadingToast();
  27. })
  28. };
  29. var indexlist = [];
  30. $scope.selectedLength = 0;
  31. // 选择专家
  32. $scope.selectOrgType = function (intentionid, index) {
  33. if($scope.intentionstatus != 0){
  34. return;
  35. }
  36. if ($scope.expertlist[index].isChecked) {
  37. var ind = indexlist.indexOf(index);
  38. indexlist.splice(ind);
  39. } else {
  40. indexlist.push(intentionid);
  41. }
  42. $scope.expertlist[index].isChecked = !$scope.expertlist[index].isChecked;
  43. $scope.selectedLength = indexlist.length;
  44. };
  45. // 提交专家
  46. $scope.submitExpert = function () {
  47. $scope.showLoadingToast();
  48. var idlist = indexlist.join(",");
  49. ActivityService.submitSelUnivInfo(activityid, idlist).then(function (response) {
  50. // console.log(response);
  51. if (response.result == 1) {
  52. UtilService.showMess("提交成功!");
  53. $timeout(function () {
  54. $scope.goback();
  55. }, 1000);
  56. }
  57. $scope.hideLoadingToast();
  58. }, function () {
  59. $scope.hideLoadingToast();
  60. })
  61. };
  62. // 进入专家信息页
  63. $scope.goEpxertDeatil = function (userid) {
  64. $scope.go("activityChooseTeacherDetail", {userid: userid})
  65. };
  66. });