123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- app.controller('ExamCheckinCtrl', [ '$rootScope', '$scope', '$stateParams','$interval', function($rootScope, $scope, $stateParams, $interval) {
- $scope.waitNum=-1;
- $scope.inRoomFlag = true;
-
- $scope.openroom = function (){
- $rootScope.ajaxRequest({
- url : '../exam/online/meeting/url.htm',
- data : {
- agent_id : $stateParams.agent_id,
- aspect_id : $stateParams.aspect_id,
- std_id: $rootScope.ArtStdReg.std_id
- }
- }, function(response) {
- // alert(response.entity);
- window.location = response.entity;
- });
- }
-
-
- $scope.inroom = function(){
- $rootScope.ajaxRequest({
- url : '../exam/online/wait/num.htm',
- data : {
- agent_id : $stateParams.agent_id,
- aspect_id : $stateParams.aspect_id,
- std_id: $rootScope.ArtStdReg.std_id
- }
- }, function(response) {
- $scope.waitNum=response.map.waitNum;
- // $scope.inRoomFlag = response.map.inRoomFlag;
- });
- }
- $scope.inroom();
-
- $scope.i=0;
- $scope.checkinroom = function(){
- if ($scope.waitNum > 10) {
- if($scope.i++>=15){
- $scope.i=0;
- $scope.inroom();
- }
- }
- else
- $scope.inroom();
- }
-
- var timer = setInterval(function() {
- $scope.$apply(function() {
- $scope.checkinroom();
- });
- }, 15000);
- $scope.$on('$destroy', function() {
- if (timer) {
- // clearInterval(timer);
- timer = null;
- }
- });
-
- }])
|