main.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.firstQualified = false;//是否存在初始合格
  7. $scope.showInfo = false;
  8. $scope.getEnrolArray2 = function() {
  9. console.log('12312');
  10. $rootScope.ajaxRequest({
  11. url : '../enrol/std/enrol/list.htm'
  12. }, function(response) {
  13. $scope.EnrolArray2 = response.array;
  14. console.log(response.array);
  15. });
  16. }
  17. $scope.getEnrolArray = function() {
  18. $rootScope.ajaxRequest({
  19. url : '../enrol/std/score/ym/final/list.htm'
  20. }, function(response) {
  21. debugger;
  22. $rootScope.EnrolArray = response.array;
  23. var qualified_total = 0;
  24. for(var i=0; i<response.array.length; i++) {
  25. /*if (response.array[i].aspect_qualified == "初试合格") {
  26. $scope.firstQualified = true;
  27. }*/
  28. }
  29. if(response.array.length == 0) {
  30. $scope.getEnrolArray2();
  31. }
  32. });
  33. }
  34. //TODO 临时
  35. $scope.getAgent = function() {
  36. $rootScope.ajaxRequest({
  37. url : '../enrol/agent/find.htm?agent_id=101'
  38. }, function(response) {
  39. $scope.Agent = response.map;
  40. var now = $rootScope.parseLongString(response.map.now);
  41. if ($rootScope.parseLongString(response.map.ticket_start_time) < now
  42. && $rootScope.parseLongString(response.map.ticket_end_time) > now) {
  43. // 判断考点是否开放了预约,只处理当天
  44. $scope.showTicket = true;
  45. }
  46. });
  47. }
  48. $scope.goEnrol = function(e) {
  49. //$rootScope.goLocation('ym/score/' + e.aspect_name + '/' + e.batch);
  50. $rootScope.goLocation('enrol/info/' + e.enrol_id + '/InActive');
  51. }
  52. $scope.getEnrolArray2();
  53. $scope.getAgent();//TODO 临时
  54. } ])