identifyStatusCtrl.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /**
  2. * Created by pushkeji on 2018/10/12.
  3. */
  4. angular.module('push')
  5. .controller('identifyStatusCtrl', ['$scope', '$stateParams', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', 'dataToolsService', '$sce', 'AccountService', 'UserService', '$ionicSlideBoxDelegate', '$timeout', '$state', '$http', 'ConfigService', 'CommonService', '$ionicPopup', 'ResourceLibraryService', 'taskModuleService', function ($scope, $stateParams, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, dataToolsService, $sce, AccountService, UserService, $ionicSlideBoxDelegate, $timeout, $state, $http, ConfigService, CommonService, $ionicPopup, ResourceLibraryService, taskModuleService) {
  6. console.log($stateParams);
  7. $scope.node = UserService.node;
  8. $scope.attachedorg = '';
  9. $scope.showFinish = false;
  10. $scope.pageTitle = $stateParams.pageTitle;
  11. $scope.code = $stateParams.code;
  12. $scope.type = $stateParams.type;
  13. $scope.failMessage = "";
  14. var id = 0;
  15. var userid
  16. // $scope.type=5102;
  17. if ($scope.type == 5102 || $scope.type == 5103 || $scope.type == 5104) {
  18. $scope.showFinish = true;
  19. }
  20. //桐庐节点技术经纪人审核失败获取失败信息
  21. var getFailMesage = function () {
  22. if (UserService.node == '330122000') {
  23. AccountService.getFailMessage($stateParams.id).then(function (res) {
  24. console.log(res)
  25. if (res.code == 3350) {
  26. $scope.failMessage = res.data;
  27. var search = $scope.failMessage ? $scope.failMessage.search('null') : null;
  28. if ($scope.failMessage == null || search != -1) {
  29. $scope.failMessage = "";
  30. }
  31. }
  32. })
  33. }
  34. }
  35. getFailMesage();
  36. var getInfo = function () {
  37. console.log($stateParams.code)
  38. AccountService.getAuthMessageInfo(UserService.id, $stateParams.code).then(function (res) {
  39. console.log(res);
  40. if (res.code == 3350) {
  41. angular.forEach(res.data, function (value, index) {
  42. if (value.applytype == 4801 && (value.authenstatus == 5103 || value.authenstatus == 5104)) {
  43. // $scope.failMessage = value.refusereason;
  44. }
  45. })
  46. var temp = res.data.filter(function (val) {
  47. return val.userid == UserService.id
  48. });
  49. console.log(temp);
  50. if (temp.length > 0) {
  51. //$scope.type = temp[0].authenstatus;
  52. if ($scope.type == 5102 || $scope.type == 5103 || $scope.type == 5104) {
  53. $scope.showFinish = true;
  54. }
  55. var attachedorg = temp[0].attachedorg;
  56. id = temp[0].id;
  57. userid = temp[0].userid
  58. console.log(userid)
  59. var pagecode = $stateParams.code == 4803 ? 1000003 : 1000004;
  60. dataToolsService.getOrganizationModelByOrgname(' ', pagecode, 0, 1).then(function (response) {
  61. console.log(response);
  62. console.log(attachedorg);
  63. if (response.data.length > 0) {
  64. var tt = response.data.filter(function (vv) {
  65. return vv.id == attachedorg;
  66. });
  67. if (tt.length > 0) {
  68. $scope.attachedorg = tt[0].name;
  69. }
  70. }
  71. }, function () {
  72. });
  73. } else {
  74. $scope.type = 5100;
  75. $scope.showFinish = false;
  76. }
  77. }
  78. })
  79. }
  80. getInfo();
  81. $scope.goTaskRelease = function () {
  82. $scope.go('taskRelease', { userIsBroker: true });
  83. }
  84. $scope.reSubmit = function () {
  85. console.log('重新认证', id, $stateParams.pageTitle, $stateParams.comfrom)
  86. if (UserService.node == '330122000' && $scope.code == 4801) {
  87. $scope.go('identifyFormForTongLu', {
  88. code: $stateParams.code,
  89. type: 5103,
  90. action: 'submit',
  91. id: id,
  92. userid: userid,
  93. comfrom: 'resubmit',
  94. pageTitle: $stateParams.pageTitle,
  95. url: $stateParams.comfrom
  96. })
  97. }
  98. else {
  99. $scope.go('identifyForm', {
  100. code: $stateParams.code,
  101. type: 5103,
  102. action: 'submit',
  103. id: id,
  104. comfrom: 'resubmit',
  105. pageTitle: $stateParams.pageTitle,
  106. url: $stateParams.comfrom
  107. })
  108. }
  109. }
  110. $scope.goListPage = function () {
  111. if ($stateParams.comfrom && $stateParams.comfrom != 'resubmit') {
  112. $scope.go($stateParams.comfrom);
  113. } else if ($stateParams.code == 4800 || $stateParams.code == 4801 || $stateParams.code == 4802) {
  114. $scope.go('identifySystem', { action: 'submit' });
  115. } else {
  116. $scope.go('identifyDetail', { pageTitle: $scope.pageTitle, code: $scope.code, action: 'submit' });
  117. }
  118. }
  119. var taskSwiper;
  120. var taskSwiperFn = function () {
  121. taskSwiper = new Swiper('.swiper-container-newest-task', {
  122. // loop: true, // 循环模式选项
  123. slidesPerView: $scope.isapp ? 2 : 5,
  124. spaceBetween: 10,
  125. // 如果需要分页器
  126. pagination: {
  127. el: '.swiper-pagination',
  128. },
  129. // 如果需要前进后退按钮
  130. navigation: {
  131. nextEl: '.swiper-button-next',
  132. prevEl: '.swiper-button-prev',
  133. },
  134. on: {
  135. tap: function (e) {
  136. console.log(this.clickedIndex);
  137. e.stopPropagation();
  138. if (e.target.className == 'swiper-button-next') {
  139. this.slideNext();
  140. } else if (e.target.className == 'swiper-button-prev') {
  141. this.slidePrev();
  142. } else if (this.clickedIndex || this.clickedIndex == 0) {
  143. if (!ConfigService.islogin) {
  144. if (localStorage.wxFlag == "true") {
  145. if (localStorage.isUserFocusXW == 0) {
  146. var title = localStorage.appidStr;
  147. $ionicPopup.alert({
  148. title: '提示',
  149. template: '请先关注微信公众号"' + title + '"!'
  150. });
  151. return;
  152. } else {
  153. if (localStorage.isUserBindWx == 0) {
  154. var wxFlag = JSON.parse(localStorage.params);
  155. if (wxFlag.weChatModel) {
  156. $scope.go('bindPhone', {
  157. params: localStorage.params,
  158. comfrom: 'maincontroller',
  159. url: window.location.href.split('#/')[1]
  160. });
  161. } else {
  162. $scope.go('login');
  163. return;
  164. }
  165. } else {
  166. $scope.go('login');
  167. return;
  168. }
  169. }
  170. } else {
  171. $scope.go('login');
  172. return;
  173. }
  174. } else {
  175. var list = $scope.allTaskData[this.clickedIndex];
  176. if (list.noSuthority) {
  177. var alertPopup = $ionicPopup.alert({
  178. title: '提示',
  179. template: '自任务发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。'
  180. });
  181. return;
  182. }
  183. console.log(list);
  184. $scope.go('taskDetail', {
  185. resid: list.unique,
  186. node: list.source,
  187. title: list.title,
  188. restype: list.type,
  189. comefrom: 'tab.activityIndex',
  190. ifjoin: list.otherObj.ifjoin,
  191. actions: list.otherObj.actions,
  192. taskstatus: list.otherObj.taskstatus,
  193. taskid: list.otherObj.id,
  194. opentowho: list.otherObj.opentowho,
  195. });
  196. }
  197. }
  198. }
  199. },
  200. // 如果需要滚动条
  201. // scrollbar: {
  202. // el: '.swiper-scrollbar',
  203. // },
  204. })
  205. }
  206. // $scope.showLoadingToast();
  207. $scope.allTaskData = [];
  208. // 获取任务分类标签
  209. // dataToolsService.getTypeEntryListByTypeName('usertask_type').then(function(res){
  210. taskModuleService.getAllTaskLable(UserService.node).then(function (res) {
  211. console.log(res);
  212. $scope.labelList = [{
  213. itemvalue: 0,
  214. itemkey: '全部',
  215. isSelected: true
  216. }];
  217. if (res.code == 3350) {
  218. angular.forEach(res.data, function (val) {
  219. val.isSelected = false;
  220. })
  221. $scope.labelList = $scope.labelList.concat(res.data);
  222. }
  223. });
  224. // 获取任务列表
  225. $scope.getTaskList = function (tasktype, index) {
  226. console.log($scope.labelList);
  227. if ($scope.labelList) {
  228. angular.forEach($scope.labelList, function (val) {
  229. val.isSelected = false;
  230. })
  231. $scope.labelList[index].isSelected = true;
  232. }
  233. $scope.allTaskData = [];
  234. $scope.showNoData = false;
  235. $scope.showLoading = true;
  236. taskModuleService.getAllTaskList(UserService.node, 0, tasktype, '', 1, 10).then(function (res) {
  237. console.log(res);
  238. $scope.showLoading = false;
  239. if (res.code == 3350) {
  240. $scope.allTaskData = res.data;
  241. angular.forEach($scope.allTaskData, function (val) {
  242. val.noSuthority = false;
  243. if (val.otherObj.creator != UserService.id && val.otherObj.taskstatus == 5300 && !val.otherObj.actions) {
  244. val.noSuthority = true;
  245. }
  246. })
  247. $scope.showNoData = res.data.length == 0;
  248. $timeout(function () {
  249. taskSwiperFn();
  250. console.log(taskSwiper)
  251. }, 200)
  252. }
  253. })
  254. }
  255. $scope.getTaskList(0);
  256. // 标签点击事件
  257. // $scope.goToTaskDetail=function(list){
  258. // if(!ConfigService.islogin){
  259. //
  260. // }else{
  261. // console.log(list);
  262. // $scope.go('taskDetail',{
  263. // resid:list.unique,
  264. // node:list.source,
  265. // title:list.title,
  266. // restype:list.type,
  267. // comefrom:'allTask',
  268. // ifjoin:list.otherObj.ifjoin
  269. // });
  270. // }
  271. // }
  272. }])
  273. ;