|
|
@ -109,19 +109,21 @@ class NewWorkForm extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
// 输入title
|
|
|
|
// 输入title
|
|
|
|
changeTitle=(e)=>{
|
|
|
|
changeTitle=(e)=>{
|
|
|
|
console.log(e.target.value.length);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
title_num: parseInt(e.target.value.length)
|
|
|
|
title_num: parseInt(e.target.value.length)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleSubmit = () => {
|
|
|
|
handleSubmit = () => {
|
|
|
|
const courseId = this.state.course_id || this.props.match.params.coursesId ;
|
|
|
|
const courseId = this.state.course_id || this.props.match.params.coursesId ;
|
|
|
|
|
|
|
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
if(err && err.personNum) delete err.personNum;
|
|
|
|
if(err && err.personNum) delete err.personNum;
|
|
|
|
console.log(values)
|
|
|
|
|
|
|
|
const mdContnet = this.contentMdRef.current.getValue().trim();
|
|
|
|
const mdContnet = this.contentMdRef.current.getValue().trim();
|
|
|
|
console.log(mdContnet)
|
|
|
|
|
|
|
|
values.description = mdContnet;
|
|
|
|
values.description = mdContnet;
|
|
|
|
// return;
|
|
|
|
// return;
|
|
|
|
|
|
|
|
|
|
|
@ -133,15 +135,19 @@ class NewWorkForm extends Component{
|
|
|
|
if (isGroup) {
|
|
|
|
if (isGroup) {
|
|
|
|
if (!min_num) {
|
|
|
|
if (!min_num) {
|
|
|
|
this.props.showNotification('最小人数不能为空');
|
|
|
|
this.props.showNotification('最小人数不能为空');
|
|
|
|
|
|
|
|
this.props.scrollToAnchor("numberofgroups");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (min_num < 1) {
|
|
|
|
} else if (min_num < 1) {
|
|
|
|
this.props.showNotification('最小人数不能小于1');
|
|
|
|
this.props.showNotification('最小人数不能小于1');
|
|
|
|
|
|
|
|
this.props.scrollToAnchor("numberofgroups");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (!max_num) {
|
|
|
|
} else if (!max_num) {
|
|
|
|
this.props.showNotification('最大人数不能为空');
|
|
|
|
this.props.showNotification('最大人数不能为空');
|
|
|
|
|
|
|
|
this.props.scrollToAnchor("numberofgroups");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (max_num < min_num) {
|
|
|
|
} else if (max_num < min_num) {
|
|
|
|
this.props.showNotification('最大人数不能小于最小人数');
|
|
|
|
this.props.showNotification('最大人数不能小于最小人数');
|
|
|
|
|
|
|
|
this.props.scrollToAnchor("numberofgroups");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -254,7 +260,7 @@ class NewWorkForm extends Component{
|
|
|
|
if (response.data) {
|
|
|
|
if (response.data) {
|
|
|
|
const { status } = response.data;
|
|
|
|
const { status } = response.data;
|
|
|
|
if (status == 0) {
|
|
|
|
if (status == 0) {
|
|
|
|
console.log('--- success')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState((state) => {
|
|
|
|
this.setState((state) => {
|
|
|
|
const index = state[stateName].indexOf(file);
|
|
|
|
const index = state[stateName].indexOf(file);
|
|
|
@ -272,16 +278,16 @@ class NewWorkForm extends Component{
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
max_num_change = (val) => {
|
|
|
|
max_num_change = (val) => {
|
|
|
|
if (val < 2) {
|
|
|
|
// if (val < 2) {
|
|
|
|
// this.setState({
|
|
|
|
// // this.setState({
|
|
|
|
// max_num: 2,
|
|
|
|
// // max_num: 2,
|
|
|
|
// })
|
|
|
|
// // })
|
|
|
|
return;
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
const { min_num } = this.state;
|
|
|
|
const { min_num } = this.state;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
max_num: val,
|
|
|
|
max_num: val,
|
|
|
|
min_num: val <= min_num ? val - 1 : min_num
|
|
|
|
// min_num: val <= min_num ? val - 1 : min_num
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
personNumValidator = (rule, value, callback) => {
|
|
|
|
personNumValidator = (rule, value, callback) => {
|
|
|
@ -337,7 +343,7 @@ class NewWorkForm extends Component{
|
|
|
|
onChange: this.handleContentUploadChange,
|
|
|
|
onChange: this.handleContentUploadChange,
|
|
|
|
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
|
|
|
|
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
console.log('beforeUpload', file.name);
|
|
|
|
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
|
if (!isLt150M) {
|
|
|
|
if (!isLt150M) {
|
|
|
|
this.props.showNotification('文件大小必须小于150MB!');
|
|
|
|
this.props.showNotification('文件大小必须小于150MB!');
|
|
|
@ -356,7 +362,7 @@ class NewWorkForm extends Component{
|
|
|
|
onChange: this.handleAnswerUploadChange,
|
|
|
|
onChange: this.handleAnswerUploadChange,
|
|
|
|
onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'),
|
|
|
|
onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'),
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
console.log('beforeUpload', file.name);
|
|
|
|
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
|
if (!isLt150M) {
|
|
|
|
if (!isLt150M) {
|
|
|
|
this.props.showNotification('文件大小必须小于150MB!');
|
|
|
|
this.props.showNotification('文件大小必须小于150MB!');
|
|
|
@ -461,7 +467,7 @@ class NewWorkForm extends Component{
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
(单个文件150M以内)
|
|
|
|
(单个文件150M以内)
|
|
|
|
</Upload>
|
|
|
|
</Upload>
|
|
|
|
|
|
|
|
<span id={"numberofgroups"}></span>
|
|
|
|
|
|
|
|
|
|
|
|
{ isGroup &&
|
|
|
|
{ isGroup &&
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
@ -477,7 +483,7 @@ class NewWorkForm extends Component{
|
|
|
|
// required: true, message: '请输入最小人数和最大人数'
|
|
|
|
// required: true, message: '请输入最小人数和最大人数'
|
|
|
|
// }],
|
|
|
|
// }],
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<div>
|
|
|
|
<div >
|
|
|
|
<p className="clearfix">
|
|
|
|
<p className="clearfix">
|
|
|
|
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
|
|
|
|
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
|
|
|
|
{/* max={has_commit ? init_min_num : null } */}
|
|
|
|
{/* max={has_commit ? init_min_num : null } */}
|
|
|
@ -508,6 +514,7 @@ class NewWorkForm extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<div className="edu-back-white">
|
|
|
|
<div className="edu-back-white">
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
label="参考答案"
|
|
|
|
label="参考答案"
|
|
|
|