technicalBrokerNotReceiveTaskCtrl.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. angular.module('push')
  2. .controller('technicalBrokerNotReceiveTaskCtrl', function ($scope, TechnicalBrokerPublishTrainService, UserService, UtilService) {
  3. $scope.type = 3;// 待接收类别
  4. //虚拟搜索框
  5. $scope.isShowSearchButton = true;
  6. $scope.showSearchButtonLeft = function () {
  7. $scope.isShowSearchButton = false;
  8. $(".showSearchInput").focus();
  9. };
  10. $scope.keyfilter = {key: ""};//搜索关键词
  11. //清空搜索内容
  12. $scope.clearSearch = function () {
  13. $scope.isShowSearchButton = true;
  14. $scope.keyfilter.key = "";
  15. };
  16. $scope.personModel = {
  17. userid: 0,// 用户id
  18. tid: 0// 任务id
  19. };
  20. // 任务列表
  21. $scope.taskinfolist=[
  22. {
  23. userid: 0,
  24. usercomefrom: "000000000",
  25. id: 0,
  26. taskstyle: 0,
  27. taskstylename: "",
  28. title: "",
  29. content: "",
  30. isactive: 1,// 任务状态:是否有效,0无效,1有效
  31. begintime: "",
  32. endtime: "",
  33. taskstatus:1,
  34. taskstatusname:"",// 任务状态名称
  35. signupstatus:1,
  36. signupstatusname:"",// 报名状态名称
  37. taskLeaveDays:5,// 剩余天数
  38. taskcount:5,// 任务总数
  39. signupcount:255,// 已报名任务人总数
  40. isedit:0,// 是否有编辑权限:0无 1有
  41. creator: 0,
  42. creatorname: "",
  43. createtime: "",
  44. creatorphoto: ""// 用户logo
  45. }
  46. ];
  47. // 获取参与待接任务列表
  48. var getTaskInfoList = function (type) {
  49. $scope.showLoadingToast();
  50. TechnicalBrokerPublishTrainService.getTaskInfoList(type).then(function (response) {
  51. console.log(response);
  52. $scope.taskcount = response.taskcount;
  53. $scope.taskinfolist = response.taskinfolist;
  54. console.log($scope.taskinfolist);
  55. $scope.hideLoadingToast();
  56. }, function () {
  57. $scope.hideLoadingToast();
  58. })
  59. };
  60. getTaskInfoList($scope.type);
  61. //任务详情页
  62. $scope.goTaskContent = function (taskid) {
  63. $scope.go("technicalBrokerTaskDetail", {taskid: taskid});
  64. };
  65. // 点击接取
  66. $scope.signupTask = function (infoid) {
  67. $scope.personModel.userid = UserService.id;
  68. $scope.personModel.tid = infoid;
  69. console.log($scope.personModel);
  70. TechnicalBrokerPublishTrainService.signupTask($scope.personModel).then(function (response) {
  71. // console.log(response);
  72. if (response.result > 0) {
  73. UtilService.showMess("接取成功");
  74. $timeout(function () {
  75. }, 1500);
  76. } else {
  77. UtilService.showMess("网络不给力,请重试");
  78. }
  79. $scope.hideLoadingToast();
  80. }, function () {
  81. UtilService.showMess("网络不给力,请重试");
  82. $scope.hideLoadingToast();
  83. })
  84. };
  85. //跳转到已接取的任务
  86. $scope.goHaveReciveTask=function () {
  87. $scope.go("technicalBrokerSelfReceiveTask");
  88. }
  89. });