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.

new_class.js 1.5 kB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','rms','common', function($scope, $http, auth, config, alertService, $location,rms,common){
  2. // common.checkLogin();
  3. var vm = $scope;
  4. vm.alertService = alertService.create();
  5. vm.syllabus = {
  6. courses: [{name: ''}],
  7. };
  8. vm.addClass = function(){
  9. vm.syllabus.courses.push({});
  10. };
  11. vm.deleteClass = function(index){
  12. vm.syllabus.courses.splice(index, 1);
  13. }
  14. vm.newClass = function (frm, syllabus) {
  15. frm.$setSubmitted();
  16. console.log(syllabus);
  17. if(!frm.$valid){
  18. console.log(frm.$error);
  19. return;
  20. }
  21. var courses = [];
  22. for(var i in vm.syllabus.courses){
  23. courses .push(vm.syllabus.courses[i].name);
  24. }
  25. $http.post(config.apiUrl+"syllabuses", {
  26. token: auth.token(),
  27. title: syllabus.title,
  28. courses: courses
  29. }).then(function(response){
  30. if(response.data.status!=0){
  31. vm.alertService.showMessage('出错了', response.data.message);
  32. } else {
  33. vm.alertService.showMessage('提示', '新建课程成功', function(){
  34. // window.history.back();
  35. rms.save('syllabuses',[]);
  36. $location.path("/class_list");
  37. });
  38. }
  39. console.log(response.data.data);
  40. });
  41. }
  42. }] );

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