main.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. app.controller('MainCtrl', [ '$rootScope', '$scope','$timeout', function($rootScope, $scope,$timeout) {
  2. if(!$rootScope.loginSuccess)
  3. return;
  4. $scope.showAppointment = false;
  5. $scope.showTicket = false;
  6. $scope.showAdmit = false;
  7. $scope.getEnrolArray = function() {
  8. var today = $rootScope.shortDateString(new Date());
  9. var now = new Date();
  10. $rootScope.ajaxRequest({
  11. url : '../enrol/std/enrol/list.htm'
  12. }, function(response) {
  13. $scope.EnrolArray = response.array;
  14. for (var i = 0; i < response.array.length; i++) {
  15. var enrol = response.array[i];
  16. if(enrol.pay_status=='Active') {
  17. $scope.showAdmit = true;
  18. }
  19. if (enrol.pay_status == 'Active' && enrol.subscribe_status == 'Active' && today == $rootScope.shortDateString(enrol.subscribe_start_time)
  20. && $rootScope.parseLongString(enrol.subscribe_start_time) < now && $rootScope.parseLongString(enrol.subscribe_end_time) > now) {
  21. // 判断考点是否开放了预约,只处理当天
  22. $scope.showAppointment = true;
  23. }
  24. if (enrol.pay_status == 'Active' && today == $rootScope.shortDateString(enrol.ticket_start_time)
  25. && $rootScope.parseLongString(enrol.ticket_start_time) < now && $rootScope.parseLongString(enrol.ticket_end_time) > now) {
  26. // 判断考点是否开放了预约,只处理当天
  27. $scope.showTicket = true;
  28. }
  29. }
  30. });
  31. }
  32. //考生二维码-app扫码登录
  33. $scope.getStdQrCode = function() {
  34. //alert("11 --" + $scope.EnrolArray.length);
  35. if ($scope.EnrolArray && $scope.EnrolArray.length > 0) {
  36. $('.qrcode').css('display','none');
  37. $('#stdQrCode').attr('src', "../enrol/std/app/qrcode.htm.htm?std_id=" + $scope.EnrolArray[0].std_id);
  38. $('#stdQrCode').css('display','');
  39. $('#containerDiv').css('display','');
  40. }
  41. //alert("over --");
  42. }
  43. $scope.goEnrol = function(e) {
  44. $rootScope.goLocation('enrol/info/' + e.enrol_id + '/InActive');
  45. }
  46. $scope.goDoc = function(enrol_id) {
  47. $rootScope.goLocation('enrol/doc/' + enrol_id );
  48. }
  49. //报考是否过期
  50. $scope.enrolTime = function() {
  51. $rootScope.ajaxRequest({
  52. url : '../enrol/agent/expire.htm',
  53. data: {}
  54. }, function(data) {
  55. $scope.enrolTimeFlag = data.entity;
  56. });
  57. }
  58. $scope.enrolTime();
  59. $scope.getEnrolArray();
  60. $timeout(function(){
  61. $scope.getStdQrCode();
  62. }, 1500);
  63. $scope.goVoide = function(e){
  64. $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  65. // $rootScope.ajaxRequest({
  66. // url : '../enrol/std/enrol/find.htm',
  67. // data : {
  68. // enrol_id : e.enrol_id,
  69. // aspect_batch : 1
  70. // }
  71. // }, function(response) {
  72. // var voide = response.map.Voide;
  73. // if(voide.note_date==null){
  74. // $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  75. // return;
  76. // }
  77. //
  78. // var d = new Date(voide.note_date.replace(/\-/g, "/"));
  79. // if (d<new Date()){
  80. // $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  81. // }else{
  82. // $.alert('入场时间未到,请在'+voide.note_date+'后入场!');
  83. // }
  84. // });
  85. }
  86. $scope.recordVoide = function(e){
  87. $rootScope.ajaxRequest({
  88. url : '../enrol/std/video/exam/record.htm',
  89. data : {
  90. cert_id :$rootScope.ArtStdReg.cert_id,
  91. ly_group_id : 11,
  92. enrol_id:e.enrol_id
  93. }
  94. }, function(data) {
  95. if(data.success == true){
  96. window.location.href = data.entity;
  97. return;
  98. }
  99. });
  100. }
  101. $scope.recordQrcode = function(e){
  102. $scope.videoRecordLog();
  103. $rootScope.ajaxRequest({
  104. url : '../enrol/conf/topic/find.htm',
  105. data: {
  106. aspect_id : e.aspect_id
  107. }
  108. }, function(data) {
  109. if(data && data.entity.voide_start_date && data.entity.voide_end_date) {
  110. var start_date = new Date(data.entity.voide_start_date.replace(/\-/g, "/"));
  111. var end_date = new Date(data.entity.voide_end_date.replace(/\-/g, "/"));
  112. var now_date = new Date();
  113. if (now_date >= start_date && now_date <= end_date){
  114. $('.qrcode').css('display','none')
  115. $('#'+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);
  116. $('#'+e.enrol_id).css('display','')
  117. } else {
  118. $.alert('录制时间未到,请在'+data.entity.voide_start_date+'后录制!');
  119. }
  120. } else {
  121. $.alert('录制时间未到!');
  122. }
  123. });
  124. }
  125. //录制视频日志
  126. $scope.videoRecordLog = function() {
  127. $rootScope.ajaxRequest({
  128. url : '../enrol/voide/log.htm',
  129. data: {}
  130. }, function(data) {
  131. });
  132. }
  133. //首页检录
  134. $scope.checkin = function(e){
  135. $rootScope.ajaxRequest({
  136. url: '../exam/online/checkin/inqueue.htm',
  137. data:{agent_id:e.agent_id, aspect_id:e.aspect_id, std_id:e.std_id}
  138. }, function(response) {
  139. $rootScope.goLocation('exam/wait/'+e.agent_id+"/"+e.aspect_id+"/"+e.enrol_id);
  140. });
  141. }
  142. //考试须知
  143. $scope.goNotice = function(e) {
  144. //美术类考试须知
  145. if(e.without_exam_apply == 'Active' || e.without_exam_apply == 'InActive') {
  146. $rootScope.goLocation('zxnotice/info/2');
  147. } else { //其他类考试须知
  148. $rootScope.goLocation('zxnotice/info/1');
  149. }
  150. }
  151. //下载合格单
  152. $scope.goDownloadCertificate = function(download_type) {
  153. var url =$rootScope.FrameParam.EnrolMaterialWebPath + $rootScope.ArtStdReg.std_score_file;
  154. if (download_type == 'Download') {
  155. $('#ticket_url').attr('href', url);
  156. document.getElementById("ticket_url").click();
  157. } else {
  158. }
  159. };
  160. } ])