|
|
@ -258,7 +258,7 @@ class studentsList extends Component{
|
|
|
|
// approval 2 - 拒绝
|
|
|
|
// approval 2 - 拒绝
|
|
|
|
onAgree = (record, approval = 1) => {
|
|
|
|
onAgree = (record, approval = 1) => {
|
|
|
|
const isAdminOrCreator = this.props.isAdminOrCreator()
|
|
|
|
const isAdminOrCreator = this.props.isAdminOrCreator()
|
|
|
|
const { course_groups } = this.state
|
|
|
|
const { course_groups ,filterKey} = this.state
|
|
|
|
if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) {
|
|
|
|
if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) {
|
|
|
|
this.setState({ clickRecord: record}, () => {
|
|
|
|
this.setState({ clickRecord: record}, () => {
|
|
|
|
this.setGroupChooserModalVisible(true)
|
|
|
|
this.setGroupChooserModalVisible(true)
|
|
|
@ -280,7 +280,7 @@ class studentsList extends Component{
|
|
|
|
.then((response) => {
|
|
|
|
.then((response) => {
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
this.props.showNotification(`已${approval == 1? '同意' : '拒绝'}`)
|
|
|
|
this.props.showNotification(`已${approval == 1? '同意' : '拒绝'}`)
|
|
|
|
this.fetchAll(1)
|
|
|
|
this.fetchAll(1,filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
@ -304,13 +304,15 @@ class studentsList extends Component{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
filterKey:'1'
|
|
|
|
filterKey:'1'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.fetchAll(1,'1');
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
filterKey:'2'
|
|
|
|
filterKey:'2'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.fetchAll(1,'2');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.fetchAll(1);
|
|
|
|
|
|
|
|
const isAdminOrTeacher = this.props.isAdminOrTeacher()
|
|
|
|
const isAdminOrTeacher = this.props.isAdminOrTeacher()
|
|
|
|
const isAdmin = this.props.isAdmin()
|
|
|
|
const isAdmin = this.props.isAdmin()
|
|
|
|
|
|
|
|
|
|
|
@ -330,10 +332,11 @@ class studentsList extends Component{
|
|
|
|
this.getCourseGroups()
|
|
|
|
this.getCourseGroups()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addTeacherSuccessListener = (e, data) => {
|
|
|
|
addTeacherSuccessListener = (e, data) => {
|
|
|
|
|
|
|
|
|
|
|
|
// const params = JSON.parse(data)
|
|
|
|
// const params = JSON.parse(data)
|
|
|
|
// const coursesId = this.props.match.params.coursesId
|
|
|
|
// const coursesId = this.props.match.params.coursesId
|
|
|
|
if (window.location.pathname.endsWith('teachers')) {
|
|
|
|
if (window.location.pathname.endsWith('teachers')) {
|
|
|
|
this.fetchAll(1)
|
|
|
|
this.fetchAll(1,this.state.filterKey)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// this.props.history.push(`/courses/${coursesId}/teachers`)
|
|
|
|
// this.props.history.push(`/courses/${coursesId}/teachers`)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -393,10 +396,10 @@ class studentsList extends Component{
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onChangeRoleSuccess = () => {
|
|
|
|
onChangeRoleSuccess = () => {
|
|
|
|
this.fetchAll()
|
|
|
|
this.fetchAll(undefined,this.state.filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fetchAll = async (argPage) => {
|
|
|
|
fetchAll = async (argPage,filterKey) => {
|
|
|
|
let { searchValue, filterKey }=this.state
|
|
|
|
let { searchValue }=this.state
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
@ -477,7 +480,7 @@ class studentsList extends Component{
|
|
|
|
// join_graduation_group
|
|
|
|
// join_graduation_group
|
|
|
|
joinGraduationGroup = (graduation_group_id) => {
|
|
|
|
joinGraduationGroup = (graduation_group_id) => {
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
let { filterKey }=this.state
|
|
|
|
let url= `/courses/${courseId}/join_graduation_group.json`;
|
|
|
|
let url= `/courses/${courseId}/join_graduation_group.json`;
|
|
|
|
axios.post(url, {
|
|
|
|
axios.post(url, {
|
|
|
|
course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }),
|
|
|
|
course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }),
|
|
|
@ -485,7 +488,7 @@ class studentsList extends Component{
|
|
|
|
}).then((result)=>{
|
|
|
|
}).then((result)=>{
|
|
|
|
if(result.data.status==0){
|
|
|
|
if(result.data.status==0){
|
|
|
|
this.props.showNotification('操作成功。')
|
|
|
|
this.props.showNotification('操作成功。')
|
|
|
|
this.fetchAll()
|
|
|
|
this.fetchAll(undefined,filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error)=>{
|
|
|
|
}).catch((error)=>{
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
@ -493,6 +496,7 @@ class studentsList extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onInputSearchChange = (e) => {
|
|
|
|
onInputSearchChange = (e) => {
|
|
|
|
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
searchValue: e.target.value
|
|
|
|
searchValue: e.target.value
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -501,12 +505,12 @@ class studentsList extends Component{
|
|
|
|
clearTimeout(this.timeoutHandler)
|
|
|
|
clearTimeout(this.timeoutHandler)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.timeoutHandler = setTimeout(() => {
|
|
|
|
this.timeoutHandler = setTimeout(() => {
|
|
|
|
this.fetchAll(1)
|
|
|
|
this.fetchAll(1,filterKey)
|
|
|
|
}, 1200)
|
|
|
|
}, 1200)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onPressEnter = (e) => {
|
|
|
|
onPressEnter = (e) => {
|
|
|
|
this.fetchAll(1)
|
|
|
|
this.fetchAll(1,this.state.filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -543,7 +547,7 @@ class studentsList extends Component{
|
|
|
|
changeRole = (member, role) => {
|
|
|
|
changeRole = (member, role) => {
|
|
|
|
|
|
|
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
let url= `/courses/${courseId}/change_course_teacher.json`;
|
|
|
|
let url= `/courses/${courseId}/change_course_teacher.json`;
|
|
|
|
axios.post(url, {
|
|
|
|
axios.post(url, {
|
|
|
|
course_member_id: member.course_member_id
|
|
|
|
course_member_id: member.course_member_id
|
|
|
@ -556,7 +560,7 @@ class studentsList extends Component{
|
|
|
|
}).then((result)=>{
|
|
|
|
}).then((result)=>{
|
|
|
|
if(result.data.status==0){
|
|
|
|
if(result.data.status==0){
|
|
|
|
this.props.showNotification('操作成功。')
|
|
|
|
this.props.showNotification('操作成功。')
|
|
|
|
this.fetchAll()
|
|
|
|
this.fetchAll(undefined,filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error)=>{
|
|
|
|
}).catch((error)=>{
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
@ -572,9 +576,11 @@ class studentsList extends Component{
|
|
|
|
this.refs.addAdminModal.setVisible(true)
|
|
|
|
this.refs.addAdminModal.setVisible(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
changeAdminSuccess = () => {
|
|
|
|
changeAdminSuccess = () => {
|
|
|
|
this.fetchAll()
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
|
|
|
|
this.fetchAll(undefined,filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onDelete = (member) => {
|
|
|
|
onDelete = (member) => {
|
|
|
|
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
this.props.confirm({
|
|
|
|
this.props.confirm({
|
|
|
|
content: `确认要将“${member.name}”从教师列表中移除吗?`,
|
|
|
|
content: `确认要将“${member.name}”从教师列表中移除吗?`,
|
|
|
|
onOk: () => {
|
|
|
|
onOk: () => {
|
|
|
@ -590,7 +596,7 @@ class studentsList extends Component{
|
|
|
|
// {"status":1,"message":"删除成功"}
|
|
|
|
// {"status":1,"message":"删除成功"}
|
|
|
|
this.props.showNotification('删除成功')
|
|
|
|
this.props.showNotification('删除成功')
|
|
|
|
trigger('updatabanner')
|
|
|
|
trigger('updatabanner')
|
|
|
|
this.fetchAll()
|
|
|
|
this.fetchAll(undefined,filterKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
@ -615,12 +621,13 @@ class studentsList extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onTableChange = (pagination, filters, sorter) => {
|
|
|
|
onTableChange = (pagination, filters, sorter) => {
|
|
|
|
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
console.log('Various parameters', pagination, filters, sorter);
|
|
|
|
console.log('Various parameters', pagination, filters, sorter);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
page: pagination.current,
|
|
|
|
page: pagination.current,
|
|
|
|
sortedInfo: sorter,
|
|
|
|
sortedInfo: sorter,
|
|
|
|
}, () => {
|
|
|
|
}, () => {
|
|
|
|
this.fetchAll()
|
|
|
|
this.fetchAll(undefined,filterKey)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
clearSelection = () => {
|
|
|
|
clearSelection = () => {
|
|
|
@ -633,7 +640,7 @@ class studentsList extends Component{
|
|
|
|
page:1,
|
|
|
|
page:1,
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
}, () => {
|
|
|
|
}, () => {
|
|
|
|
this.fetchAll();
|
|
|
|
this.fetchAll(undefined,e.key);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setGroupChooserModalVisible = (visible) => {
|
|
|
|
setGroupChooserModalVisible = (visible) => {
|
|
|
@ -755,9 +762,11 @@ class studentsList extends Component{
|
|
|
|
<div className="mt20 edu-back-white padding20 teacherList">
|
|
|
|
<div className="mt20 edu-back-white padding20 teacherList">
|
|
|
|
|
|
|
|
|
|
|
|
{ course_groups && !!course_groups.length && <CourseGroupChooserModal
|
|
|
|
{ course_groups && !!course_groups.length && <CourseGroupChooserModal
|
|
|
|
|
|
|
|
{...this.state}
|
|
|
|
|
|
|
|
{...this.props}
|
|
|
|
props={{match: this.props.match, showNotification: this.props.showNotification}}
|
|
|
|
props={{match: this.props.match, showNotification: this.props.showNotification}}
|
|
|
|
record={this.state.clickRecord}
|
|
|
|
record={this.state.clickRecord}
|
|
|
|
fetchAll={this.fetchAll}
|
|
|
|
fetchAll={(e)=>this.fetchAll(e,this.state.filterKey)}
|
|
|
|
course_groups={course_groups}
|
|
|
|
course_groups={course_groups}
|
|
|
|
visible={this.state.groupChooserModalVisible}
|
|
|
|
visible={this.state.groupChooserModalVisible}
|
|
|
|
setVisible={this.setGroupChooserModalVisible}
|
|
|
|
setVisible={this.setGroupChooserModalVisible}
|
|
|
|