Merge remote-tracking branch 'origin/topic_bank' into topic_bank

# Conflicts:
#	public/react/src/modules/user/usersInfo/banks/BanksIndex.js
dev_aliyun_beta
杨树明 6 years ago
commit 0e08df1dd4

@ -191,6 +191,7 @@ class NewWorkForm extends Component{
} }
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
this.props.confirm({ this.props.confirm({
content: '是否确认删除?', content: '是否确认删除?',
@ -201,8 +202,7 @@ class NewWorkForm extends Component{
console.log('Cancel'); console.log('Cancel');
}, },
}); });
}
return false; return false;
} }
deleteAttachment = (file, stateName) => { deleteAttachment = (file, stateName) => {

@ -92,10 +92,21 @@ class BanksIndex extends Component{
} }
}></Route> }></Route>
<Route path='/banks/homework/:workId/edit'
<Route path='/banks/normal/:workId/edit'
render={
(props) => {
return (<HomeworkBanksEdit {...this.props} {...props} {...this.state} {...common}
isGroup={false}
/>)
}
}></Route>
<Route path='/banks/group/:workId/edit'
render={ render={
(props) => { (props) => {
return (<HomeworkBanksEdit {...this.props} {...props} {...this.state} {...common}/>) return (<HomeworkBanksEdit {...this.props} {...props} {...this.state} {...common}
isGroup={true}
/>)
} }
}></Route> }></Route>

@ -9,7 +9,7 @@ class HomeworkBanksEdit extends Component {
super(props); super(props);
this.state = { this.state = {
isPublic: undefined, isPublic: undefined,
isGroup: false // isGroup: false
} }
} }
componentDidMount = () =>{ componentDidMount = () =>{
@ -26,14 +26,14 @@ class HomeworkBanksEdit extends Component {
title:'编辑', title:'编辑',
is_public:result && result.data && result.data.is_public, is_public:result && result.data && result.data.is_public,
crumbArray:[ crumbArray:[
{to:`/banks/homework/${workId}/edit`,content:'详情'}, {to:`/banks/${this.getModuleName()}/${workId}/edit`,content:'详情'},
{content:'编辑'} {content:'编辑'}
] ]
} }
this.props.initPublic(crumbData); this.props.initPublic(crumbData);
result.data.isEdit = true; result.data.isEdit = true;
result.data.ref_attachments = result.data.reference_attachments 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); this.newWorkFormRef.initValue(result.data);
} }
}).catch((error)=>{ }).catch((error)=>{
@ -60,14 +60,17 @@ class HomeworkBanksEdit extends Component {
console.log(error); console.log(error);
}); });
} }
getModuleName = () => {
return this.props.isGroup ? 'group' : 'normal'
}
toWorkDetail = () => { 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 = () => { onCancel = () => {
this.toWorkDetail() this.toWorkDetail()
} }
isGroup = () => { isGroup = () => {
return this.state.isGroup; return this.props.isGroup;
} }
render(){ render(){
let { bankId } = this.props.match.params let { bankId } = this.props.match.params

Loading…
Cancel
Save