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

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

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