product.js 2.84 KB
Newer Older
manxiaoqiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
(function(){
    angular.module("app.active")
        .controller("productCtrl",["$scope","HttpService","ToolService","UtilService","$state","$rootScope","$interval",productCtrl])

    function productCtrl($scope,HttpService,ToolService,UtilService,$state,$rootScope,$interval){
        $scope.Prostatus = UtilService.getCookie("ryioStatus");
        $scope.UserId = UtilService.getCookie("ryioUid");

        //判断状态
        $scope.UserEmail= $.cookie("ryioUname");
        $scope.findStatus = function(){
            var statusPM = HttpService.getInfo("reged/findbyemail?email="+$scope.UserEmail);
            ToolService.showLoading();
            statusPM.then(function(data){
                ToolService.hideLoading();
                if(data.status == 1){
                    if(data.appSize == 0 && data.isChannelPerson == true){
                        ToolService.showTips("没有控制权限");
                        $scope.time= 2000;
                        $one_minute = $interval(function(){
                            $scope.time -= 1000;
                            if($scope.time == 0){
                                window.location.href = "login.html";
                            }
                        },1000);
                    }else{
                        UtilService.setCookie("ryioStatus",data.status,7);
                        UtilService.setCookie("ryioPastDate",data.pastDate,7);
                        $scope.initpage();
                        // if(data.isSuperUser == true){
                        //     window.location.href = "index.html#/manage/app";
                        // }else{
                        window.location.href = "index.html";
                        // }
                    }
                }else{
                    UtilService.setCookie("ryioStatus",data.status,7);
                    UtilService.setCookie("ryioPastDate",data.pastDate,7);
                }
            });
        }
        $scope.findStatus();

        /*if($scope.Prostatus == 1){
            $scope.initpage();
            if($rootScope.isSuper){
                $scope.goPage("collect.app");
            }
        }*/

    	$scope.postApply = function(){
    		var savePM = HttpService.getInfo("reged/verify/"+$scope.UserId);
            ToolService.showLoading();
            savePM.then(function(data){
                ToolService.hideLoading();
                if(data.status == -1){
                	$scope.Prostatus = -1;
                	UtilService.setCookie("ryioStatus",data.status,7);
                }
            });
    	}
    	$scope.useTrackingIO = function(){
            $scope.initpage();
            if($rootScope.isSuper || $rootScope.isManage){
                $scope.goPage("collect.app");
            }
            else if($rootScope.isAppManage){
                $scope.goPage("collect.custommenu");
            }
    	}
    }
})();