app.controller('LoginCtrl', function($rootScope, $scope, $http, $timeout, $state, myConfig, $cookieStore, $interval) { $scope.login = { username : '', password : '', code : '' } $scope.download_btn_class = 'btn-white'; $scope.link_color = '#fff'; $interval(function(){ $scope.download_btn_class = $scope.download_btn_class == 'btn-white' ? 'btn-red' : 'btn-white'; $scope.link_color = $scope.link_color == '#fff' ? '#ff4d4d' : '#fff'; }, 1000); // function to submit the form after all validation has occurred $scope.submitForm = function(isValid) { $scope.submitted = true // check to make sure the form is completely valid if (isValid) { $scope.myPromise = $http({ url : myConfig.url + '/user/login', method : 'POST', data : $scope.login }).success(function(data) { if(data.code == 0){ if(data.result.statusError == '2'){ $rootScope.dialogMsg('报考已结束,您未完成报考无法登录', function(){}); }else if(data.result.statusError == '0'){ $rootScope.dialogMsg('账号已删除无法登录', function(){}); }else { $cookieStore.put('aeeaps-sesssion', data.result.session); window.location = "main.html"; } }else{ $rootScope.dialogMsg(data.errorMsg, function(){}); } //window.location = "art.html"; }).error(function() { // $scope.changeCode('imgCode'); }); // window.location = "main.html"; } }; // $('#noticeModal').modal('show'); // $('#faceScoreNoticeModal').modal('show'); // $('#bkNoticeModal').modal('show'); }).controller('AdminLoginCtrl', function($rootScope, $scope, $http, $timeout, $state, myConfig, $cookieStore, $interval) { $scope.login = { username : '测试01', password : '111111', type: '2', code : '' } // function to submit the form after all validation has occurred $scope.submitForm = function(isValid) { $scope.submitted = true // check to make sure the form is completely valid if (isValid) { $scope.myPromise = $http({ url : myConfig.url + '/user/login', method : 'POST', data : $scope.login }).success(function(data) { if(data.code == 0){ $cookieStore.put('aeeaps-sesssion', data.result.session); window.location = "admin.html"; }else{ $rootScope.dialogMsg(data.errorMsg, function(){}); } //window.location = "art.html"; }).error(function() { // $scope.changeCode('imgCode'); }); // window.location = "main.html"; } }; })