commit
c9b478df4b
@ -1,235 +1,235 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { Modal, Checkbox, Input, Spin, Select, Divider } from "antd";
|
import { Modal, Checkbox, Input, Spin, Select, Divider } from "antd";
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import ModalWrapper from "../../common/ModalWrapper"
|
import ModalWrapper from "../../common/ModalWrapper"
|
||||||
import InfiniteScroll from 'react-infinite-scroller';
|
import InfiniteScroll from 'react-infinite-scroller';
|
||||||
import { ConditionToolTip } from 'educoder'
|
import { ConditionToolTip } from 'educoder'
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
const pageCount = 15;
|
const pageCount = 15;
|
||||||
|
|
||||||
// 代码查重弹框
|
// 代码查重弹框
|
||||||
class CheckCodeModal extends Component{
|
class CheckCodeModal extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
checkBoxValues: [],
|
checkBoxValues: [],
|
||||||
candidates: [],
|
candidates: [],
|
||||||
hasMore: true,
|
hasMore: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
page: 1
|
page: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fetchMemberList = (arg_page) => {
|
fetchMemberList = (arg_page) => {
|
||||||
const courseId = this.props.match.params.coursesId
|
const courseId = this.props.match.params.coursesId
|
||||||
const page = arg_page || this.state.page;
|
const page = arg_page || this.state.page;
|
||||||
const { name, school_name } = this.state
|
const { name, school_name } = this.state
|
||||||
let url = `/courses/${courseId}/search_teacher_candidate.json`
|
let url = `/courses/${courseId}/search_teacher_candidate.json`
|
||||||
this.setState({ loading: true })
|
this.setState({ loading: true })
|
||||||
axios.post(url, {
|
axios.post(url, {
|
||||||
page: page,
|
page: page,
|
||||||
limit: pageCount,
|
limit: pageCount,
|
||||||
school_name: school_name || '',
|
school_name: school_name || '',
|
||||||
name: name || ''
|
name: name || ''
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.data.candidates || response.data.candidates.length == 0) {
|
if (!response.data.candidates || response.data.candidates.length == 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
page,
|
page,
|
||||||
loading: false,
|
loading: false,
|
||||||
hasMore: false,
|
hasMore: false,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates),
|
candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates),
|
||||||
page,
|
page,
|
||||||
loading: false,
|
loading: false,
|
||||||
hasMore: response.data.candidates.length == pageCount
|
hasMore: response.data.candidates.length == pageCount
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
fetchOptions = () => {
|
fetchOptions = () => {
|
||||||
// add_teacher_popup
|
// add_teacher_popup
|
||||||
const courseId = this.props.match.params.coursesId
|
const courseId = this.props.match.params.coursesId
|
||||||
|
|
||||||
let url = `/courses/${courseId}/add_teacher_popup.json`
|
let url = `/courses/${courseId}/add_teacher_popup.json`
|
||||||
|
|
||||||
axios.get(url, {
|
axios.get(url, {
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.graduation_groups) {
|
if (response.data.graduation_groups) {
|
||||||
this.setState({
|
this.setState({
|
||||||
graduation_groups: response.data.graduation_groups
|
graduation_groups: response.data.graduation_groups
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (response.data.course_groups) {
|
if (response.data.course_groups) {
|
||||||
this.setState({
|
this.setState({
|
||||||
course_groups: response.data.course_groups
|
course_groups: response.data.course_groups
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setVisible = (visible) => {
|
setVisible = (visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
this.fetchMemberList()
|
this.fetchMemberList()
|
||||||
this.fetchOptions()
|
this.fetchOptions()
|
||||||
}
|
}
|
||||||
this.refs.modalWrapper.setVisible(visible)
|
this.refs.modalWrapper.setVisible(visible)
|
||||||
if (visible == false) {
|
if (visible == false) {
|
||||||
this.setState({
|
this.setState({
|
||||||
checkBoxValues: []
|
checkBoxValues: []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSendOk = () => {
|
onSendOk = () => {
|
||||||
const courseId = this.props.match.params.coursesId
|
const courseId = this.props.match.params.coursesId
|
||||||
const url = `/courses/${courseId}/add_teacher.json`
|
const url = `/courses/${courseId}/add_teacher.json`
|
||||||
const params = {
|
const params = {
|
||||||
"user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) ,
|
"user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) ,
|
||||||
"graduation_group_id": "2",
|
"graduation_group_id": "2",
|
||||||
"course_group_id": "820",
|
"course_group_id": "820",
|
||||||
// "role": ROLE_TEACHER_NUM
|
// "role": ROLE_TEACHER_NUM
|
||||||
}
|
}
|
||||||
const { graduationGroup, courseGroup } = this.state
|
const { graduationGroup, courseGroup } = this.state
|
||||||
if (graduationGroup) {
|
if (graduationGroup) {
|
||||||
params.graduation_group_id = graduationGroup
|
params.graduation_group_id = graduationGroup
|
||||||
}
|
}
|
||||||
if (courseGroup) {
|
if (courseGroup) {
|
||||||
params.course_group_id = courseGroup
|
params.course_group_id = courseGroup
|
||||||
}
|
}
|
||||||
axios.post(url, params)
|
axios.post(url, params)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.status == 0) {
|
if (response.data.status == 0) {
|
||||||
this.setVisible(false)
|
this.setVisible(false)
|
||||||
this.props.showNotification('添加成功')
|
this.props.showNotification('添加成功')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onOk = () => {
|
onOk = () => {
|
||||||
this.onSendOk()
|
this.onSendOk()
|
||||||
}
|
}
|
||||||
|
|
||||||
onCheckBoxChange = (checkBoxValues) => {
|
onCheckBoxChange = (checkBoxValues) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
checkBoxValues: checkBoxValues
|
checkBoxValues: checkBoxValues
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInfiniteOnLoad = () => {
|
handleInfiniteOnLoad = () => {
|
||||||
this.fetchMemberList(this.state.page + 1)
|
this.fetchMemberList(this.state.page + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch = () => {
|
onSearch = () => {
|
||||||
this.fetchMemberList(1)
|
this.fetchMemberList(1)
|
||||||
}
|
}
|
||||||
handleGradationGroupChange = (value) => {
|
handleGradationGroupChange = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
graduationGroup: value
|
graduationGroup: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
handleCourseGroupChange = (value) => {
|
handleCourseGroupChange = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
courseGroup: value
|
courseGroup: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
const { candidates, checkBoxValues, loading, hasMore, name, school_name
|
const { candidates, checkBoxValues, loading, hasMore, name, school_name
|
||||||
, graduationGroup, graduation_groups, courseGroup, course_groups } = this.state
|
, graduationGroup, graduation_groups, courseGroup, course_groups } = this.state
|
||||||
const { moduleName } = this.props
|
const { moduleName } = this.props
|
||||||
return(
|
return(
|
||||||
<ModalWrapper
|
<ModalWrapper
|
||||||
ref="modalWrapper"
|
ref="modalWrapper"
|
||||||
width="700px"
|
width="700px"
|
||||||
title={`代码查重`}
|
title={`代码查重`}
|
||||||
{...this.props }
|
{...this.props }
|
||||||
onOk={this.onOk}
|
onOk={this.onOk}
|
||||||
className="checkCodeModal"
|
className="checkCodeModal"
|
||||||
>
|
>
|
||||||
<style>
|
<style>
|
||||||
{`
|
{`
|
||||||
.demo-loading-container {
|
.demo-loading-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 93px;
|
bottom: 93px;
|
||||||
width: 82%;
|
width: 82%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.df {
|
.df {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
margin: 12px 0;
|
margin: 12px 0;
|
||||||
}
|
}
|
||||||
.firstLabel {
|
.firstLabel {
|
||||||
flex: 0 0 60px;
|
flex: 0 0 60px;
|
||||||
}
|
}
|
||||||
.df span.label {
|
.df span.label {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
.df .ant-input-affix-wrapper {
|
.df .ant-input-affix-wrapper {
|
||||||
width: 32%;
|
width: 32%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkCodeModal label.task-hide {
|
.checkCodeModal label.task-hide {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
|
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
|
||||||
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
|
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
|
||||||
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'分班名称'}</label></span>
|
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'分班名称'}</label></span>
|
||||||
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'有效作品数'}</label></span>
|
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'有效作品数'}</label></span>
|
||||||
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'上次查重时间'}</label></span>
|
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'上次查重时间'}</label></span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
|
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
|
||||||
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
|
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
|
||||||
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
||||||
|
|
||||||
{ candidates && candidates.map( candidate => {
|
{ candidates && candidates.map( candidate => {
|
||||||
return (
|
return (
|
||||||
<p className="clearfix mb7" key={candidate.id}>
|
<p className="clearfix mb7" key={candidate.id}>
|
||||||
<Checkbox className="fl" value={candidate.id} ></Checkbox>
|
<Checkbox className="fl" value={candidate.id} ></Checkbox>
|
||||||
<span className="fl with25">
|
<span className="fl with25">
|
||||||
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
|
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
|
||||||
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.name}</label>
|
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.name}</label>
|
||||||
</ConditionToolTip>
|
</ConditionToolTip>
|
||||||
</span>
|
</span>
|
||||||
<span className="fl with25">
|
<span className="fl with25">
|
||||||
<ConditionToolTip title={candidate.nickname} condition={candidate.nickname && candidate.nickname.length > 12 }>
|
<ConditionToolTip title={candidate.nickname} condition={candidate.nickname && candidate.nickname.length > 12 }>
|
||||||
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.nickname}</label>
|
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.nickname}</label>
|
||||||
</ConditionToolTip>
|
</ConditionToolTip>
|
||||||
</span>
|
</span>
|
||||||
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
|
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
}) }
|
}) }
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ModalWrapper>
|
</ModalWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default CheckCodeModal;
|
export default CheckCodeModal;
|
||||||
|
Loading…
Reference in new issue