dev_forum
杨树林 5 years ago
parent 14197b6f28
commit 4cc190dc39

@ -33,7 +33,8 @@ class GraduationTasksSubmitedit extends Component{
Loadtype:false,
description:undefined,
attachments:undefined,
spinnings:false
spinnings:false,
shixunsreplace:false,
}
}
@ -84,99 +85,8 @@ class GraduationTasksSubmitedit extends Component{
window.location.href="/courses/"+coursesId+"/graduation_tasks/"+workId+"/appraise";
}
handleSubmit=(e) => {
let {fileList,selectmemberslist,workslist}=this.state;
let userids=[];
for(var list of selectmemberslist){
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
}
let listid=[];
for(var list of fileList){
listid.push(list.response.id)
}
e.preventDefault();
if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
// console.log(fileList);
if(values.description===undefined||values.description===""){
return
}
if(workslist.task_type===2){
if(userids.length<2){
this.setState({
minvalue:2,
setvalue:"小于",
minmaxtype:true
})
return
}else if(userids.length>5){
this.setState({
minvalue:5,
setvalue:"大于",
minmaxtype:true
})
return
}
}
this.setState({
spinnings:true
})
let workId=this.props.match.params.work_Id;
let url="/graduation_works/"+workId+".json";
axios.put(url, {
description:values.description,
attachment_ids:listid,
user_ids:userids
}
).then((response) => {
this.setState({
spinnings:false
})
if(response.status===200) {
GraduationTasksnewtype=false;
if(response.data.status===0){
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.setedit,
// Loadtype:true
// })
this.setedit()
}else{
GraduationTasksnewtype=true;
}
}
}).catch((error) => {
console.log(error)
})
}
});
}
// setTimeout(function () {
// GraduationTasksnewtype=true
// },10000)
}
handleSelectChange = (value) => {
console.log(value);
this.props.form.setFieldsValue({
@ -414,10 +324,126 @@ class GraduationTasksSubmitedit extends Component{
window.history.go(-1)
}
handleSubmit=(e) => {
let {fileList,selectmemberslist,workslist}=this.state;
if(fileList.length===0){
this.setState({
shixunsreplace:true,
})
return
}
this.Commoninterface(fileList,selectmemberslist,workslist);
// setTimeout(function () {
// GraduationTasksnewtype=true
// },10000)
}
Commoninterface =(fileList,selectmemberslist,workslist)=>{
let userids=[];
for(var list of selectmemberslist){
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
}
let listid=[];
for(var list of fileList){
listid.push(list.response.id)
}
this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
// console.log(fileList);
if(values.description===undefined||values.description===""){
return
}
if(workslist.task_type===2){
if(userids.length<2){
this.setState({
minvalue:2,
setvalue:"小于",
minmaxtype:true
})
return
}else if(userids.length>5){
this.setState({
minvalue:5,
setvalue:"大于",
minmaxtype:true
})
return
}
}
this.setState({
spinnings:true
})
let workId=this.props.match.params.work_Id;
let url="/graduation_works/"+workId+".json";
axios.put(url, {
description:values.description,
attachment_ids:listid,
user_ids:userids
}
).then((response) => {
this.setState({
spinnings:false
})
if(response!== undefined){
this.setedit()
}
// if(response.status===200) {
// GraduationTasksnewtype=false;
// if(response.data.status===0){
// // this.setState({
// // Modalstype:true,
// // Modalstopval:response.data.message,
// // ModalSave:this.setedit,
// // Loadtype:true
// // })
// }else{
// GraduationTasksnewtype=true;
// }
// }
}).catch((error) => {
console.log(error)
})
}
});
}
hidestartshixunsreplace = ()=>{
let {fileList,selectmemberslist,workslist}=this.state;
this.Commoninterface(fileList,selectmemberslist,workslist);
}
hidestartshixunsreplacetwo= ()=>{
this.setState({
shixunsreplace:false,
})
}
render(){
const { getFieldDecorator } = this.props.form;
let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype,description,attachments,
Modalstype,Modalstopval,ModalCancel,ModalSave,memberslist,task_status,selectmemberslist} =this.state;
Modalstype,Modalstopval,ModalCancel,ModalSave,memberslist,task_status,selectmemberslist,shixunsreplace} =this.state;
let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id;
@ -460,6 +486,24 @@ class GraduationTasksSubmitedit extends Component{
modalSave={ModalSave}
loadtype={Loadtype}
/>
<Modal
keyboard={false}
title="提示"
visible={shixunsreplace}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 ">还未上传附件</p>
<p className="task-popup-text-center font-16 pb20">是否确认提交作品?</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr "
onClick={() => this.hidestartshixunsreplace()}>确认</a>
<a className="task-btn fr mr50"
onClick={() => this.hidestartshixunsreplacetwo()}>取消</a>
</div>
</Modal>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
@ -482,7 +526,9 @@ class GraduationTasksSubmitedit extends Component{
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
{description&&description?<Form labelCol={{ span: 5 }} wrapperCol={{ span: 12 }} onSubmit={GraduationTasksnewtype===true?this.handleSubmit:""} >
{description&&description?
<div>
{/*<Form labelCol={{ span: 5 }} wrapperCol={{ span: 12 }} onSubmit={this.handleSubmit} >*/}
<div className="stud-class-set pd20 coursenavbox edu-back-white">
<style>{`
.uploadBtn.ant-btn {
@ -708,11 +754,13 @@ class GraduationTasksSubmitedit extends Component{
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.gocannel} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
</Form>:""}
{/*</Form>*/}
</div>
:""}
</div>
</div>

@ -355,7 +355,7 @@ class GraduationTasksSubmitnew extends Component{
for(var list of fileList){
listid.push(list.response.id)
}
if( GraduationTasksnewtype===true){
// if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => {
if (!err) {
console.log(values.description);
@ -401,27 +401,30 @@ class GraduationTasksSubmitnew extends Component{
this.setState({
spinnings:false
})
if(response.status===200) {
GraduationTasksnewtype=false;
if(response.data.status===0){
if(response!==undefined){
this.setedit(response.data.work_id)
}
// if(response.status===200) {
// GraduationTasksnewtype=false;
// if(response.data.status===0){
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:()=>this.setedit(response.data.work_id),
// Loadtype:true
// })
this.setedit(response.data.work_id)
}else{
GraduationTasksnewtype=true;
}
}
// }else{
// GraduationTasksnewtype=true;
// }
// }
}).catch((error) => {
console.log(error)
})
}
});
}
// }
}
@ -737,7 +740,7 @@ render(){
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.gocannel} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>

@ -186,7 +186,7 @@ class GraduationTasksedit extends Component{
}
// console.log(listid)
if(GraduationTasksedittype===true){
// if(GraduationTasksedittype===true){
this.props.form.validateFields((err, values) => {
if (!err) {
@ -224,7 +224,7 @@ class GraduationTasksedit extends Component{
).then((response) => {
if(response.status===200) {
// console.log(response)
GraduationTasksedittype=false;
// GraduationTasksedittype=false;
// window.location.href="/courses/"+course_id+"/graduation/"+graduationId+"/graduation_tasks/"+category_id+"/questions";
// this.goback()
this.props.history.push("/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting");
@ -235,7 +235,7 @@ class GraduationTasksedit extends Component{
}
});
}
// }
}
handleSubmit=(e)=>{

@ -75,8 +75,8 @@ class GraduationTasksnew extends Component {
this.scrollToAnchors("descriptiontypes");
return
}
console.log('Received values of form: ', values);
console.log(fileList);
// 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"
@ -413,7 +413,7 @@ class GraduationTasksnew extends Component {
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={GraduationTasksnewtype === true ? ()=>this.handleSubmit() : ""} className="defalutSubmitbtn fl mr20">提交</Button>
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>

Loading…
Cancel
Save