app.controller('MainCtrl', [ '$rootScope', '$scope','$timeout', function($rootScope, $scope,$timeout) { if(!$rootScope.loginSuccess) return; $scope.showAppointment = false; $scope.showTicket = false; $scope.showAdmit = false; $scope.getEnrolArray = function() { var today = $rootScope.shortDateString(new Date()); var now = new Date(); $rootScope.ajaxRequest({ url : '../enrol/std/enrol/list.htm' }, function(response) { $scope.EnrolArray = response.array; for (var i = 0; i < response.array.length; i++) { var enrol = response.array[i]; if(enrol.pay_status=='Active') { $scope.showAdmit = true; } if (enrol.pay_status == 'Active' && enrol.subscribe_status == 'Active' && today == $rootScope.shortDateString(enrol.subscribe_start_time) && $rootScope.parseLongString(enrol.subscribe_start_time) < now && $rootScope.parseLongString(enrol.subscribe_end_time) > now) { // 判断考点是否开放了预约,只处理当天 $scope.showAppointment = true; } if (enrol.pay_status == 'Active' && today == $rootScope.shortDateString(enrol.ticket_start_time) && $rootScope.parseLongString(enrol.ticket_start_time) < now && $rootScope.parseLongString(enrol.ticket_end_time) > now) { // 判断考点是否开放了预约,只处理当天 $scope.showTicket = true; } } }); } //考生二维码-app扫码登录 $scope.getStdQrCode = function() { //alert("11 --" + $scope.EnrolArray.length); if ($scope.EnrolArray && $scope.EnrolArray.length > 0) { $('.qrcode').css('display','none'); $('#stdQrCode').attr('src', "../enrol/std/app/qrcode.htm.htm?std_id=" + $scope.EnrolArray[0].std_id); $('#stdQrCode').css('display',''); $('#containerDiv').css('display',''); } //alert("over --"); } $scope.goEnrol = function(e) { $rootScope.goLocation('enrol/info/' + e.enrol_id + '/InActive'); } $scope.goDoc = function(enrol_id) { $rootScope.goLocation('enrol/doc/' + enrol_id ); } //报考是否过期 $scope.enrolTime = function() { $rootScope.ajaxRequest({ url : '../enrol/agent/expire.htm', data: {} }, function(data) { $scope.enrolTimeFlag = data.entity; }); } $scope.enrolTime(); $scope.getEnrolArray(); $timeout(function(){ $scope.getStdQrCode(); }, 1500); $scope.goVoide = function(e){ $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false'); // $rootScope.ajaxRequest({ // url : '../enrol/std/enrol/find.htm', // data : { // enrol_id : e.enrol_id, // aspect_batch : 1 // } // }, function(response) { // var voide = response.map.Voide; // if(voide.note_date==null){ // $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false'); // return; // } // // var d = new Date(voide.note_date.replace(/\-/g, "/")); // if (d= start_date && now_date <= end_date){ $('.qrcode').css('display','none') $('#'+e.enrol_id).attr('src', "../enrol/std/video/qrcode.htm?cert_id="+$rootScope.ArtStdReg.cert_id+"&ly_group_id=11&enrol_id="+e.enrol_id); $('#'+e.enrol_id).css('display','') } else { $.alert('录制时间未到,请在'+data.entity.voide_start_date+'后录制!'); } } else { $.alert('录制时间未到!'); } }); } //录制视频日志 $scope.videoRecordLog = function() { $rootScope.ajaxRequest({ url : '../enrol/voide/log.htm', data: {} }, function(data) { }); } //首页检录 $scope.checkin = function(e){ $rootScope.ajaxRequest({ url: '../exam/online/checkin/inqueue.htm', data:{agent_id:e.agent_id, aspect_id:e.aspect_id, std_id:e.std_id} }, function(response) { $rootScope.goLocation('exam/wait/'+e.agent_id+"/"+e.aspect_id+"/"+e.enrol_id); }); } //考试须知 $scope.goNotice = function(e) { //美术类考试须知 if(e.without_exam_apply == 'Active' || e.without_exam_apply == 'InActive') { $rootScope.goLocation('zxnotice/info/2'); } else { //其他类考试须知 $rootScope.goLocation('zxnotice/info/1'); } } //下载合格单 $scope.goDownloadCertificate = function(download_type) { var url =$rootScope.FrameParam.EnrolMaterialWebPath + $rootScope.ArtStdReg.std_score_file; if (download_type == 'Download') { $('#ticket_url').attr('href', url); document.getElementById("ticket_url").click(); } else { } }; } ])