Merge branches 'dev_Ysl' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl

# Conflicts:
#	public/react/src/modules/user/usersInfo/banks/BanksIndex.js
dev_aliyun_beta
杨树林 6 years ago
commit 201b820b87

@ -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) => {

@ -91,7 +91,6 @@ class Completetaskpage extends Component {
render() {
let{datas}=this.state;
const isAdmin = this.props.isAdmin();
// console.log(119)

@ -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 (

@ -126,7 +126,6 @@ class GroupjobbankPage extends Component {
render() {
let {tab,datas} = this.state;
const isAdmin = this.props.isAdmin();
// console.log(119)

@ -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: {

@ -122,7 +122,7 @@ class Generaljobbankdetails extends Component {
render() {
let {tab,datas} = this.state;
const isAdmin = this.props.isAdmin();
// console.log(119)

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

@ -61,6 +61,11 @@ const PollNewQuestbank =Loadable({
loading: Loading,
});
const GtaskBanksEdit = Loadable({
loader: () => import('./GtaskBanksEditEdit'),
loading: Loading,
})
class BanksIndex extends Component{
constructor(props){
super(props);
@ -105,10 +110,29 @@ class BanksIndex extends Component{
</p>
<Switch {...this.props}>
<Route path='/banks/homework/:workId/edit'
{/*毕设任务编辑*/}
<Route path='/banks/gtask/:workId/edit'
render={
(props) => {
return (<GtaskBanksEdit {...this.props} {...props} {...this.state} {...common}/>)
}
}></Route>
<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={
(props) => {
return (<HomeworkBanksEdit {...this.props} {...props} {...this.state} {...common}/>)
return (<HomeworkBanksEdit {...this.props} {...props} {...this.state} {...common}
isGroup={true}
/>)
}
}></Route>

@ -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;

@ -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

Loading…
Cancel
Save