39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
|
|
|
|
app.controller('JoinClassGroupController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx,common){
|
|
var vm = $scope;
|
|
|
|
var course_id = $routeParams.id;
|
|
vm.alertService = alertService.create();
|
|
|
|
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
|
|
function(response) {
|
|
console.log(response.data);
|
|
if (response.data.status == 0){
|
|
vm.current_course = response.data.data;
|
|
console.log("courses");
|
|
console.log(response.data.data);
|
|
}
|
|
else{
|
|
vm.alertService.showMessage('提示', response.data.message);
|
|
}
|
|
if(!vm.current_course){
|
|
vm.tip_1 = "该班级不存在或已被删除";
|
|
}
|
|
}
|
|
);
|
|
|
|
if(vm.current_course){
|
|
$http.get(config.apiUrl + 'courses/course_groups?token='+auth.token()+'&course_id='+course_id).then(
|
|
function(response) {
|
|
if(response.data.status == 0) {
|
|
vm.groups = response.data.groups;
|
|
}
|
|
else{
|
|
vm.groups = [];
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}] ); |