wujingTeacherCtrl.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. angular.module('push')
  2. .controller('wujingTeacherCtrl', function ($q, $scope, $ionicActionSheet, $ionicSlideBoxDelegate, ResourceLibraryService, $stateParams, $timeout, $ionicScrollDelegate,
  3. UtilService, $ionicPopup, $ionicListDelegate, AuthorityService,
  4. UserService, taskModuleService, ConfigService, ActivityService, ConstantService, dataToolsService, CommonService, $ionicModal) {
  5. $scope.moduleid = 44;
  6. $scope.reclibc = $stateParams.reclibc;
  7. taskModuleService.thisUserIsAdmin().then(function (res) {
  8. if (res.code == 3350) {
  9. $scope.isAdmin = res.data;
  10. }
  11. })
  12. var getClaid = function () {
  13. ResourceLibraryService.getClaid($scope.moduleid).then(function (res) {
  14. if (res.code == 3350) {
  15. $scope.data = res.data;
  16. }
  17. })
  18. }
  19. getClaid();
  20. $scope.keyfilter = {key: ""};//搜索关键词
  21. var getAllResourceList = function () {
  22. ResourceLibraryService.getFirstResourceList(44, 231, 0, $scope.keyfilter.key, "enterprisescale,desc", 0, 0, "", "").then(function (res) {
  23. if (res.code == 3350) {
  24. $scope.length = res.data.length;
  25. $scope.allData = res.data;
  26. }
  27. })
  28. }
  29. getAllResourceList();
  30. $scope.goEnterCompanyInfo = function () {
  31. /*$scope.go('visitModularForm', {
  32. companyid: 0,
  33. pageid: 44,
  34. orgtype: 10104,
  35. pagecode: 1000027,
  36. isedit: 0,
  37. node: UserService.node,
  38. pageTitle: '新建导师'
  39. });*/
  40. $scope.go('visitModularForm', {
  41. companyid: 0,
  42. pageid: 20,
  43. orgtype: 10104,
  44. pagecode: 1000035,
  45. isedit: 0,
  46. node: UserService.node,
  47. pageTitle: '新建导师',
  48. innertype: 44
  49. });
  50. }
  51. $scope.deletItem = function (id, node, idx) {
  52. console.log(2);
  53. var data = {
  54. data: {
  55. id: id,
  56. isenabled: 2,
  57. comfrom: node
  58. },
  59. node: node
  60. }
  61. // confirm 对话框
  62. var confirmPopup = $ionicPopup.confirm({
  63. title: '删除确认',
  64. template: '请确认是否要删除此项!',
  65. cancelText: '取消',
  66. okText: '确认',
  67. });
  68. confirmPopup.then(function (res) {
  69. console.log(res);
  70. if (res) {
  71. dataToolsService.saveWebInfo(data).then(function (res) {
  72. if (res.code == 3350) {
  73. if ($scope.app) {
  74. UtilService.showMess('删除成功');
  75. } else {
  76. CommonService.showMessage('删除成功', $scope);
  77. }
  78. getAllResourceList();
  79. } else {
  80. if ($scope.app) {
  81. UtilService.showMess('删除失败');
  82. } else {
  83. CommonService.showMessage('删除失败', $scope);
  84. }
  85. }
  86. })
  87. }
  88. });
  89. }
  90. $scope.goResourceDetail = function (resource) {
  91. if(UserService.id == 0){
  92. if (!ConfigService.islogin) {
  93. if (localStorage.wxFlag == "true") {
  94. if (localStorage.isUserFocusXW == 0) {
  95. var title = localStorage.appidStr;
  96. $ionicPopup.alert({
  97. title: '提示',
  98. template: '请先关注微信公众号"' + title + '"!'
  99. });
  100. return;
  101. } else {
  102. if (localStorage.isUserBindWx == 0) {
  103. var wxFlag = JSON.parse(localStorage.params);
  104. if (wxFlag.weChatModel) {
  105. $scope.go('bindPhone', {
  106. params: localStorage.params,
  107. comfrom: 'maincontroller',
  108. url: window.location.href.split('#/')[1]
  109. });
  110. } else {
  111. $scope.go('login');
  112. return;
  113. }
  114. } else {
  115. $scope.go('login');
  116. return;
  117. }
  118. }
  119. } else {
  120. $scope.go('login');
  121. return;
  122. }
  123. }
  124. }
  125. if (resource.groupid == "0") {
  126. $scope.go('resourceDetails', {
  127. recourceid: resource.unique,
  128. recourcetype: resource.type,
  129. recourcecomefrom: resource.source,
  130. title: resource.title
  131. });
  132. } else {
  133. $scope.go('resourceCommonDetailsPage', {
  134. recourceid: resource.unique,
  135. recourcetype: resource.type,
  136. recourcecomefrom: resource.source,
  137. creator: resource.clickthrough,
  138. title: resource.title,
  139. orgtype: 0,
  140. pagecode: 0,
  141. label: JSON.stringify(resource.otherObj)
  142. });
  143. }
  144. };
  145. //虚拟搜索框
  146. $scope.showSearchButtonLeft = function () {
  147. $scope.isShowSearchButton = false;
  148. $(".showSearchInput").focus();
  149. };
  150. //清空搜索内容
  151. $scope.clearSearch = function () {
  152. $scope.isShowSearchButton = true;
  153. $scope.keyfilter.key = "";
  154. };
  155. // 搜索各种资源信息
  156. $scope.searchResourceList = function () {
  157. $scope.showLoadingToast();
  158. getAllResourceList();
  159. }, function () {
  160. $scope.hideLoadingToast();
  161. };
  162. })
  163. ;