wujingTechnicalCtrl.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. angular.module('push')
  2. .controller('wujingTechnicalCtrl', 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 = 43;
  6. $scope.isShowSearchButton = true;
  7. $scope.keyfilter = {key: ""};//搜索关键词
  8. $scope.reclibc = $stateParams.reclibc;
  9. $scope.showLoadMore = false;
  10. taskModuleService.thisUserIsAdmin().then(function (res) {
  11. if (res.code == 3350) {
  12. $scope.isAdmin = res.data;
  13. }
  14. })
  15. var getClaid = function () {
  16. ResourceLibraryService.getClaid($scope.moduleid).then(function (res) {
  17. if (res.code == 3350) {
  18. $scope.data = res.data;
  19. }
  20. })
  21. }
  22. getClaid();
  23. var getAllResourceList = function () {
  24. ResourceLibraryService.getFirstResourceList(43, 231, 0, $scope.keyfilter.key, "enterprisescale,desc", 0, 0, "", "").then(function (res) {
  25. if (res.code == 3350) {
  26. $scope.length = res.data.length;
  27. if($scope.length > res.data.length){
  28. $scope.showLoadMore = true;
  29. }
  30. $scope.allData = res.data;
  31. }
  32. })
  33. }
  34. getAllResourceList();
  35. $scope.goback2 = function () {
  36. $scope.go('tab.resourceLibrary',{},{reload:true});
  37. }
  38. $scope.goEnterCompanyInfo = function (moduleid) {
  39. ResourceLibraryService.getPageId(moduleid).then(function (res) {
  40. if (res.code == 3350) {
  41. $scope.go('visitModularForm', {
  42. companyid: 0,
  43. pageid: res.data,
  44. orgtype: moduleid == 6 || moduleid == 43 ? ConstantService.UNITTYPE_10104 : moduleid == 7 ? ConstantService.UNITTYPE_10105 : 0,
  45. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  46. connid: 0,
  47. pagecode: 1000030,
  48. pageTitle: '新建创新创业联盟库',
  49. node: UserService.node,
  50. resourcetype: moduleid,
  51. comfrom: 'privateResource'
  52. });
  53. }
  54. })
  55. }
  56. $scope.deletItem = function (id, node, idx) {
  57. console.log(2);
  58. var data = {
  59. data: {
  60. id: id,
  61. isenabled: 2,
  62. comfrom: node
  63. },
  64. node: node
  65. }
  66. // confirm 对话框
  67. var confirmPopup = $ionicPopup.confirm({
  68. title: '删除确认',
  69. template: '请确认是否要删除此项!',
  70. cancelText: '取消',
  71. okText: '确认',
  72. });
  73. confirmPopup.then(function (res) {
  74. console.log(res);
  75. if (res) {
  76. dataToolsService.saveWebInfo(data).then(function (res) {
  77. if (res.code == 3350) {
  78. if ($scope.app) {
  79. UtilService.showMess('删除成功');
  80. } else {
  81. CommonService.showMessage('删除成功', $scope);
  82. }
  83. getAllResourceList();
  84. } else {
  85. if ($scope.app) {
  86. UtilService.showMess('删除失败');
  87. } else {
  88. CommonService.showMessage('删除失败', $scope);
  89. }
  90. }
  91. })
  92. } else {
  93. // console.log('You are not sure');
  94. }
  95. });
  96. }
  97. $scope.goToUnionDetail = function (resource) {
  98. $scope.islogin = ConfigService.islogin;
  99. if (!$scope.islogin) {
  100. if (localStorage.wxFlag == "true") {
  101. if (localStorage.isUserFocusXW == 0) {
  102. var title = localStorage.appidStr;
  103. $ionicPopup.alert({
  104. title: '提示',
  105. template: '请先关注微信公众号"' + title + '"!'
  106. });
  107. return;
  108. } else {
  109. if (localStorage.isUserBindWx == 0) {
  110. var wxFlag = JSON.parse(localStorage.params);
  111. if (wxFlag.weChatModel) {
  112. $scope.go('bindPhone', {
  113. params: localStorage.params,
  114. comfrom: 'maincontroller',
  115. url: window.location.href.split('#/')[1]
  116. });
  117. } else {
  118. $scope.go('login');
  119. return;
  120. }
  121. } else {
  122. $scope.go('login');
  123. return;
  124. }
  125. }
  126. } else {
  127. $scope.go('login');
  128. return;
  129. }
  130. } else {
  131. $scope.go('wujingTechnicalDetail', {resource: resource});
  132. }
  133. }
  134. //虚拟搜索框
  135. $scope.showSearchButtonLeft = function () {
  136. $scope.isShowSearchButton = false;
  137. $(".showSearchInput").focus();
  138. };
  139. //清空搜索内容
  140. $scope.clearSearch = function () {
  141. $scope.isShowSearchButton = true;
  142. $scope.keyfilter.key = "";
  143. };
  144. // 搜索各种资源信息
  145. $scope.searchResourceList = function () {
  146. $scope.showLoadingToast();
  147. getAllResourceList();
  148. }, function () {
  149. $scope.hideLoadingToast();
  150. };
  151. })
  152. ;