main.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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.getEnrolVarietyFlag = function() {
  8. for(var enrol of $scope.EnrolArray) {
  9. if(enrol.variety_id) {
  10. $scope.have_variety = true;
  11. break;
  12. }
  13. }
  14. }
  15. $scope.getEnrolArray = function() {
  16. var today = $rootScope.shortDateString(new Date());
  17. var now = new Date();
  18. $rootScope.ajaxRequest({
  19. url : '../enrol/std/enrol/list.htm'
  20. }, function(response) {
  21. $scope.EnrolArray = response.array;
  22. $scope.getEnrolVarietyFlag();
  23. for (var i = 0; i < response.array.length; i++) {
  24. var enrol = response.array[i];
  25. if(enrol.pay_status=='Active') {
  26. $scope.showAdmit = true;
  27. }
  28. //&& today == $rootScope.shortDateString(enrol.subscribe_start_time) 屏蔽掉了,这个有什么意义
  29. if (enrol.pay_status == 'Active' && enrol.subscribe_status == 'Active'
  30. && $rootScope.parseLongString(enrol.subscribe_start_time) < now && $rootScope.parseLongString(enrol.subscribe_end_time) > now) {
  31. // 判断考点是否开放了预约,只处理当天
  32. $scope.showAppointment = true;
  33. }
  34. if (enrol.pay_status == 'Active' && $rootScope.parseLongString(enrol.ticket_start_time) < now && $rootScope.parseLongString(enrol.ticket_end_time) > now) {
  35. // 判断考点是否开放了预约,只处理当天
  36. $scope.showTicket = true;
  37. }
  38. }
  39. });
  40. }
  41. //考生二维码-app扫码登录
  42. $scope.getStdQrCode = function() {
  43. var flag = true;
  44. //缴费过滤
  45. $scope.EnrolPayArray = [];
  46. if($scope.EnrolArray && $scope.EnrolArray.length > 0) {
  47. for(const enrol of $scope.EnrolArray) {
  48. if(enrol.pay_status == 'Active' && enrol.online_flag =='Active') {
  49. $scope.EnrolPayArray.push(enrol);
  50. }
  51. }
  52. }
  53. if ($scope.EnrolPayArray && $scope.EnrolPayArray.length > 0 && flag) {
  54. $rootScope.ajaxRequest({
  55. url : '../enrol/std/app/qrcode/value.htm',
  56. data: {
  57. std_id : $scope.EnrolPayArray[0].std_id
  58. }
  59. }, function(data) {
  60. //生成二维码
  61. var qrcode = new QRCode(document.getElementById("containerDiv"), {
  62. width : 200,
  63. height : 200
  64. });
  65. $('#scanTextDiv').css('display','');
  66. $('#containerDiv').css('display','');
  67. qrcode.makeCode(data.entity);
  68. });
  69. }
  70. }
  71. $scope.goEnrol = function(e) {
  72. $rootScope.goLocation('enrol/info/' + e.enrol_id + '/InActive');
  73. }
  74. $scope.goDoc = function(enrol_id) {
  75. $rootScope.goLocation('enrol/doc/' + enrol_id );
  76. }
  77. //报考是否过期
  78. $scope.enrolTime = function() {
  79. $rootScope.ajaxRequest({
  80. url : '../enrol/agent/expire.htm',
  81. data: {}
  82. }, function(data) {
  83. $scope.enrolTimeFlag = data.entity;
  84. });
  85. }
  86. $scope.enrolTime();
  87. $scope.getEnrolArray();
  88. //显示在线考试二维码
  89. $timeout(function(){
  90. $scope.getStdQrCode();
  91. }, 1500);
  92. $scope.recordQrcode = function(e){
  93. $scope.videoRecordLog();
  94. $rootScope.ajaxRequest({
  95. url : '../enrol/conf/topic/find.htm',
  96. data: {
  97. aspect_id : e.aspect_id
  98. }
  99. }, function(data) {
  100. if(data && data.entity.voide_start_date && data.entity.voide_end_date) {
  101. var start_date = new Date(data.entity.voide_start_date.replace(/\-/g, "/"));
  102. var end_date = new Date(data.entity.voide_end_date.replace(/\-/g, "/"));
  103. var now_date = new Date();
  104. if (now_date >= start_date && now_date <= end_date){
  105. $('.qrcode').css('display','none')
  106. $('#'+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);
  107. $('#'+e.enrol_id).css('display','')
  108. } else {
  109. $.alert('录制时间未到,请在'+data.entity.voide_start_date+'后录制!');
  110. }
  111. } else {
  112. $.alert('录制时间未到!');
  113. }
  114. });
  115. }
  116. //录制视频日志
  117. $scope.videoRecordLog = function() {
  118. $rootScope.ajaxRequest({
  119. url : '../enrol/voide/log.htm',
  120. data: {}
  121. }, function(data) {
  122. });
  123. }
  124. //考试须知
  125. $scope.goNotice = function(e) {
  126. //美术类考试须知
  127. if(e.without_exam_apply == 'Active' || e.without_exam_apply == 'InActive') {
  128. $rootScope.goLocation('zxnotice/info/2');
  129. } else { //其他类考试须知
  130. $rootScope.goLocation('zxnotice/info/1');
  131. }
  132. }
  133. //下载合格单
  134. $scope.goDownloadCertificate = function(download_type) {
  135. var url =$rootScope.FrameParam.EnrolMaterialWebPath + $rootScope.ArtStdReg.std_score_file;
  136. if (download_type == 'Download') {
  137. $('#ticket_url').attr('href', url);
  138. document.getElementById("ticket_url").click();
  139. } else {
  140. }
  141. };
  142. //志愿填报
  143. $scope.stdWish = function(e){
  144. if(e) {
  145. $rootScope.goLocation('wish/std/' + e.aspect_id);
  146. } else {
  147. $rootScope.goLocation('wish/std/null');
  148. }
  149. }
  150. //选择品种
  151. $scope.chooseVariety = function() {
  152. $rootScope.ajaxRequest({
  153. url : '../enrol/std/enrol/in/time.htm',
  154. data : { }
  155. }, function(data) {
  156. if(!data.entity) {
  157. $.alert('报考已结束,不能在选择品种!');
  158. return;
  159. } else {
  160. var enrol_id = null;
  161. if($scope.EnrolArray.length > 1) {
  162. for(var ea of $scope.EnrolArray) {
  163. //西音特殊处理
  164. if(ea.aspect_flag == 'Active')
  165. enrol_id = ea.enrol_id;
  166. }
  167. } else if($scope.EnrolArray.length == 1) {
  168. enrol_id = $scope.EnrolArray[0].enrol_id;
  169. }
  170. $rootScope.goLocation('variety/choose/' + enrol_id +'/1');
  171. }
  172. });
  173. }
  174. } ])