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_list.js 4.3 kB

10 years ago
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * Created by guange on 16/6/27.
  3. */
  4. app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService','rms','common',
  5. function ($scope, config, auth, $http, $location, alertService,rms,common) {
  6. // common.checkLogin();
  7. var vm = $scope;
  8. vm.syllabuses = rms.get('syllabuses') || [];
  9. vm.alertService_1 = alertService.create();
  10. vm.alertService_3 = alertService.create();
  11. var loadClassList = function () {
  12. $http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
  13. function (response) {
  14. console.log(response.data);
  15. vm.syllabuses = response.data.data;
  16. var show_1 = false;
  17. var show_2 = false;
  18. for (var i in vm.syllabuses) {
  19. if(vm.syllabuses[i].can_setting && vm.syllabuses[i].courses.length > 0 && show_1 == false ){
  20. vm.syllabuses[i].show_plus = true;
  21. show_1 = true;
  22. }
  23. if(!vm.syllabuses[i].can_setting && vm.syllabuses[i].courses.length > 0 && show_2 == false ){
  24. vm.syllabuses[i].show_plus = true;
  25. show_2 = true;
  26. }
  27. if(show_1 && show_2){
  28. break;
  29. }
  30. }
  31. rms.save('syllabuses', vm.syllabuses);
  32. }
  33. );
  34. };
  35. if(vm.syllabuses.length<=0){
  36. loadClassList();
  37. }
  38. vm.goClass = function (course_id) {
  39. rms.save('course_activities_page',0);
  40. rms.save("course_activities",[]);
  41. rms.save("course_has_more",false);
  42. rms.save("course",null);
  43. rms.save("tab_num",null);
  44. console.log(course_id);
  45. $location.path("/class").search({id: course_id});
  46. }
  47. vm.newClass = function () {
  48. //先判断下权限
  49. // $http.post(config.apiUrl + "syllabuses/auth",{token: auth.token()} ).then(
  50. // function (response) {
  51. // console.log(response.data);
  52. // if (response.data.auth == 0) {
  53. // vm.alertService_1.showMessage('提示', '非教师身份不能创建课程哦~');
  54. // }
  55. // else{
  56. // $location.path("/new_class");
  57. // }
  58. // }
  59. // );
  60. $location.path("/new_class");
  61. };
  62. vm.goResource = function () {
  63. $location.path("/myresource");
  64. };
  65. vm.joinClass = function () {
  66. // vm.alertService_3.showMessage('提示', '请输入5位班级邀请码(不区分大小写)', function(){
  67. // if (vm.alertService_3.invite && vm.alertService_3.invite.length == 5) {
  68. // $http.post(config.apiUrl + "courses/join", {
  69. // token: auth.token(),
  70. // invite_code: vm.alertService_3.invite
  71. // }).then(function (response) {
  72. // console.log(response.data);
  73. // if (response.data.status != 0) {
  74. // vm.alertService_1.showMessage('提示', response.data.message);
  75. // } else {
  76. // vm.alertService_1.showMessage('提示', '加入课程成功');
  77. // vm.alertService_3.invite = "";
  78. // loadClassList();
  79. // }
  80. // });
  81. // } else {
  82. // if(vm.alertService_3.invite){
  83. // vm.alertService_1.showMessage('提示', '邀请码格式不正确');
  84. // }
  85. // }
  86. // });
  87. $location.path("/join_class").search({tag: 1});
  88. };
  89. vm.onSetting = function (syllabus) {
  90. console.log(syllabus);
  91. rms.save('current_edit_syllobus', syllabus);
  92. $location.path("/edit_class").search({id: syllabus.id});
  93. }
  94. }]);

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