123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- app.controller('MainCtrl', ['$rootScope','$scope','$timeout',function($rootScope, $scope,$timeout) {
- if(!$rootScope.loginSuccess)
- return;
- $scope.showAppointment = false;
- $scope.showTicket = false;
- $scope.showAdmit = false;
-
- $scope.getEnrolVarietyFlag = function() {
- for(var enrol of $scope.EnrolArray) {
- if(enrol.variety_id) {
- $scope.have_variety = true;
- break;
- }
- }
- }
-
- $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;
- $scope.getEnrolVarietyFlag();
- for (var i = 0; i < response.array.length; i++) {
- var enrol = response.array[i];
- if(enrol.pay_status=='Active') {
- $scope.showAdmit = true;
- }
- //&& today == $rootScope.shortDateString(enrol.subscribe_start_time) 屏蔽掉了,这个有什么意义
- if (enrol.pay_status == 'Active' && enrol.subscribe_status == 'Active'
- && $rootScope.parseLongString(enrol.subscribe_start_time) < now && $rootScope.parseLongString(enrol.subscribe_end_time) > now) {
- // 判断考点是否开放了预约,只处理当天
- $scope.showAppointment = true;
- }
-
- if (enrol.pay_status == 'Active' && $rootScope.parseLongString(enrol.ticket_start_time) < now && $rootScope.parseLongString(enrol.ticket_end_time) > now) {
- // 判断考点是否开放了预约,只处理当天
- $scope.showTicket = true;
- }
- }
- });
- }
- //考生二维码-app扫码登录
- $scope.getStdQrCode = function() {
- var flag = true;
- //缴费过滤
- $scope.EnrolPayArray = [];
- if($scope.EnrolArray && $scope.EnrolArray.length > 0) {
- for(const enrol of $scope.EnrolArray) {
- if(enrol.pay_status == 'Active' && enrol.online_flag =='Active') {
- $scope.EnrolPayArray.push(enrol);
- }
- }
- }
-
- if ($scope.EnrolPayArray && $scope.EnrolPayArray.length > 0 && flag) {
- $rootScope.ajaxRequest({
- url : '../enrol/std/app/qrcode/value.htm',
- data: {
- std_id : $scope.EnrolPayArray[0].std_id
- }
- }, function(data) {
- //生成二维码
- var qrcode = new QRCode(document.getElementById("containerDiv"), {
- width : 200,
- height : 200
- });
- $('#scanTextDiv').css('display','');
- $('#containerDiv').css('display','');
- qrcode.makeCode(data.entity);
- });
- }
-
- }
-
- $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.recordQrcode = function(e){
- $scope.videoRecordLog();
- $rootScope.ajaxRequest({
- url : '../enrol/conf/topic/find.htm',
- data: {
- aspect_id : e.aspect_id
- }
- }, function(data) {
- if(data && data.entity.voide_start_date && data.entity.voide_end_date) {
- var start_date = new Date(data.entity.voide_start_date.replace(/\-/g, "/"));
- var end_date = new Date(data.entity.voide_end_date.replace(/\-/g, "/"));
- var now_date = new Date();
- if (now_date >= 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.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 {
- }
- };
-
- //志愿填报
- $scope.stdWish = function(e){
- if(e) {
- $rootScope.goLocation('wish/std/' + e.aspect_id);
- } else {
- $rootScope.goLocation('wish/std/null');
- }
- }
- //选择品种
- $scope.chooseVariety = function() {
- $rootScope.ajaxRequest({
- url : '../enrol/std/enrol/in/time.htm',
- data : { }
- }, function(data) {
- if(!data.entity) {
- $.alert('报考已结束,不能在选择品种!');
- return;
- } else {
- var enrol_id = null;
- if($scope.EnrolArray.length > 1) {
- for(var ea of $scope.EnrolArray) {
- //西音特殊处理
- if(ea.aspect_flag == 'Active')
- enrol_id = ea.enrol_id;
- }
- } else if($scope.EnrolArray.length == 1) {
- enrol_id = $scope.EnrolArray[0].enrol_id;
- }
- $rootScope.goLocation('variety/choose/' + enrol_id +'/1');
- }
- });
-
- }
-
-
- } ])
|