|
|
|
@ -14,7 +14,12 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vm.alertService = alertService.create();
|
|
|
|
|
//单弹框
|
|
|
|
|
vm.alertService_1 = alertService.create();
|
|
|
|
|
|
|
|
|
|
//双弹框
|
|
|
|
|
vm.alertService_2 = alertService.create();
|
|
|
|
|
|
|
|
|
|
vm.addClass = function(){
|
|
|
|
|
vm.syllabus.courses.push({});
|
|
|
|
|
};
|
|
|
|
@ -22,18 +27,21 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale
|
|
|
|
|
vm.deleteClass = function(index){
|
|
|
|
|
var course = vm.syllabus.courses[index];
|
|
|
|
|
if(course.id >0){
|
|
|
|
|
$http.post(config.apiUrl+'courses/'+course.id+'/del', {
|
|
|
|
|
token: auth.token()
|
|
|
|
|
}).then(function(response){
|
|
|
|
|
if(response.data.status!=0){
|
|
|
|
|
vm.alertService.showMessage('出错了', response.data.message);
|
|
|
|
|
} else {
|
|
|
|
|
vm.alertService.showMessage('提示', '删除班级成功', function(){
|
|
|
|
|
vm.syllabus.courses.splice(index, 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log(response.data.data);
|
|
|
|
|
vm.alertService_2.showMessage('提示', '您确定要删除该班级吗?', function() {
|
|
|
|
|
$http.post(config.apiUrl+'courses/'+course.id+'/del', {
|
|
|
|
|
token: auth.token()
|
|
|
|
|
}).then(function(response){
|
|
|
|
|
if(response.data.status!=0){
|
|
|
|
|
vm.alertService_1.showMessage('出错了', response.data.message);
|
|
|
|
|
} else {
|
|
|
|
|
vm.alertService_1.showMessage('提示', '删除班级成功', function(){
|
|
|
|
|
vm.syllabus.courses.splice(index, 1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log(response.data.data);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
vm.syllabus.courses.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
@ -63,9 +71,9 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale
|
|
|
|
|
courses: courses
|
|
|
|
|
}).then(function(response){
|
|
|
|
|
if(response.data.status!=0){
|
|
|
|
|
vm.alertService.showMessage('出错了', response.data.message);
|
|
|
|
|
vm.alertService_1.showMessage('出错了', response.data.message);
|
|
|
|
|
} else {
|
|
|
|
|
vm.alertService.showMessage('提示', '保存课程成功', function(){
|
|
|
|
|
vm.alertService_1.showMessage('提示', '保存课程成功', function(){
|
|
|
|
|
window.history.back();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|