新建重复提交拦截

dev_hss
杨树明 6 years ago
parent b0ccb3d32c
commit 47e4342516

@ -48,7 +48,8 @@ class CoursesNew extends Component {
addonAfteronelenone:0, addonAfteronelenone:0,
addonAfteronelentwo:0, addonAfteronelentwo:0,
bordebool:false, bordebool:false,
smallspinning:false smallspinning:false,
bottonloading:false
} }
} }
componentDidMount() { componentDidMount() {
@ -217,7 +218,9 @@ class CoursesNew extends Component {
if (!err) { if (!err) {
this.setState({
bottonloading:true
})
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
@ -240,7 +243,7 @@ class CoursesNew extends Component {
if (response.data.status === 0) { if (response.data.status === 0) {
// this.goback() // this.goback()
window.location.href=first_category_url; window.location.href=first_category_url;
if(this.state.boolxinjian===true) { if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
try { try {
@ -257,11 +260,19 @@ class CoursesNew extends Component {
} }
} }
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }else{
this.setState({
bottonloading:false
})
}
}); });
} else { } else {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
@ -283,6 +294,9 @@ class CoursesNew extends Component {
// debugger // debugger
//新建 //新建
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
this.setState({
bottonloading:true
})
let url = "/courses.json"; let url = "/courses.json";
axios.post(url, { axios.post(url, {
@ -300,6 +314,7 @@ class CoursesNew extends Component {
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
// this.goback // this.goback
window.location.href=response.data.first_category_url; window.location.href=response.data.first_category_url;
if(this.state.boolxinjian===true){ if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -318,11 +333,19 @@ class CoursesNew extends Component {
} }
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }else{
this.setState({
bottonloading:false
})
}
}); });
} }
@ -934,7 +957,7 @@ class CoursesNew extends Component {
<div className={"FAFAFA"}> <div className={"FAFAFA"}>
<Form.Item > <Form.Item >
<div className="clearfix mt40 mb30"> <div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20"> <Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交 提交
</Button> </Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/} {/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}

@ -55,7 +55,8 @@ class Goldsubject extends Component {
addonAfteronelentwo:"", addonAfteronelentwo:"",
Whethertocreateanewclassroom:true, Whethertocreateanewclassroom:true,
bordebool:false, bordebool:false,
smallspinning:false smallspinning:false,
bottonloading:false
} }
} }
// disabledEndDate= endValue => { // disabledEndDate= endValue => {
@ -351,7 +352,9 @@ class Goldsubject extends Component {
}catch (e) { }catch (e) {
} }
this.setState({
bottonloading:true
})
let url = "/courses/" + coursesId + ".json"; let url = "/courses/" + coursesId + ".json";
axios.put(url, axios.put(url,
datasysl datasysl
@ -372,12 +375,21 @@ class Goldsubject extends Component {
return return
} }
}catch (e) { }catch (e) {
this.setState({
bottonloading:false
})
} }
}else{
this.setState({
bottonloading:false
})
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
@ -424,20 +436,15 @@ class Goldsubject extends Component {
course_module_types: values.checkboxgroup, course_module_types: values.checkboxgroup,
school:values.school school:values.school
}; };
try {
// console.log("提交的ysldatas数据");
// console.log(ysldatas);
// console.log(JSON.stringify(ysldatas));
// console.log(moment(values.starttime).format("YYYY-MM-DD"));
// console.log(moment(values.endtime).format("YYYY-MM-DD"));
}catch (e) {
}
this.setState({
bottonloading:true
})
axios.post(url, axios.post(url,
ysldatas ysldatas
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
// this.goback // this.goback
window.location.href=response.data.first_category_url; window.location.href=response.data.first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -451,11 +458,16 @@ class Goldsubject extends Component {
return return
} }
}catch (e) { }catch (e) {
this.setState({
bottonloading:false
})
} }
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
}); });
@ -1074,9 +1086,11 @@ class Goldsubject extends Component {
<div className={"FAFAFA"}> <div className={"FAFAFA"}>
<Form.Item > <Form.Item >
<div className="clearfix mt40 mb30"> <div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
<Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交 提交
</Button> </Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/} {/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}
<a className="defalutCancelbtn fl" onClick={this.goback}>取消</a> <a className="defalutCancelbtn fl" onClick={this.goback}>取消</a>
</div> </div>

@ -86,7 +86,8 @@ class PathNew extends Component{
pathName:"", pathName:"",
description:"", description:"",
point:"", point:"",
flag_name:true flag_name:true,
bottonloading:false
} }
} }
@ -124,6 +125,9 @@ class PathNew extends Component{
return; return;
} }
if (this.isEditPage == true) { if (this.isEditPage == true) {
this.setState({
bottonloading:true
})
let pathId = this.props.match.params.pathId; let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json` const editUrl = `/paths/${pathId}.json`
@ -135,11 +139,21 @@ class PathNew extends Component{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
this.setState({
bottonloading:false
})
}) })
} else { } else {
this.setState({
bottonloading:true
})
let url="/paths.json" let url="/paths.json"
axios.post(url,{ axios.post(url,{
name:pathName, name:pathName,
@ -149,9 +163,16 @@ class PathNew extends Component{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
this.setState({
bottonloading:false
})
}) })
} }
@ -267,7 +288,7 @@ class PathNew extends Component{
</div> </div>
<div className="clearfix mb30 mt30"> <div className="clearfix mb30 mt30">
<a href="javascript:void(0)" className="defalutSubmitbtn fl mr20" onClick={this.submitNewPath}>提交</a> <Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submitNewPath}>提交</Button>
{this.isEditPage ? {this.isEditPage ?
<Link to={`/paths/${this.props.match.params.pathId}`} <Link to={`/paths/${this.props.match.params.pathId}`}
className="defalutCancelbtn fl">取消</Link> className="defalutCancelbtn fl">取消</Link>

@ -233,7 +233,8 @@ class Newshixuns extends Component {
systemenvironmenttype:false, systemenvironmenttype:false,
testcoderunmodetype:false, testcoderunmodetype:false,
attachmentidstype:false, attachmentidstype:false,
datalisttype:false datalisttype:false,
bottonloading:false
} }
} }
@ -494,6 +495,9 @@ class Newshixuns extends Component {
} else { } else {
newmulti_webssh = "" newmulti_webssh = ""
} }
this.setState({
bottonloading:true
})
axios.post(Url, { axios.post(Url, {
name: name, name: name,
can_copy: can_copy, can_copy: can_copy,
@ -513,9 +517,16 @@ class Newshixuns extends Component {
if (response.status === 200) { if (response.status === 200) {
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
@ -1321,7 +1332,9 @@ class Newshixuns extends Component {
<div className="clearfix mt30"> <div className="clearfix mt30">
<a className="defalutSubmitbtn fl mr20" onClick={this.submit_new_shixun}>提交</a> <Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submit_new_shixun}>
提交
</Button>
<a href="/shixuns" className="defalutCancelbtn fl">取消</a> <a href="/shixuns" className="defalutCancelbtn fl">取消</a>
</div> </div>

@ -385,3 +385,9 @@ a.white-btn.use_scope-btn:hover{
.ml82{ .ml82{
margin-left: 82px; margin-left: 82px;
} }
.ant-btn-primary.active, .ant-btn-primary:active {
color: #fff;
background-color: #096dd9;
border-color: #096dd9;
}
Loading…
Cancel
Save