/** * Created by pushkeji on 2018/10/12. */ angular.module('push') .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) { console.log($stateParams); $scope.node = UserService.node; $scope.attachedorg = ''; $scope.showFinish = false; $scope.pageTitle = $stateParams.pageTitle; $scope.code = $stateParams.code; $scope.type = $stateParams.type; $scope.failMessage = ""; var id = 0; var userid // $scope.type=5102; if ($scope.type == 5102 || $scope.type == 5103 || $scope.type == 5104) { $scope.showFinish = true; } //桐庐节点技术经纪人审核失败获取失败信息 var getFailMesage = function () { if (UserService.node == '330122000') { AccountService.getFailMessage($stateParams.id).then(function (res) { console.log(res) if (res.code == 3350) { $scope.failMessage = res.data; var search = $scope.failMessage ? $scope.failMessage.search('null') : null; if ($scope.failMessage == null || search != -1) { $scope.failMessage = ""; } } }) } } getFailMesage(); var getInfo = function () { console.log($stateParams.code) AccountService.getAuthMessageInfo(UserService.id, $stateParams.code).then(function (res) { console.log(res); if (res.code == 3350) { angular.forEach(res.data, function (value, index) { if (value.applytype == 4801 && (value.authenstatus == 5103 || value.authenstatus == 5104)) { // $scope.failMessage = value.refusereason; } }) var temp = res.data.filter(function (val) { return val.userid == UserService.id }); console.log(temp); if (temp.length > 0) { //$scope.type = temp[0].authenstatus; if ($scope.type == 5102 || $scope.type == 5103 || $scope.type == 5104) { $scope.showFinish = true; } var attachedorg = temp[0].attachedorg; id = temp[0].id; userid = temp[0].userid console.log(userid) var pagecode = $stateParams.code == 4803 ? 1000003 : 1000004; dataToolsService.getOrganizationModelByOrgname(' ', pagecode, 0, 1).then(function (response) { console.log(response); console.log(attachedorg); if (response.data.length > 0) { var tt = response.data.filter(function (vv) { return vv.id == attachedorg; }); if (tt.length > 0) { $scope.attachedorg = tt[0].name; } } }, function () { }); } else { $scope.type = 5100; $scope.showFinish = false; } } }) } getInfo(); $scope.goTaskRelease = function () { $scope.go('taskRelease', { userIsBroker: true }); } $scope.reSubmit = function () { console.log('重新认证', id, $stateParams.pageTitle, $stateParams.comfrom) if (UserService.node == '330122000' && $scope.code == 4801) { $scope.go('identifyFormForTongLu', { code: $stateParams.code, type: 5103, action: 'submit', id: id, userid: userid, comfrom: 'resubmit', pageTitle: $stateParams.pageTitle, url: $stateParams.comfrom }) } else { $scope.go('identifyForm', { code: $stateParams.code, type: 5103, action: 'submit', id: id, comfrom: 'resubmit', pageTitle: $stateParams.pageTitle, url: $stateParams.comfrom }) } } $scope.goListPage = function () { if ($stateParams.comfrom && $stateParams.comfrom != 'resubmit') { $scope.go($stateParams.comfrom); } else if ($stateParams.code == 4800 || $stateParams.code == 4801 || $stateParams.code == 4802) { $scope.go('identifySystem', { action: 'submit' }); } else { $scope.go('identifyDetail', { pageTitle: $scope.pageTitle, code: $scope.code, action: 'submit' }); } } var taskSwiper; var taskSwiperFn = function () { taskSwiper = new Swiper('.swiper-container-newest-task', { // loop: true, // 循环模式选项 slidesPerView: $scope.isapp ? 2 : 5, spaceBetween: 10, // 如果需要分页器 pagination: { el: '.swiper-pagination', }, // 如果需要前进后退按钮 navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, on: { tap: function (e) { console.log(this.clickedIndex); e.stopPropagation(); if (e.target.className == 'swiper-button-next') { this.slideNext(); } else if (e.target.className == 'swiper-button-prev') { this.slidePrev(); } else if (this.clickedIndex || this.clickedIndex == 0) { if (!ConfigService.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { var list = $scope.allTaskData[this.clickedIndex]; if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自任务发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } console.log(list); $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'tab.activityIndex', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho, }); } } } }, // 如果需要滚动条 // scrollbar: { // el: '.swiper-scrollbar', // }, }) } // $scope.showLoadingToast(); $scope.allTaskData = []; // 获取任务分类标签 // dataToolsService.getTypeEntryListByTypeName('usertask_type').then(function(res){ taskModuleService.getAllTaskLable(UserService.node).then(function (res) { console.log(res); $scope.labelList = [{ itemvalue: 0, itemkey: '全部', isSelected: true }]; if (res.code == 3350) { angular.forEach(res.data, function (val) { val.isSelected = false; }) $scope.labelList = $scope.labelList.concat(res.data); } }); // 获取任务列表 $scope.getTaskList = function (tasktype, index) { console.log($scope.labelList); if ($scope.labelList) { angular.forEach($scope.labelList, function (val) { val.isSelected = false; }) $scope.labelList[index].isSelected = true; } $scope.allTaskData = []; $scope.showNoData = false; $scope.showLoading = true; taskModuleService.getAllTaskList(UserService.node, 0, tasktype, '', 1, 10).then(function (res) { console.log(res); $scope.showLoading = false; if (res.code == 3350) { $scope.allTaskData = res.data; angular.forEach($scope.allTaskData, function (val) { val.noSuthority = false; if (val.otherObj.creator != UserService.id && val.otherObj.taskstatus == 5300 && !val.otherObj.actions) { val.noSuthority = true; } }) $scope.showNoData = res.data.length == 0; $timeout(function () { taskSwiperFn(); console.log(taskSwiper) }, 200) } }) } $scope.getTaskList(0); // 标签点击事件 // $scope.goToTaskDetail=function(list){ // if(!ConfigService.islogin){ // // }else{ // console.log(list); // $scope.go('taskDetail',{ // resid:list.unique, // node:list.source, // title:list.title, // restype:list.type, // comefrom:'allTask', // ifjoin:list.otherObj.ifjoin // }); // } // } }]) ;