-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteacherjs
68 lines (60 loc) · 1.95 KB
/
teacherjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
stuApp.controller("stuController", function stuController($scope, $http) {
$scope.stu={stuId:"",stuName:"",englishName:"",gender:"",photo:"",idCard:"",stuPwd:"",classes:""}
var baseUrl = Path.getUri("api/")
$scope.getAllCollege = function () {
$http.get(baseUrl + "college/all").success(function (data) {
$scope.CollegeAll = data;
$scope.college = $scope.CollegeAll[0];
$scope.getStuByCollegeId($scope.college);
})
}
$scope.getStuByCollegeId=function(college){
$scope.college=college;
$http.get(baseUrl+"stu/stu-collegeId/"+$scope.college.collegeId).success(function(data){
$scope.stus=data;
})
}
$scope.deleteIconClick=function(stu){
$http.delete(baseUrl+"stu/"+stu.stuId).succes
})
}
$scope.deleteStus=function(){
var stuIds=[];
$scope.stus.forEach(function(stu){
if(stu.item){
stuIds.push(stu.stuId);
}
})
$http.post(baseUrl+"stu/delete",stuIds).success(function(){
$scope.getAllCollege();
})
}
$scope.getAllClasses=function(){
$http.get(baseUrl+"classes/all").success(function(data){
$scope.classAll=data;
})
}
$scope.updateIconClick=function(stu){
$scope.getStuByCollegeId($scope.college);
$scope.stuId=stu.stuId;
$scope.stuName=stu.stuName;
$scope.gender=stu.gender;
$scope.idCard=stu.idCard;
$scope.photo=stu.photo;
$scope.classId=stu.classes;
$scope.getAllClasses();
}
$scope.sureButtonClick=function(){
$("#myModal").modal("hide");
$scope.getStuByCollegeId($scope.college);
}
$scope.addButtonClick=function(){
$scope.stuId="";
$scope.stuName="";
$scope.gender="";
$scope.idCard="";
$scope.photo="dog.jpg" ;
$scope.getAllClasses();
}
$scope.getAllCollege();
})