dev_forum
hjm 6 years ago
parent e77bc70aea
commit 9d954ea61e

@ -8,7 +8,6 @@ import { WordsBtn } from 'educoder'
import AccessoryModal2 from '../coursesPublic/AccessoryModal2'
import AccessoryModal from '../coursesPublic/AccessoryModal'
import axios from 'axios'
import ConnectProject from './ConnectProject'
class CommonWorkItem extends Component{
constructor(props){
super(props);
@ -196,7 +195,7 @@ class CommonWorkItem extends Component{
<li className="fr">
{ //
item.work_status && item.work_status.indexOf('关联项目') != -1 &&
<ConnectProject className="fl" {...this.props} work={item}></ConnectProject>
<WordsBtn style="blue" className={` font-16 fl}`} onClick={() => this.props.openConnectionProject(item)}>关联项目</WordsBtn>
}
{ //
item.work_status && item.work_status.indexOf('提交作品') != -1 &&

@ -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>

@ -9,6 +9,7 @@ import '../css/busyWork.css'
import CoursesListType from '../coursesPublic/CoursesListType'
import CommonWorkItem from './CommonWorkItem'
import PublishRightnow from './PublishRightnow'
import ConnectProject from './ConnectProject'
import { WordsBtn } from 'educoder'
import Modals from '../../modals/Modals'
@ -53,7 +54,9 @@ class commonWork extends Component{
let {page,search,order}=this.state;
this.getList(page,search,order);
}
openConnectionProject = (work) => {
this.refs['connectProject'].openConnectionProject(work)
}
// 新建
createCommonWork=(type)=>{
@ -338,6 +341,8 @@ class commonWork extends Component{
</div>
</div>
</div> */}
<ConnectProject ref="connectProject" {...this.props}></ConnectProject>
<Titlesearchsection
title={main_category_name}
@ -418,7 +423,9 @@ class commonWork extends Component{
<Spin size="large" spinning={this.state.isSpin}>
<Checkbox.Group style={{"width":"100%"}} onChange={this.onChangeSelect} value={checkBoxValues}>
<CommonWorkItem mainList={mainList} {...this.props} workType={workType} onItemClick={this.onItemClick}></CommonWorkItem>
<CommonWorkItem mainList={mainList} {...this.props} workType={workType} onItemClick={this.onItemClick}
openConnectionProject={this.openConnectionProject}
></CommonWorkItem>
</Checkbox.Group>
</Spin>

Loading…
Cancel
Save