1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- app.controller('ExamWaitCtrl', [ '$rootScope', '$scope', '$stateParams','$interval', function($rootScope, $scope, $stateParams, $interval) {
- $scope.flag = true;
- $scope.msg = '';
-
- $scope.query = function (){
- $rootScope.ajaxRequest({
- url : '../exam/online/checkin/query.htm',
- data : {
- agent_id : $stateParams.agent_id,
- aspect_id : $stateParams.aspect_id,
- std_id: $rootScope.ArtStdReg.std_id
- }
- }, function(response) {
- $scope.checkEntity = response.entity;
- if($scope.checkEntity && $scope.checkEntity.is_success != undefined) {
- if($scope.checkEntity.is_success == 0) {
- $scope.flag = true;
- $scope.msg = '';
- $rootScope.goLocation('exam/checkin/'+$stateParams.agent_id+"/"+$stateParams.aspect_id);
- //$rootScope.goLocation('exam/voide/' + $stateParams.enrol_id+'/false');
- } else if($scope.checkEntity.is_success == -1) {
- $scope.flag = false;
- $scope.msg = $scope.checkEntity.err_msg;
- }
- }
- });
- }
-
-
- $scope.query();
-
-
- var timer = setInterval(function() {
- $scope.$apply(function() {
- $scope.query();
- });
- }, 5000);
-
- $scope.$on('$destroy', function() {
- if (timer) {
- clearInterval(timer);
- timer = null;
- }
- });
-
- }])
|