diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 5b6d94a69..179e3df52 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -191,18 +191,18 @@ class NewWorkForm extends Component{ } onAttachmentRemove = (file, stateName) => { - this.props.confirm({ - content: '是否确认删除?', - - onOk: () => { - this.deleteAttachment(file, stateName) - }, - onCancel() { - console.log('Cancel'); - }, - }); - - + if(file.response!=undefined){ + this.props.confirm({ + content: '是否确认删除?', + + onOk: () => { + this.deleteAttachment(file, stateName) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } return false; } deleteAttachment = (file, stateName) => { diff --git a/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js b/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js index c09e8cf66..e21021539 100644 --- a/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js +++ b/public/react/src/modules/courses/completetaskdetails/Completetaskpage.js @@ -91,7 +91,6 @@ class Completetaskpage extends Component { render() { let{datas}=this.state; - const isAdmin = this.props.isAdmin(); // console.log(119) diff --git a/public/react/src/modules/courses/comtopicdetails/CompletetopicdePage.js b/public/react/src/modules/courses/comtopicdetails/CompletetopicdePage.js index d952b82aa..2dc873167 100644 --- a/public/react/src/modules/courses/comtopicdetails/CompletetopicdePage.js +++ b/public/react/src/modules/courses/comtopicdetails/CompletetopicdePage.js @@ -89,8 +89,7 @@ class CompletetopicdePage extends Component { render() { let{datas}=this.state; - const isAdmin = this.props.isAdmin(); - // console.log(119) + // console.log(119) return ( diff --git a/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js b/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js index 60255ad7b..6dba2a1e1 100644 --- a/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js +++ b/public/react/src/modules/courses/groupjobbank/GroupjobbankPage.js @@ -126,7 +126,6 @@ class GroupjobbankPage extends Component { render() { let {tab,datas} = this.state; - const isAdmin = this.props.isAdmin(); // console.log(119) diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index 0f5d56677..f84c0df8c 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -2451,7 +2451,6 @@ class PollNewQuestbank extends Component { // console.log(polls_status); // console.log([[`${maps[polls_status && polls_status]}`]] + ""); - const IsAdmin = this.props.isAdmin(); // const {getFieldDecorator} = this.props.form; const formItemLayout = { labelCol: { diff --git a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js index 04fde589d..0a29b0864 100644 --- a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js +++ b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js @@ -122,7 +122,7 @@ class Generaljobbankdetails extends Component { render() { let {tab,datas} = this.state; - const isAdmin = this.props.isAdmin(); + // console.log(119) diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js index ba445e386..9b0e2948e 100644 --- a/public/react/src/modules/user/usersInfo/InfosTopics.js +++ b/public/react/src/modules/user/usersInfo/InfosTopics.js @@ -501,7 +501,7 @@ class InfosTopics extends Component{ import('./GtaskBanksEditEdit'), + loading: Loading, +}) + class BanksIndex extends Component{ constructor(props){ super(props); @@ -105,10 +110,29 @@ class BanksIndex extends Component{

- { + return () + } + }> + + + { + return () + } + }> + { - return () + return () } }> diff --git a/public/react/src/modules/user/usersInfo/banks/GtaskBanksEditEdit.js b/public/react/src/modules/user/usersInfo/banks/GtaskBanksEditEdit.js new file mode 100644 index 000000000..3035e9867 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/GtaskBanksEditEdit.js @@ -0,0 +1,100 @@ +import React, { Component } from 'react'; +import axios from 'axios' + + +import NewWorkForm from '../../../courses/busyWork/NewWorkForm'; + +class GtaskBanksEditEdit extends Component { + constructor(props){ + super(props); + this.state = { + isPublic: undefined, + isGroup: false + } + } + componentDidMount = () =>{ + let workId = this.props.match.params.workId; + this.initData(workId); + } + + initData = (workId) =>{ + + let url = `/task_banks/${workId}.json`; + axios.get(url).then((result)=>{ + if(result){ + const crumbData={ + title:'编辑', + is_public:result && result.data && result.data.is_public, + crumbArray:[ + {to:`/banks/task/${workId}/edit`,content:'详情'}, + {content:'编辑'} + ] + } + this.props.initPublic(crumbData); + result.data.isEdit = true; + result.data.ref_attachments = result.data.reference_attachments + this.setState({ isGroup: result.data.min_num || result.data.max_num }) + this.newWorkFormRef.initValue(result.data); + } + }).catch((error)=>{ + console.log(error) + }) + } + + + doNew = () => { + } + doEdit = (params) => { + const workId = this.props.match.params.workId + const newUrl = `/homework_banks/${workId}.json` + + // const isGroup = this.props.isGroup() + axios.put(newUrl, params) + .then((response) => { + if (response.data.status == 0) { + this.props.showNotification('保存成功') + this.toWorkDetail() + } + }) + .catch(function (error) { + console.log(error); + }); + } + toWorkDetail = () => { + this.props.history.push(`/banks/task/${this.props.match.params.workId}`) + } + onCancel = () => { + this.toWorkDetail() + } + isGroup = () => { + return this.state.isGroup; + } + render(){ + let { bankId } = this.props.match.params + const common = { + onCancel:this.onCancel, + isGroup: this.isGroup, + doNew: this.doNew, + doEdit: this.doEdit, + } + return( +
+ + this.newWorkFormRef = ref} + topicId={bankId} + > +
+ ) + } +} +export default GtaskBanksEditEdit; \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js b/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js index c94e8d740..42a402266 100644 --- a/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js +++ b/public/react/src/modules/user/usersInfo/banks/HomeworkBanksEdit.js @@ -9,7 +9,7 @@ class HomeworkBanksEdit extends Component { super(props); this.state = { isPublic: undefined, - isGroup: false + // isGroup: false } } componentDidMount = () =>{ @@ -26,14 +26,14 @@ class HomeworkBanksEdit extends Component { title:'编辑', is_public:result && result.data && result.data.is_public, crumbArray:[ - {to:`/banks/homework/${workId}/edit`,content:'详情'}, + {to:`/banks/${this.getModuleName()}/${workId}/edit`,content:'详情'}, {content:'编辑'} ] } this.props.initPublic(crumbData); result.data.isEdit = true; result.data.ref_attachments = result.data.reference_attachments - this.setState({ isGroup: result.data.min_num || result.data.max_num }) + // this.setState({ isGroup: result.data.min_num || result.data.max_num }) this.newWorkFormRef.initValue(result.data); } }).catch((error)=>{ @@ -60,14 +60,17 @@ class HomeworkBanksEdit extends Component { console.log(error); }); } + getModuleName = () => { + return this.props.isGroup ? 'group' : 'normal' + } toWorkDetail = () => { - this.props.history.push(`/banks/homework/${this.props.match.params.workId}`) + this.props.history.push(`/banks/${this.getModuleName()}/${this.props.match.params.workId}`) } onCancel = () => { this.toWorkDetail() } isGroup = () => { - return this.state.isGroup; + return this.props.isGroup; } render(){ let { bankId } = this.props.match.params