123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- angular.module('push')
- .controller('activityCenterCtrl', function ($scope, $stateParams, ActivityService, $timeout, ConfigService, UtilService, UserService, $ionicModal, $ionicActionSheet) {
- if($scope.app){
- $scope.setStatusBar(1);
- }
- $scope.showtoast = false;
- var authstatus = 0;// 0 未认证 1 认证
- // 获取所有活动信息
- var getActivityList = function () {
- $scope.showLoadingToast();
- ActivityService.getUserAuth().then(function (response) {
- authstatus = response.result;
- }, function () {
- });
- ActivityService.getActivityList().then(function (response) {
- // console.log(response);
- $scope.activitylist = response.recordList;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- getActivityList();
- // 活动页面快捷入口路由跳转
- $scope.goNextPage = function (index, act) {
- switch (index) {
- case 1:
- // 通知
- $scope.go("activityNotice", {activityid: act.id, title: act.title});
- break;
- case 2:
- // 通知管理
- $scope.go("activityNoticeManger", {
- activityid: act.id,
- title: act.title,
- status: act.status,
- days: act.activityLeaveDays
- });
- break;
- case 3:
- // 报名
- if (authstatus == 1 || authstatus == 2) {
- $scope.go("activitySignUpConfirm", {activityid: act.id});
- } else {
- UtilService.showMess("您还未认证!");
- $timeout(function () {
- $scope.go('personIdentify');
- }, 1000);
- }
- break;
- case 4:
- // 高校报名管理
- $scope.go("activitySchoolSignUpManger", {
- activityid: act.id,
- title: act.title,
- visittime: act.visitclosingdate
- });
- break;
- case 5:
- // 企业报名管理
- $scope.go("activityCompanySignUpManger", {
- activityid: act.id,
- title: act.title,
- visittime: act.visitclosingdate
- });
- break;
- case 6:
- // 参与企业
- if (authstatus == 1 || authstatus == 2) {
- $scope.go("activityCompanyList", {activityid: act.id});
- } else {
- UtilService.showMess("您还未认证!");
- $timeout(function () {
- $scope.go('personIdentify');
- }, 1000);
- }
- break;
- case 7:
- // 活动统计
- $scope.go("activityStatistics", {activityid: act.id});
- break;
- case 8:
- // 活动安排管理
- $scope.go("activityArrangeManger", {activityid: act.id});
- break;
- case 9:
- // 签到
- checkIntime(act.id);
- break;
- case 10:
- // 反馈(1、非企业用户:1.1 未填写过进入填写页面,1.2 已填写过进入列表 2、企业用户:填写本企业的走访反馈列表)
- if (UserService.role[0] <= 8 && UserService.role[0] != 1) {
- ActivityService.checkFollowupInfo(act.id).then(function (response) {
- if (response.result == 0) {
- $scope.go("activityFeedBack", {activityid: act.id, title: act.title});
- } else {
- $scope.go("activityFeedBackList", {activityid: act.id, title: act.title});
- }
- }, function () {
- });
- } else {
- $scope.go("activityCompanyViewFeedList", {activityid: act.id});
- }
- break;
- case 11:
- // 活动安排
- if (UserService.role[0] <= 8 && UserService.role[0] != 1) {
- $scope.go("activityArrange", {activityid: act.id});
- } else {
- $scope.go("activityCompanyArrange", {activityid: act.id});
- }
- break;
- case 12:
- // 反馈管理
- $scope.go("activityBackManger", {activityid: act.id});
- break;
- case 13:
- // 签到管理
- $scope.go("activitySignManger", {activityid: act.id});
- break;
- case 14:
- // 备案
- $scope.go("activityRecord");
- break;
- case 15:
- // 备案管理
- $scope.go("activityReacordManger");
- break;
- case 16:
- // 选择企业
- $scope.go("activityChooseCompany", {activityid: act.id});
- break;
- case 17:
- // 报名信息
- $scope.go("activitySignUpInfo", {activityid: act.id});
- break;
- case 18:
- // 选择专家
- $scope.go("activityChooseTeacher", {activityid: act.id});
- break;
- default:
- break;
- }
- };
- // 活动是否弹出签到弹窗(否临时人员:弹窗,已报名:直接签到)
- var activityid = 0;
- var checkIntime = function (actid) {
- activityid = actid;
- $scope.showLoadingToast();
- ActivityService.checkIntime(activityid).then(function (response) {
- // console.log(response);
- if (response.result == 1) {
- $scope.userinfo = response.userinfo;
- $scope.categoryModal.show();
- $scope.hideLoadingToast();
- } else {
- checkIn();
- }
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- // 签到
- var checkIn = function () {
- ActivityService.getCheckInStatus(activityid).then(function (response) {
- // 0未签到,1已签到
- if (response.result == 0) {
- ActivityService.checkIn(activityid, ConfigService.location.lat, ConfigService.location.lng).then(function (response) {
- // console.log(response);
- if (response.result == 1) {
- UtilService.showMess("签到成功");
- } else {
- UtilService.showMess("网络不给力,请重试");
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- UtilService.showMess("网络不给力,请重试");
- });
- } else {
- UtilService.showMess("您已成功签到");
- $scope.hideLoadingToast();
- }
- }, function () {
- UtilService.showMess("网络不给力,请重试");
- $scope.hideLoadingToast();
- });
- };
- // 临时人员签到
- $scope.tempCheckin = function () {
- if (!UtilService.isDefined($scope.userinfo.name)) {
- UtilService.showMess("姓名不能为空");
- return;
- }
- if (!UtilService.isDefined($scope.userinfo.university)) {
- UtilService.showMess("所属院校不能为空");
- return;
- }
- $scope.showLoadingToast();
- ActivityService.tempCheckIn(activityid, ConfigService.location.lat, ConfigService.location.lng, $scope.userinfo).then(function (response) {
- // console.log(response);
- if (response.result == 1) {
- UtilService.showMess("签到成功");
- $timeout(function () {
- $scope.categoryModal.hide();
- }, 300);
- } else {
- UtilService.showMess("网络不给力,请重试");
- }
- $scope.hideLoadingToast();
- }, function () {
- UtilService.showMess("网络不给力,请重试");
- $scope.hideLoadingToast();
- });
- };
- //关闭报名入口
- $scope.closeCategoryModal = function () {
- $scope.categoryModal.hide();
- };
- $ionicModal.fromTemplateUrl("templates/modal.html", {
- scope: $scope,
- animation: 'slide-in-up'
- }).then(function (modal) {
- $scope.categoryModal = modal;
- });
- //获取研究领域标签
- var buttons = [];
- var getLabelList = function () {
- ActivityService.getCategory().then(function (response) {
- // console.log(response);
- angular.forEach(response, function (value, index) {
- var temphtml = {
- text: '<a class="action-sheet-push">' + value.name + '</a>',
- category: value.name,
- id: value.id
- };
- buttons.push(temphtml);
- });
- }, function () {
- })
- };
- getLabelList();
- //选择研究领域
- $scope.showDockingStatus = function () {
- $ionicActionSheet.show({
- buttons: buttons,
- cancelText: '取消',
- buttonClicked: function (index) {
- $scope.userinfo.categoryid = buttons[index].id;
- $scope.userinfo.category = buttons[index].category;
- return true;
- }
- });
- };
- });
|