diff --git a/public/react/src/modules/courses/busyWork/CommonWorkItem.js b/public/react/src/modules/courses/busyWork/CommonWorkItem.js index 7f5bea2da..2ac4761e1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkItem.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkItem.js @@ -97,6 +97,13 @@ class CommonWorkItem extends Component{ setupdate = () => { } + toCreateProject = () => { + if (window.location.port == 3007) { + window.location.href = '/testbdweb.educoder.net/projects/new' + } else { + window.location.href = '/projects/new' + } + } render(){ let { mainList,workType }=this.props; const { aModalVisible, fileList, revise_reason } = this.state @@ -195,12 +202,22 @@ class CommonWorkItem extends Component{
  • { // item.work_status && item.work_status.indexOf('关联项目') != -1 && - this.props.openConnectionProject(item)}>关联项目 + + this.props.toCreateProject(item)}>创建项目 + this.props.openConnectionProject(item)}>关联项目 + + } + + { // + item.work_status && item.work_status.indexOf('取消关联') != -1 && + this.props.cancelConnectionProject(item)}>取消关联 } { // item.work_status && item.work_status.indexOf('提交作品') != -1 && this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品 } + + { // item.work_status && item.work_status.indexOf('补交作品') != -1 && diff --git a/public/react/src/modules/courses/busyWork/ConnectProject.js b/public/react/src/modules/courses/busyWork/ConnectProject.js index 4e359651b..73a4da8f8 100644 --- a/public/react/src/modules/courses/busyWork/ConnectProject.js +++ b/public/react/src/modules/courses/busyWork/ConnectProject.js @@ -44,6 +44,7 @@ class ConnectProject extends Component{ }).then((result)=>{ if(result.data.status==0){ this.closeConnectionProject() + this.props.connectSuccess() this.props.showNotification('关联成功') } }).catch((error)=>{ @@ -122,7 +123,24 @@ class ConnectProject extends Component{ footer={null} destroyOnClose={true} > -
    + +
    { (projects && !!projects.length || this.state.keyword) &&
    @@ -131,7 +149,7 @@ class ConnectProject extends Component{ onSearch={this.onSearchValue} > -
    +
    { projects.map(item => { - return

    {item.name}

    + return

    + 12 ? item.name : ''} className="name">{item.name} +

    })}
    diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index 18c668efe..28199c4c0 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -279,6 +279,26 @@ class commonWork extends Component{ 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(){ @@ -341,7 +361,7 @@ class commonWork extends Component{
    */} - +