notificationCtrl.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. angular.module('push')
  2. .controller('notificationCtrl', function ($scope, ResourceLibraryService, ConfigService, UserService, CommentService, UtilService, $timeout, CommonService) {
  3. $scope.keyfilter = {};
  4. var getNoticeList = function () {
  5. ResourceLibraryService.getClaidInfo(UserService.node).then(function (res) {
  6. if (res.code == 3350) {
  7. var reclibid = res.data;
  8. ResourceLibraryService.getFirstResourceList(33, reclibid, 0, $scope.keyfilter.key, "enterprisescale,desc", 0, 0, "", "").then(function (res) {
  9. if (res.code == 3350) {
  10. $scope.datalist = res.data;
  11. }
  12. })
  13. }
  14. })
  15. }
  16. getNoticeList();
  17. //发布通知公告
  18. $scope.sendNotification = function () {
  19. $scope.islogin = ConfigService.islogin;
  20. if (!$scope.islogin) {
  21. $scope.go('login');
  22. return;
  23. }
  24. $scope.go("newNotification");
  25. }
  26. //进入通知公告详情页面
  27. $scope.goNoticeDetail = function (data) {
  28. console.log(data)
  29. $scope.go("notificationDetail", {notice: data, unique: data.unique});
  30. }
  31. ResourceLibraryService.judgeManager(UserService.id, 0).then(function (res) {
  32. $scope.canDoSend = res.data;
  33. })
  34. //虚拟搜索框
  35. $scope.isShowSearchButton = true;
  36. $scope.keyfilter = {key: ""};//搜索关键词
  37. $scope.showSearchButtonLeft = function () {
  38. $scope.isShowSearchButton = false;
  39. $(".showSearchInputForResLibrary").focus();
  40. };
  41. //清空搜索内容
  42. $scope.clearSearch = function () {
  43. $scope.isShowSearchButton = true;
  44. $scope.keyfilter.key = "";
  45. };
  46. $scope.searchResourceList = function () {
  47. $scope.showLoadingToast();
  48. getNoticeList();
  49. $scope.hideLoadingToast();
  50. }, function () {
  51. $scope.hideLoadingToast();
  52. };
  53. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  54. // console.log(res);
  55. $scope.hasAuth = res.data;
  56. })
  57. //设置置顶
  58. $scope.changeStickTop = function (type, resid) {
  59. console.log(resid);
  60. if (type) {
  61. ResourceLibraryService.cancelStickTop(resid).then(function (res) {
  62. console.log(res);
  63. if (res.code == 3350) {
  64. $scope.submitSelected();
  65. }
  66. })
  67. } else {
  68. ResourceLibraryService.stickTop(resid).then(function (res) {
  69. console.log(res);
  70. if (res.code == 3350) {
  71. $scope.submitSelected();
  72. }
  73. })
  74. }
  75. }
  76. $scope.submitSelected = function () {
  77. //重新加载全部企业
  78. $scope.showLoadingToast();
  79. getNoticeList();
  80. $scope.hideLoadingToast();
  81. }
  82. $scope.goback1 = function(){
  83. $scope.go('tab.activityIndex');
  84. }
  85. });