|
|
|
@ -49,57 +49,56 @@ class GraduationTasksnew extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Commoninterface =(fileList)=>{
|
|
|
|
|
|
|
|
|
|
let listid = []
|
|
|
|
|
|
|
|
|
|
for (var list of fileList) {
|
|
|
|
|
listid.push(list.response.id)
|
|
|
|
|
}
|
|
|
|
|
// if (GraduationTasksnewtype === true) {
|
|
|
|
|
this.props.form.validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
if (values.tasktype === undefined) {
|
|
|
|
|
this.scrollToAnchors("tasktypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.props.form.validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
if (values.tasktype === undefined) {
|
|
|
|
|
this.ifHasAnchorJustScorll("tasktypes");
|
|
|
|
|
// this.scrollToAnchors("tasktypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (values.name === undefined) {
|
|
|
|
|
this.scrollToAnchors("nametypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (values.name === undefined) {
|
|
|
|
|
this.scrollToAnchors("nametypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (values.description === undefined) {
|
|
|
|
|
this.scrollToAnchors("descriptiontypes");
|
|
|
|
|
return
|
|
|
|
|
} else if (values.description.length > 5000) {
|
|
|
|
|
this.scrollToAnchors("descriptiontypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// console.log('Received values of form: ', values);
|
|
|
|
|
// console.log(fileList);
|
|
|
|
|
const course_id = this.props.match.params.coursesId;
|
|
|
|
|
|
|
|
|
|
let url = "/courses/" + course_id + "/graduation_tasks.json"
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
task_type: parseInt(values.tasktype),
|
|
|
|
|
name: values.name,
|
|
|
|
|
description: values.description,
|
|
|
|
|
attachment_ids: listid,
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
// if (response.status === 200) {
|
|
|
|
|
// GraduationTasksnewtype = false;
|
|
|
|
|
// this.goback();
|
|
|
|
|
if(response!==undefined){
|
|
|
|
|
this.goback()
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
if (values.description === undefined) {
|
|
|
|
|
this.scrollToAnchors("descriptiontypes");
|
|
|
|
|
return
|
|
|
|
|
} else if (values.description.length > 5000) {
|
|
|
|
|
this.scrollToAnchors("descriptiontypes");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// console.log('Received values of form: ', values);
|
|
|
|
|
// console.log(fileList);
|
|
|
|
|
const course_id = this.props.match.params.coursesId;
|
|
|
|
|
|
|
|
|
|
let url = "/courses/" + course_id + "/graduation_tasks.json"
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
task_type: parseInt(values.tasktype),
|
|
|
|
|
name: values.name,
|
|
|
|
|
description: values.description,
|
|
|
|
|
attachment_ids: listid,
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
// if (response.status === 200) {
|
|
|
|
|
// GraduationTasksnewtype = false;
|
|
|
|
|
// this.goback();
|
|
|
|
|
if(response!==undefined){
|
|
|
|
|
this.goback()
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -200,10 +199,10 @@ class GraduationTasksnew extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//滚动
|
|
|
|
|
ifHasAnchorJustScorll() {
|
|
|
|
|
ifHasAnchorJustScorll(anchor) {
|
|
|
|
|
// let anchor = this.getURLStuff("anchor");
|
|
|
|
|
|
|
|
|
|
let anchor = this.state.anchor;
|
|
|
|
|
// let anchor = this.state.anchor;
|
|
|
|
|
// console.log("anchor ", anchor);
|
|
|
|
|
// 对应id的话, 滚动到相应位置
|
|
|
|
|
if (!!anchor) {
|
|
|
|
@ -358,7 +357,7 @@ class GraduationTasksnew extends Component {
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<Form.Item label="类型" className={"tasktype"}>
|
|
|
|
|
<Form.Item label="类型" id="tasktype" className={"tasktype"}>
|
|
|
|
|
{getFieldDecorator('tasktype', {
|
|
|
|
|
rules: [{required: true, message: "请选择任务类型"}],
|
|
|
|
|
})(<Select className={"greyInput mb20"}
|
|
|
|
|