You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

class.js 4.8 kB

10 years ago
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
10 years ago
​
​
10 years ago
​
​
​
10 years ago
​
​
​
10 years ago
​
​
​
​
10 years ago
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms', function($scope, config, $http, auth, $location, $routeParams,alertService,rms){
  2. var vm = $scope;
  3. var courseid = $routeParams.id;
  4. var tag = $routeParams.tag;
  5. var getUsers = function(){
  6. if(vm.teachers.length<=0){
  7. $http.get(config.apiUrl + 'courses/teachers?token='+auth.token()+'&course_id='+courseid).then(
  8. function(response) {
  9. console.log(response.data);
  10. vm.teachers = response.data.data;
  11. }
  12. )
  13. }
  14. if(vm.students.length<=0){
  15. $http.get(config.apiUrl + 'courses/students?token='+auth.token()+'&course_id='+courseid).then(
  16. function(response) {
  17. console.log(response.data);
  18. vm.students = response.data.data;
  19. }
  20. )
  21. }
  22. }
  23. var getResources = function(){
  24. if(vm.resources.length<=0){
  25. $http.post(config.apiUrl + "courses/"+courseid+"/attachments",
  26. {token: auth.token(), name: ''}
  27. ).then(function(response){
  28. vm.resources = response.data.data;
  29. vm.resources_tag = true;
  30. });
  31. }
  32. }
  33. var getHomeworks = function(){
  34. if(vm.homeworks.length <=0){
  35. $http.get(config.apiUrl + "courses/homeworks/"+courseid+"?token="+auth.token()).then(function(response){
  36. vm.homeworks = response.data.data;
  37. console.log(response.data);
  38. vm.homeworks_tag = true;
  39. });
  40. }
  41. }
  42. var getExercises = function(){
  43. if(vm.exercises.length <=0){
  44. $http.get(config.apiUrl + "courses/"+courseid+"/exercises?token="+auth.token()).then(function(response){
  45. vm.exercises = response.data.data;
  46. console.log(response.data);
  47. vm.exercises_tag = true;
  48. });
  49. }
  50. }
  51. vm.isTeacher = false;
  52. vm.currentTab = 1;
  53. vm.tab = function(index){
  54. vm.currentTab = index;
  55. vm.searchText = '';
  56. vm.showClassMate = false;
  57. vm.showResources = false;
  58. vm.showHomework = false;
  59. vm.showTestcase = false;
  60. vm.resources_tag = false;
  61. vm.homeworks_tag = false;
  62. vm.exercises_tag = false;
  63. if(vm.isTeacher){
  64. if(index == 1){ //课件
  65. getResources();
  66. vm.showResources = true;
  67. } else if(index==2){ //作业
  68. getHomeworks();
  69. vm.showHomework = true;
  70. } else if(index==3){ //小测验
  71. getExercises();
  72. vm.showTestcase = true;
  73. } else if(index==4){ //学生管理
  74. getUsers();
  75. vm.showClassMate = true;
  76. }
  77. } else {
  78. if(index == 2){
  79. getUsers();
  80. vm.showClassMate = true;
  81. } else if(index==1){
  82. getResources();
  83. vm.showResources = true;
  84. }
  85. }
  86. }
  87. vm.course = {};
  88. vm.students = [];
  89. vm.teachers = [];
  90. vm.resources = [];
  91. vm.homeworks = [];
  92. vm.exercises = [];
  93. //发送类别 1课件 2作业 3测验
  94. vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;
  95. vm.alertService = alertService.create();
  96. vm.invite = function(){
  97. $location.path("/invite_code").search({id: courseid});
  98. };
  99. vm.sendFile = function(r,index){
  100. vm.myresource_sendIndex = index;
  101. rms.save('myresource_sendIndex',index);
  102. $location.path("/send_class_list").search({id: r.id});
  103. }
  104. $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
  105. function(response) {
  106. console.log(response.data);
  107. if (response.data.status == 0){
  108. vm.course = response.data.data;
  109. resetMenu(vm.course.current_user_is_teacher);
  110. if(tag){
  111. vm.tab(4);
  112. tag = null;
  113. }
  114. else{
  115. vm.tab(1);
  116. }
  117. }
  118. else{
  119. vm.alertService.showMessage('提示', response.data.message);
  120. }
  121. }
  122. );
  123. var resetMenu = function(is_teacher){
  124. vm.isTeacher = is_teacher;
  125. if(is_teacher){
  126. vm.menus = ["课件", "作业", "测验", "成员管理"];
  127. } else {
  128. vm.menus = ['课件', "我的同学"];
  129. }
  130. }
  131. vm.onSetting = function(user){
  132. rms.save('current_edit_member', user);
  133. $location.path("/edit_class_member").search({id: courseid,user_id: user.id});
  134. };
  135. }]);

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...