Merge branch 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into topic_bank

topic_bank
杨树林 6 years ago
commit b9ae3f3bb1

@ -110,6 +110,19 @@ class NewWorkForm extends Component{
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
// 已有提交作品,人数范围只能扩大
const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state;
if (!min_num) {
this.props.showNotification('最小人数不能为空');
return;
} else if (min_num < 1) {
this.props.showNotification('最小人数不能小于1');
return;
} else if (!max_num) {
this.props.showNotification('最大人数不能为空');
return;
} else if (max_num < min_num) {
this.props.showNotification('最大人数不能小于最小人数');
return;
}
if (has_commit) {
if (max_num < init_max_num || min_num > init_min_num) {
this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`)
@ -237,9 +250,9 @@ class NewWorkForm extends Component{
}
max_num_change = (val) => {
if (val < 2) {
this.setState({
max_num: 2,
})
// this.setState({
// max_num: 2,
// })
return;
}
const { min_num } = this.state;
@ -248,12 +261,31 @@ class NewWorkForm extends Component{
min_num: val <= min_num ? val - 1 : min_num
})
}
personNumValidator = (rule, value, callback) => {
const { min_num, max_num } = this.state;
const form = this.props.form;
if (!min_num) {
callback('最小人数不能为空');
} else if (min_num < 1) {
callback('最小人数不能小于1');
} else if (!max_num) {
callback('最大人数不能为空');
} else if (max_num < min_num) {
callback('最大人数不能小于最小人数');
} else {
callback();
}
}
min_num_change = (val) => {
this.setState({ min_num: val })
}
base_on_project_change = () => {
this.setState({ base_on_project: !this.state.base_on_project })
}
componentDidMount() {
window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required')
}
render(){
let {typeId,coursesId,pageType}=this.props.match.params;
const { getFieldDecorator } = this.props.form;
@ -411,11 +443,13 @@ class NewWorkForm extends Component{
{ isGroup &&
<Form.Item
label="分组设置"
className="AboutInputForm"
className="AboutInputForm groupSetting"
>
{getFieldDecorator('personNum', {
rules: [{
required: false
// required: true,
// message: '人数不能为空'
// validator: this.personNumValidator
// required: true, message: '请输入最小人数和最大人数'
}],
})(
@ -447,6 +481,7 @@ class NewWorkForm extends Component{
</p>
</div>
)}
</Form.Item>
}
<div className="edu-back-white">

Loading…
Cancel
Save