|
|
|
@ -5,6 +5,7 @@ import '../css/members.css'
|
|
|
|
|
import { WordsBtn } from 'educoder'
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import InfiniteScroll from 'react-infinite-scroller';
|
|
|
|
|
import NoneData from "../coursesPublic/NoneData"
|
|
|
|
|
|
|
|
|
|
const Search =Input.Search;
|
|
|
|
|
const LIMIT = 15
|
|
|
|
@ -36,7 +37,7 @@ class ConnectProject extends Component{
|
|
|
|
|
this.connectProject(radioValue)
|
|
|
|
|
}
|
|
|
|
|
connectProject = (project_id) => {
|
|
|
|
|
let workId=this.props.work.homework_id;
|
|
|
|
|
let workId=this.work.homework_id;
|
|
|
|
|
const url = `/homework_commons/${workId}/student_works/relate_project.json`
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
project_id: project_id
|
|
|
|
@ -75,6 +76,9 @@ class ConnectProject extends Component{
|
|
|
|
|
loading: false,
|
|
|
|
|
hasMore: result.data.projects.length != 0
|
|
|
|
|
})
|
|
|
|
|
if (page == 1) {
|
|
|
|
|
this.setState({ haveProjects: result.data.projects.length > 0 })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
@ -84,11 +88,12 @@ class ConnectProject extends Component{
|
|
|
|
|
if (window.location.port == 3007) {
|
|
|
|
|
window.location.href = '/testbdweb.educoder.net/projects/new'
|
|
|
|
|
} else {
|
|
|
|
|
window.location.href = '/educoder.net/projects/new'
|
|
|
|
|
window.location.href = '/projects/new'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//关联项目
|
|
|
|
|
openConnectionProject=()=>{
|
|
|
|
|
openConnectionProject=(work)=>{
|
|
|
|
|
this.work = work;
|
|
|
|
|
this.fetchData()
|
|
|
|
|
this.setState({
|
|
|
|
|
project_flag:true
|
|
|
|
@ -107,7 +112,6 @@ class ConnectProject extends Component{
|
|
|
|
|
let {project_flag, projects, loading, hasMore }=this.state;
|
|
|
|
|
return(
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<WordsBtn style="blue" className={` font-16 ${this.props.className || ''}`} onClick={this.openConnectionProject}>关联项目</WordsBtn>
|
|
|
|
|
<Modal
|
|
|
|
|
visible={project_flag}
|
|
|
|
|
title="关联项目"
|
|
|
|
@ -120,7 +124,7 @@ class ConnectProject extends Component{
|
|
|
|
|
>
|
|
|
|
|
<div className="newupload_conbox clearfix">
|
|
|
|
|
{
|
|
|
|
|
projects && !!projects.length &&
|
|
|
|
|
(projects && !!projects.length || this.state.keyword) &&
|
|
|
|
|
<div>
|
|
|
|
|
<Search placeholder="请输入项目名称进行搜索" className="with100"
|
|
|
|
|
value={this.state.keyword} onInput={(e) => {this.setState({keyword: e.target.value})}}
|
|
|
|
@ -145,7 +149,11 @@ class ConnectProject extends Component{
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
(!projects || projects.length == 0) &&
|
|
|
|
|
haveProjects && projects.length == 0 &&
|
|
|
|
|
<NoneData></NoneData>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
(!haveProjects) &&
|
|
|
|
|
<div className="edu-txt-center">
|
|
|
|
|
您当前尚未管理任何项目,请先<WordsBtn style="blue" className="" onClick={this.toCreateProject}>创建项目</WordsBtn>再关联
|
|
|
|
|
</div>
|
|
|
|
|