dev_forum
hjm 6 years ago
parent e77bc70aea
commit 9d954ea61e

@ -8,7 +8,6 @@ import { WordsBtn } from 'educoder'
import AccessoryModal2 from '../coursesPublic/AccessoryModal2' import AccessoryModal2 from '../coursesPublic/AccessoryModal2'
import AccessoryModal from '../coursesPublic/AccessoryModal' import AccessoryModal from '../coursesPublic/AccessoryModal'
import axios from 'axios' import axios from 'axios'
import ConnectProject from './ConnectProject'
class CommonWorkItem extends Component{ class CommonWorkItem extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -196,7 +195,7 @@ class CommonWorkItem extends Component{
<li className="fr"> <li className="fr">
{ // { //
item.work_status && item.work_status.indexOf('关联项目') != -1 && 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 && item.work_status && item.work_status.indexOf('提交作品') != -1 &&

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

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

Loading…
Cancel
Save