|
|
|
@ -38,8 +38,8 @@ function buildColumns(that) {
|
|
|
|
|
const isAdminOrCreator = that.props.isAdminOrCreator();
|
|
|
|
|
const isAdminOrTeacher = that.props.isAdminOrTeacher()
|
|
|
|
|
const { course_groups, filterKey } = that.state
|
|
|
|
|
const showSorter = filterKey == '1'
|
|
|
|
|
const courseId = that.props.match.params.coursesId
|
|
|
|
|
const showSorter = filterKey == '1'
|
|
|
|
|
const courseId = that.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
const columns = [{
|
|
|
|
|
title: '序号',
|
|
|
|
@ -48,7 +48,7 @@ function buildColumns(that) {
|
|
|
|
|
width: 78,
|
|
|
|
|
render: (content, item, index) => {
|
|
|
|
|
return index + 1
|
|
|
|
|
// return item.isApply == true ? '' : <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1
|
|
|
|
|
// return item.isApply == true ? '' : <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1
|
|
|
|
|
// - (that.state.application_list ? that.state.application_list.length : 0)} </a>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -70,7 +70,7 @@ function buildColumns(that) {
|
|
|
|
|
sortDirections: sortDirections,
|
|
|
|
|
sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order,
|
|
|
|
|
render: (name, record) => {
|
|
|
|
|
return <a href={`/users/${record.login}`} target="_blank" className="overflowHidden1" style={{ maxWidth: '110px'}}
|
|
|
|
|
return <a href={`/users/${record.login}`} target="_blank" className="overflowHidden1" style={{ maxWidth: '110px'}}
|
|
|
|
|
title={`${name.length > 4 ? name : ''}`}>{name}</a>
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
@ -84,7 +84,7 @@ function buildColumns(that) {
|
|
|
|
|
sortDirections: sortDirections,
|
|
|
|
|
sortOrder: sortedInfo.columnKey === 'role' && sortedInfo.order,
|
|
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
}]
|
|
|
|
|
that.state.course_groups && that.state.course_groups.length && showSorter && columns.push({
|
|
|
|
|
title: <Tooltip title="仅能批阅指定分班的作品">管理权限</Tooltip>,
|
|
|
|
|
width: 260,
|
|
|
|
@ -152,13 +152,13 @@ function buildColumns(that) {
|
|
|
|
|
<span>
|
|
|
|
|
<WordsBtn onClick={() => that.onRefuse(record)} style={'grey'}>拒绝</WordsBtn>
|
|
|
|
|
<Divider type="vertical" />
|
|
|
|
|
<a onClick={() => that.onAgree(record)} style={{color: '#4CACFF'}}>同意</a>
|
|
|
|
|
<a onClick={() => that.onAgree(record)} style={{color: '#4CACFF'}}>同意</a>
|
|
|
|
|
</span> )
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除</WordsBtn>
|
|
|
|
|
<WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除</WordsBtn>
|
|
|
|
|
<ChangeRolePop
|
|
|
|
|
courseId={courseId}
|
|
|
|
|
record={record}
|
|
|
|
@ -169,7 +169,7 @@ function buildColumns(that) {
|
|
|
|
|
fetchUser={that.props.fetchUser}
|
|
|
|
|
|
|
|
|
|
></ChangeRolePop>
|
|
|
|
|
{/* <Popconfirm
|
|
|
|
|
{/* <Popconfirm
|
|
|
|
|
placement="bottom"
|
|
|
|
|
icon={null}
|
|
|
|
|
title={
|
|
|
|
@ -192,11 +192,11 @@ function buildColumns(that) {
|
|
|
|
|
// { record.role == ROLE_TEACHER ? <a style={{color: '#4CACFF'}} onClick={() => that.changeToAssistant(record)}>变更为助教</a> : '' }
|
|
|
|
|
// { record.role == ROLE_TEACHER_ASSISTANT ? <a style={{color: '#4CACFF'}} onClick={() => that.changeToTeacher(record)}>变更为教师</a> : '' }
|
|
|
|
|
// { record.role == ROLE_ADMIN && isAdminOrCreator ? <a style={{color: '#4CACFF', marginLeft: '44px'}} onClick={() => that.showChangeAdminModal(record)}>更换管理员</a> : '' }
|
|
|
|
|
|
|
|
|
|
// </span>
|
|
|
|
|
|
|
|
|
|
// </span>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -209,7 +209,7 @@ function buildColumns(that) {
|
|
|
|
|
render: (content, item, index) => {
|
|
|
|
|
return content ? <Checkbox value={content}></Checkbox> : ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return columns
|
|
|
|
|
}
|
|
|
|
@ -265,10 +265,10 @@ class studentsList extends Component{
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
let url = `/courses/${courseId}/teacher_application_review.json`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.props.confirm({
|
|
|
|
|
content: `是否确认${ approval == 1 ? '同意' : '拒绝'}TA的加入?`,
|
|
|
|
|
onOk: () => {
|
|
|
|
@ -285,11 +285,11 @@ class studentsList extends Component{
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
onRefuse = (record) => {
|
|
|
|
|
this.onAgree(record, 2)
|
|
|
|
@ -343,10 +343,10 @@ class studentsList extends Component{
|
|
|
|
|
// console.log('addTeacherSuccessListener', data)
|
|
|
|
|
}
|
|
|
|
|
getCourseGroups = () => {
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
let url = `/courses/${courseId}/all_course_groups.json`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(url, {
|
|
|
|
|
params: { all: true }
|
|
|
|
|
})
|
|
|
|
@ -369,11 +369,11 @@ class studentsList extends Component{
|
|
|
|
|
}
|
|
|
|
|
joinCourseGroup = (ids, item, index) => {
|
|
|
|
|
// console.log('join ', ids, item)
|
|
|
|
|
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
let url = `/courses/${courseId}/set_course_group.json`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
course_group_ids: ids,
|
|
|
|
|
user_id: item.user_id,
|
|
|
|
@ -382,6 +382,7 @@ class studentsList extends Component{
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
|
this.props.showNotification('修改成功')
|
|
|
|
|
this.props.updatabanners()
|
|
|
|
|
const newArray = ids.map((item) => {return {id: item, name: this.state.course_groups_map[item]}});
|
|
|
|
|
this.setState(
|
|
|
|
|
(prevState) => ({
|
|
|
|
@ -397,18 +398,18 @@ class studentsList extends Component{
|
|
|
|
|
}
|
|
|
|
|
onChangeRoleSuccess = () => {
|
|
|
|
|
this.fetchAll(undefined,this.state.filterKey)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fetchAll = async (argPage,filterKey) => {
|
|
|
|
|
let { searchValue }=this.state
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
let id = this.props.match.params.coursesId
|
|
|
|
|
let id = this.props.match.params.coursesId
|
|
|
|
|
if (argPage) {
|
|
|
|
|
this.setState({ page: argPage })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sortedInfo = this.state.sortedInfo;
|
|
|
|
|
let page = argPage || this.state.page
|
|
|
|
|
|
|
|
|
@ -436,7 +437,7 @@ class studentsList extends Component{
|
|
|
|
|
const result = await axios.get(encodeURI(url))
|
|
|
|
|
// axios.get((url)).then((result)=>{
|
|
|
|
|
if (result.data.teacher_list) {
|
|
|
|
|
this.setState({
|
|
|
|
|
this.setState({
|
|
|
|
|
teachers: result.data.teacher_list,
|
|
|
|
|
total_count: result.data.teacher_list_size,
|
|
|
|
|
application_list: result.data.application_list || [],
|
|
|
|
@ -445,7 +446,7 @@ class studentsList extends Component{
|
|
|
|
|
isSpin:false
|
|
|
|
|
})
|
|
|
|
|
} else if (result.data.application_list) {
|
|
|
|
|
this.setState({
|
|
|
|
|
this.setState({
|
|
|
|
|
total_count: result.data.teacher_list_size,
|
|
|
|
|
application_list: result.data.application_list || [],
|
|
|
|
|
is_admin: result.data.is_admin,
|
|
|
|
@ -461,7 +462,7 @@ class studentsList extends Component{
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
getGroupList(){
|
|
|
|
|
let id = this.props.match.params.coursesId
|
|
|
|
|
let id = this.props.match.params.coursesId
|
|
|
|
|
let url='/courses/'+id+'/graduation_group_list.json';
|
|
|
|
|
axios.get((url)).then((result)=>{
|
|
|
|
|
if(result.status==200){
|
|
|
|
@ -543,16 +544,16 @@ class studentsList extends Component{
|
|
|
|
|
this.setState({ order: order }, () => {
|
|
|
|
|
this.fetchAll()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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`;
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
course_member_id: member.course_member_id
|
|
|
|
|
// "user_list": [
|
|
|
|
|
// { "user_id": member.user_id }
|
|
|
|
|
// { "user_id": member.user_id }
|
|
|
|
|
// ],
|
|
|
|
|
// "graduation_group_id": member.graduation_group_id,
|
|
|
|
|
// "course_group_id": "820",
|
|
|
|
@ -588,7 +589,7 @@ class studentsList extends Component{
|
|
|
|
|
const courseId = this.props.match.params.coursesId
|
|
|
|
|
|
|
|
|
|
const url = `/courses/${courseId}/delete_course_teacher.json`
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
course_member_id: member.course_member_id
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
@ -601,15 +602,15 @@ class studentsList extends Component{
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
addTeacher = () => {
|
|
|
|
|
this.refs.addTeacherModal.setVisible(true)
|
|
|
|
|
this.refs.addTeacherModal.setVisible(true)
|
|
|
|
|
}
|
|
|
|
|
addStudent = () => {
|
|
|
|
|
this.refs.addStudentModal.setVisible(true)
|
|
|
|
|
this.refs.addStudentModal.setVisible(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hasGraduationModule = () => {
|
|
|
|
@ -619,7 +620,7 @@ class studentsList extends Component{
|
|
|
|
|
})
|
|
|
|
|
return result && result.length > 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onTableChange = (pagination, filters, sorter) => {
|
|
|
|
|
let {filterKey}=this.state;
|
|
|
|
|
console.log('Various parameters', pagination, filters, sorter);
|
|
|
|
@ -679,11 +680,11 @@ class studentsList extends Component{
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{/* <AddTeacherModal ref="addTeacherModal"
|
|
|
|
|
{/* <AddTeacherModal ref="addTeacherModal"
|
|
|
|
|
{...this.props}
|
|
|
|
|
moduleName="教师"
|
|
|
|
|
></AddTeacherModal>
|
|
|
|
|
<AddStudentModal ref="addStudentModal"
|
|
|
|
|
<AddStudentModal ref="addStudentModal"
|
|
|
|
|
{...this.props}
|
|
|
|
|
moduleName="学生"
|
|
|
|
|
></AddStudentModal> */}
|
|
|
|
@ -694,7 +695,7 @@ class studentsList extends Component{
|
|
|
|
|
{...this.props} onOk={this.showChangeAdminModal}
|
|
|
|
|
changeAdminSuccess={this.changeAdminSuccess}
|
|
|
|
|
></AddAdminModal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Titlesearchsection
|
|
|
|
|
title={<React.Fragment>
|
|
|
|
|
<span>教师列表</span>
|
|
|
|
@ -708,9 +709,9 @@ class studentsList extends Component{
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{/* { isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addTeacher()}>添加教师</WordsBtn> }
|
|
|
|
|
{ isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addStudent()}>添加学生</WordsBtn> } */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ isAdminOrCreator && <WordsBtn style="blue" className="fr" onClick={()=>this.showChangeAdminModal()}>更换管理员</WordsBtn>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
}
|
|
|
|
|
secondRowLeft={
|
|
|
|
@ -777,7 +778,7 @@ class studentsList extends Component{
|
|
|
|
|
{ hasGraduationModule && isAdminOrTeacher && <li className="li_line drop_down">
|
|
|
|
|
加入答辩组<i className="iconfont icon-xiajiantou font-12 ml2"></i>
|
|
|
|
|
<ul className="drop_down_menu" style={{"right":"0px","left":"unset", minWidth: '222px'}}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
groupList && groupList.graduation_groups_count>10?
|
|
|
|
|
(<p className="drop_down_search">
|
|
|
|
@ -814,10 +815,10 @@ class studentsList extends Component{
|
|
|
|
|
</div>}
|
|
|
|
|
<Spin size="large" spinning={this.state.isSpin}>
|
|
|
|
|
<div className="clearfix stu_table teacher_table">
|
|
|
|
|
{combineArray.length ?
|
|
|
|
|
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
|
|
|
|
{combineArray.length ?
|
|
|
|
|
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
|
|
|
|
{/* pagination={{ current: page, total: total_count, pageSize:20, onChange: this.onPageChange }} */}
|
|
|
|
|
<Table columns={columns} dataSource={combineArray}
|
|
|
|
|
<Table columns={columns} dataSource={combineArray}
|
|
|
|
|
onChange={this.onTableChange}
|
|
|
|
|
pagination={total_count > 20 && filterKey == '1' ? { //分页
|
|
|
|
|
total: page == 1 && this.state.application_list.length ? total_count + total_count / Math.floor(this.state.application_list.length + 20) : total_count , //数据总数量
|
|
|
|
|