main.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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'
  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. var flag = true;
  35. //缴费过滤
  36. $scope.EnrolPayArray = [];
  37. if($scope.EnrolArray && $scope.EnrolArray.length > 0) {
  38. for(const enrol of $scope.EnrolArray) {
  39. if(enrol.pay_status == 'Active' && enrol.online_flag =='Active') {
  40. $scope.EnrolPayArray.push(enrol);
  41. }
  42. }
  43. }
  44. if ($scope.EnrolPayArray && $scope.EnrolPayArray.length > 0 && flag) {
  45. $rootScope.ajaxRequest({
  46. url : '../enrol/std/app/qrcode/value.htm',
  47. data: {
  48. std_id : $scope.EnrolPayArray[0].std_id
  49. }
  50. }, function(data) {
  51. //生成二维码
  52. var qrcode = new QRCode(document.getElementById("containerDiv"), {
  53. width : 200,
  54. height : 200
  55. });
  56. $('#scanTextDiv').css('display','');
  57. $('#containerDiv').css('display','');
  58. qrcode.makeCode(data.entity);
  59. });
  60. }
  61. }
  62. $scope.goEnrol = function(e) {
  63. $rootScope.goLocation('enrol/info/' + e.enrol_id + '/InActive');
  64. }
  65. $scope.goDoc = function(enrol_id) {
  66. $rootScope.goLocation('enrol/doc/' + enrol_id );
  67. }
  68. //报考是否过期
  69. $scope.enrolTime = function() {
  70. $rootScope.ajaxRequest({
  71. url : '../enrol/agent/expire.htm',
  72. data: {}
  73. }, function(data) {
  74. $scope.enrolTimeFlag = data.entity;
  75. });
  76. }
  77. $scope.enrolTime();
  78. $scope.getEnrolArray();
  79. $timeout(function(){
  80. $scope.getStdQrCode();
  81. }, 1500);
  82. $scope.goVoide = function(e){
  83. $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  84. // $rootScope.ajaxRequest({
  85. // url : '../enrol/std/enrol/find.htm',
  86. // data : {
  87. // enrol_id : e.enrol_id,
  88. // aspect_batch : 1
  89. // }
  90. // }, function(response) {
  91. // var voide = response.map.Voide;
  92. // if(voide.note_date==null){
  93. // $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  94. // return;
  95. // }
  96. //
  97. // var d = new Date(voide.note_date.replace(/\-/g, "/"));
  98. // if (d<new Date()){
  99. // $rootScope.goLocation('exam/voide/' + e.enrol_id+'/false');
  100. // }else{
  101. // $.alert('入场时间未到,请在'+voide.note_date+'后入场!');
  102. // }
  103. // });
  104. }
  105. $scope.recordVoide = function(e){
  106. $rootScope.ajaxRequest({
  107. url : '../enrol/std/video/exam/record.htm',
  108. data : {
  109. cert_id :$rootScope.ArtStdReg.cert_id,
  110. ly_group_id : 11,
  111. enrol_id:e.enrol_id
  112. }
  113. }, function(data) {
  114. if(data.success == true){
  115. window.location.href = data.entity;
  116. return;
  117. }
  118. });
  119. }
  120. $scope.recordQrcode = function(e){
  121. $scope.videoRecordLog();
  122. $rootScope.ajaxRequest({
  123. url : '../enrol/conf/topic/find.htm',
  124. data: {
  125. aspect_id : e.aspect_id
  126. }
  127. }, function(data) {
  128. if(data && data.entity.voide_start_date && data.entity.voide_end_date) {
  129. var start_date = new Date(data.entity.voide_start_date.replace(/\-/g, "/"));
  130. var end_date = new Date(data.entity.voide_end_date.replace(/\-/g, "/"));
  131. var now_date = new Date();
  132. if (now_date >= start_date && now_date <= end_date){
  133. $('.qrcode').css('display','none')
  134. $('#'+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);
  135. $('#'+e.enrol_id).css('display','')
  136. } else {
  137. $.alert('录制时间未到,请在'+data.entity.voide_start_date+'后录制!');
  138. }
  139. } else {
  140. $.alert('录制时间未到!');
  141. }
  142. });
  143. }
  144. //录制视频日志
  145. $scope.videoRecordLog = function() {
  146. $rootScope.ajaxRequest({
  147. url : '../enrol/voide/log.htm',
  148. data: {}
  149. }, function(data) {
  150. });
  151. }
  152. //首页检录
  153. $scope.checkin = function(e){
  154. $rootScope.ajaxRequest({
  155. url: '../exam/online/checkin/inqueue.htm',
  156. data:{agent_id:e.agent_id, aspect_id:e.aspect_id, std_id:e.std_id}
  157. }, function(response) {
  158. $rootScope.goLocation('exam/wait/'+e.agent_id+"/"+e.aspect_id+"/"+e.enrol_id);
  159. });
  160. }
  161. //考试须知
  162. $scope.goNotice = function(e) {
  163. //美术类考试须知
  164. if(e.without_exam_apply == 'Active' || e.without_exam_apply == 'InActive') {
  165. $rootScope.goLocation('zxnotice/info/2');
  166. } else { //其他类考试须知
  167. $rootScope.goLocation('zxnotice/info/1');
  168. }
  169. }
  170. //下载合格单
  171. $scope.goDownloadCertificate = function(download_type) {
  172. var url =$rootScope.FrameParam.EnrolMaterialWebPath + $rootScope.ArtStdReg.std_score_file;
  173. if (download_type == 'Download') {
  174. $('#ticket_url').attr('href', url);
  175. document.getElementById("ticket_url").click();
  176. } else {
  177. }
  178. };
  179. //下载介绍信
  180. $scope.downloadIntro = function() {
  181. var url = $rootScope.FrameParam.EnrolMaterialWebPath + "西音附中报考介绍信模板.doc";
  182. $('#intro_url').attr('href', url);
  183. document.getElementById("intro_url").click();
  184. }
  185. } ])