|
|
@ -8,7 +8,8 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo
|
|
|
|
var vm = $scope;
|
|
|
|
var vm = $scope;
|
|
|
|
vm.syllabuses = rms.get('syllabuses') || [];
|
|
|
|
vm.syllabuses = rms.get('syllabuses') || [];
|
|
|
|
|
|
|
|
|
|
|
|
vm.alertService = alertService.create();
|
|
|
|
vm.alertService_1 = alertService.create();
|
|
|
|
|
|
|
|
vm.alertService_3 = alertService.create();
|
|
|
|
|
|
|
|
|
|
|
|
var loadClassList = function () {
|
|
|
|
var loadClassList = function () {
|
|
|
|
$http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
|
|
|
|
$http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
|
|
|
@ -36,7 +37,7 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo
|
|
|
|
function (response) {
|
|
|
|
function (response) {
|
|
|
|
console.log(response.data);
|
|
|
|
console.log(response.data);
|
|
|
|
if (response.data.auth == 0) {
|
|
|
|
if (response.data.auth == 0) {
|
|
|
|
vm.alertService.showMessage('提示', '非教师身份不能创建课程哦~');
|
|
|
|
vm.alertService_1.showMessage('提示', '非教师身份不能创建课程哦~');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
$location.path("/new_class");
|
|
|
|
$location.path("/new_class");
|
|
|
@ -50,26 +51,28 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vm.joinClass = function () {
|
|
|
|
vm.joinClass = function () {
|
|
|
|
var code = window.prompt("请输入5位班级邀请码(不区分大小写)");
|
|
|
|
vm.alertService_3.showMessage('提示', '请输入5位班级邀请码(不区分大小写)', function(){
|
|
|
|
if (code && code.length == 5) {
|
|
|
|
if (vm.alertService_3.invite && vm.alertService_3.invite.length == 5) {
|
|
|
|
$http.post(config.apiUrl + "courses/join", {
|
|
|
|
$http.post(config.apiUrl + "courses/join", {
|
|
|
|
token: auth.token(),
|
|
|
|
token: auth.token(),
|
|
|
|
invite_code: code
|
|
|
|
invite_code: vm.alertService_3.invite
|
|
|
|
}).then(function (response) {
|
|
|
|
}).then(function (response) {
|
|
|
|
console.log(response.data);
|
|
|
|
console.log(response.data);
|
|
|
|
if (response.data.status != 0) {
|
|
|
|
if (response.data.status != 0) {
|
|
|
|
vm.alertService.showMessage('错误', response.data.message);
|
|
|
|
vm.alertService_1.showMessage('错误', response.data.message);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
vm.alertService.showMessage('提示', '加入课程成功');
|
|
|
|
vm.alertService_1.showMessage('提示', '加入课程成功');
|
|
|
|
loadClassList();
|
|
|
|
vm.alertService_3.invite = "";
|
|
|
|
|
|
|
|
loadClassList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(vm.alertService_3.invite){
|
|
|
|
|
|
|
|
vm.alertService_1.showMessage('错误', '邀请码格式不正确');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(code){
|
|
|
|
|
|
|
|
vm.alertService.showMessage('错误', '邀请码格式不正确');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
vm.onSetting = function (syllabus) {
|
|
|
|
vm.onSetting = function (syllabus) {
|
|
|
|