ConnectProject

dev_forum
hjm 6 years ago
parent 786cdff86c
commit 5444373331

@ -97,6 +97,13 @@ class CommonWorkItem extends Component{
setupdate = () => { setupdate = () => {
} }
toCreateProject = () => {
if (window.location.port == 3007) {
window.location.href = '/testbdweb.educoder.net/projects/new'
} else {
window.location.href = '/projects/new'
}
}
render(){ render(){
let { mainList,workType }=this.props; let { mainList,workType }=this.props;
const { aModalVisible, fileList, revise_reason } = this.state const { aModalVisible, fileList, revise_reason } = this.state
@ -195,12 +202,22 @@ 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 &&
<WordsBtn style="blue" className={` font-16 fl}`} onClick={() => this.props.openConnectionProject(item)}>关联项目</WordsBtn> <React.Fragment>
<WordsBtn style="blue" className={` font-16 fl`} onClick={() => this.props.toCreateProject(item)}>创建项目</WordsBtn>
<WordsBtn style="blue" className={` font-16 fl ml28`} onClick={() => this.props.openConnectionProject(item)}>关联项目</WordsBtn>
</React.Fragment>
}
{ //
item.work_status && item.work_status.indexOf('取消关联') != -1 &&
<WordsBtn style="blue" className={` font-16 fl`} onClick={() => this.props.cancelConnectionProject(item)}>取消关联</WordsBtn>
} }
{ // { //
item.work_status && item.work_status.indexOf('提交作品') != -1 && item.work_status && item.work_status.indexOf('提交作品') != -1 &&
<WordsBtn style="blue" className="fl font-16 ml28" onClick={() => this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品</WordsBtn> <WordsBtn style="blue" className="fl font-16 ml28" onClick={() => this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品</WordsBtn>
} }
{ {
// //
item.work_status && item.work_status.indexOf('补交作品') != -1 && item.work_status && item.work_status.indexOf('补交作品') != -1 &&

@ -44,6 +44,7 @@ class ConnectProject extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.closeConnectionProject() this.closeConnectionProject()
this.props.connectSuccess()
this.props.showNotification('关联成功') this.props.showNotification('关联成功')
} }
}).catch((error)=>{ }).catch((error)=>{
@ -122,7 +123,24 @@ class ConnectProject extends Component{
footer={null} footer={null}
destroyOnClose={true} destroyOnClose={true}
> >
<div className="newupload_conbox clearfix"> <style>{`
.connectProject .ant-radio {
float: left;
line-height: 18px;
}
.connectProject .ant-radio-wrapper .name {
max-width: 480px;
display: inline-block;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.connectProject .ant-radio-wrapper>span:last-child {
line-height: 18px;
}
`}</style>
<div className="newupload_conbox clearfix connectProject">
{ {
(projects && !!projects.length || this.state.keyword) && (projects && !!projects.length || this.state.keyword) &&
<div> <div>
@ -131,7 +149,7 @@ class ConnectProject extends Component{
onSearch={this.onSearchValue} onSearch={this.onSearchValue}
></Search> ></Search>
<Radio.Group onChange={this.onChange} value={this.state.radioValue} className={"with100"}> <Radio.Group onChange={this.onChange} value={this.state.radioValue} className={"with100"}>
<div className="mt15" style={{"maxHeight":"161px","overflow-y":"auto"}}> <div className="mt15" style={{"maxHeight":"228px","overflow-y":"auto", "overflow-x": 'hidden'}}>
<InfiniteScroll <InfiniteScroll
threshold={20} threshold={20}
initialLoad={false} initialLoad={false}
@ -141,7 +159,9 @@ class ConnectProject extends Component{
useWindow={false} useWindow={false}
> >
{ projects.map(item => { { projects.map(item => {
return <p className="mb7" key={item.id}><Radio value={item.id}>{item.name}</Radio></p> return <p className="mb7" key={item.id}><Radio value={item.id}>
<span title={item.name.length > 12 ? item.name : ''} className="name">{item.name}</span>
</Radio></p>
})} })}
</InfiniteScroll> </InfiniteScroll>
</div> </div>

@ -279,6 +279,26 @@ class commonWork extends Component{
console.log(error) console.log(error)
}) })
} }
connectSuccess = () => {
let {page,search,order}=this.state;
this.getList(page,search,order);
}
cancelConnectionProject = (work) => {
let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId;
const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json`
axios.get(url).then((response)=> {
if (response.data.status == 0) {
let {page,search,order}=this.state;
this.getList(page,search,order);
this.props.showNotification('取消关联成功')
}
}).catch((error)=>{
console.log(error)
})
}
render(){ render(){
@ -341,7 +361,7 @@ class commonWork extends Component{
</div> </div>
</div> </div>
</div> */} </div> */}
<ConnectProject ref="connectProject" {...this.props}></ConnectProject> <ConnectProject ref="connectProject" {...this.props} connectSuccess={this.connectSuccess}></ConnectProject>
<Titlesearchsection <Titlesearchsection
@ -425,6 +445,7 @@ class commonWork extends Component{
<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 mainList={mainList} {...this.props} workType={workType} onItemClick={this.onItemClick}
openConnectionProject={this.openConnectionProject} openConnectionProject={this.openConnectionProject}
cancelConnectionProject={this.cancelConnectionProject}
></CommonWorkItem> ></CommonWorkItem>
</Checkbox.Group> </Checkbox.Group>
</Spin> </Spin>

Loading…
Cancel
Save