dev_aliyun_beta
杨树明 6 years ago
parent 837aadbe96
commit 72586f082f

@ -501,7 +501,7 @@ class InfosTopics extends Component{
<a className="btn colorblue mr25 font-16 fr" <a className="btn colorblue mr25 font-16 fr"
href={category==="normal"?``: href={category==="normal"?``:
category==="group"?``: category==="group"?``:
category==="poll"?`/courses/poll_topics/${item.id}/edit`: category==="poll"?`/banks/poll/${item.id}/edit`:
category==="exercise"?``: category==="exercise"?``:
category==="gtask"?``: category==="gtask"?``:
category==="gtopic"?`/banks/gtopic/${item.id}/edit`:"" category==="gtopic"?`/banks/gtopic/${item.id}/edit`:""

@ -35,6 +35,11 @@ const HomeworkBanksEdit = Loadable({
loading: Loading, loading: Loading,
}) })
const GtaskBanksEdit = Loadable({
loader: () => import('./GtaskBanksEditEdit'),
loading: Loading,
})
class BanksIndex extends Component{ class BanksIndex extends Component{
constructor(props){ constructor(props){
super(props); super(props);
@ -79,6 +84,14 @@ class BanksIndex extends Component{
</p> </p>
<Switch {...this.props}> <Switch {...this.props}>
{/*毕设任务编辑*/}
<Route path='/banks/gtask/:workId/edit'
render={
(props) => {
return (<GtaskBanksEdit {...this.props} {...props} {...this.state} {...common}/>)
}
}></Route>
<Route path='/banks/homework/:workId/edit' <Route path='/banks/homework/:workId/edit'
render={ render={
(props) => { (props) => {

@ -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(
<div className="courseForm">
<style>
{`
.courseForm .ant-col-sm-24{
text-align:left;
}
`}
</style>
<NewWorkForm
{...this.props}
{...this.state}
{...common}
wrappedComponentRef={(ref) => this.newWorkFormRef = ref}
topicId={bankId}
></NewWorkForm>
</div>
)
}
}
export default GtaskBanksEditEdit;
Loading…
Cancel
Save