新建重复提交拦截

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

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

@ -55,7 +55,8 @@ class Goldsubject extends Component {
addonAfteronelentwo:"",
Whethertocreateanewclassroom:true,
bordebool:false,
smallspinning:false
smallspinning:false,
bottonloading:false
}
}
// disabledEndDate= endValue => {
@ -351,7 +352,9 @@ class Goldsubject extends Component {
}catch (e) {
}
this.setState({
bottonloading:true
})
let url = "/courses/" + coursesId + ".json";
axios.put(url,
datasysl
@ -372,12 +375,21 @@ class Goldsubject extends Component {
return
}
}catch (e) {
this.setState({
bottonloading:false
})
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
@ -424,20 +436,15 @@ class Goldsubject extends Component {
course_module_types: values.checkboxgroup,
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,
ysldatas
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -451,11 +458,16 @@ class Goldsubject extends Component {
return
}
}catch (e) {
this.setState({
bottonloading:false
})
}
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
});
@ -1074,9 +1086,11 @@ class Goldsubject extends Component {
<div className={"FAFAFA"}>
<Form.Item >
<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>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}
<a className="defalutCancelbtn fl" onClick={this.goback}>取消</a>
</div>

@ -86,7 +86,8 @@ class PathNew extends Component{
pathName:"",
description:"",
point:"",
flag_name:true
flag_name:true,
bottonloading:false
}
}
@ -124,6 +125,9 @@ class PathNew extends Component{
return;
}
if (this.isEditPage == true) {
this.setState({
bottonloading:true
})
let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json`
@ -135,11 +139,21 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
bottonloading:false
})
})
} else {
this.setState({
bottonloading:true
})
let url="/paths.json"
axios.post(url,{
name:pathName,
@ -149,9 +163,16 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
bottonloading:false
})
})
}
@ -267,7 +288,7 @@ class PathNew extends Component{
</div>
<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 ?
<Link to={`/paths/${this.props.match.params.pathId}`}
className="defalutCancelbtn fl">取消</Link>

@ -233,7 +233,8 @@ class Newshixuns extends Component {
systemenvironmenttype:false,
testcoderunmodetype:false,
attachmentidstype:false,
datalisttype:false
datalisttype:false,
bottonloading:false
}
}
@ -494,6 +495,9 @@ class Newshixuns extends Component {
} else {
newmulti_webssh = ""
}
this.setState({
bottonloading:true
})
axios.post(Url, {
name: name,
can_copy: can_copy,
@ -513,9 +517,16 @@ class Newshixuns extends Component {
if (response.status === 200) {
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
@ -1321,7 +1332,9 @@ class Newshixuns extends Component {
<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>
</div>

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