fix:修改任务频繁点击增加多条问题

This commit is contained in:
wyx
2022-12-20 15:35:04 +08:00
parent febf4774ee
commit 4442ca956d
7 changed files with 146 additions and 3 deletions

View File

@@ -232,6 +232,7 @@ export default {
pageSize: 10,
choicecourse: true,
ddLoading: false,
isClick: false
});
const ChoiceCourse = () => {
state.choicecourse = false;
@@ -455,6 +456,12 @@ export default {
l_data_id.push(item["courseId"]);
});
console.log("需要查询的在线课ID", l_data_id);
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistence({
chapterId: Number(props.isactive),
courseTaskId: l_data_id,
@@ -475,6 +482,7 @@ export default {
}
message.destroy();
message.warning("在线课" + tipStr + "重复添加");
state.isClick = false;
state.addLoading = false;
return;
} else {
@@ -498,6 +506,7 @@ export default {
ctx.emit("changeData", false);
closeDrawer();
state.addLoading = false;
state.isClick = false;
})
.catch(() => {
state.addLoading = false;
@@ -505,12 +514,14 @@ export default {
message.error(
`${props.edit ? "编辑" : "新增"}关卡任务失败`
);
state.isClick = false;
});
});
}
})
.catch((err) => {
console.log(err);
state.isClick = false;
});
} else if (props.isLevel == 2) {
console.log("我是要便利的数据2", state.addOnlineList);
@@ -520,6 +531,12 @@ export default {
p_data_id.push(item["courseId"]);
});
console.log("需要查询的在线课ID", p_data_id);
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistenceProject({
courseTaskId: p_data_id,
projectId: Number(props.projectId),
@@ -540,6 +557,7 @@ export default {
}
message.destroy();
message.warning("在线课" + tipStr + "重复添加");
state.isClick = false;
return;
} else {
state.addOnlineList.map((value) => {
@@ -557,10 +575,12 @@ export default {
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error(`${props.edit ? "编辑" : "新增"}任务失败`);
state.isClick = false;
});
});
}
@@ -576,6 +596,12 @@ export default {
p_data_id.push(item["courseId"]);
});
console.log("需要查询的在线课ID", p_data_id);
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistenceProjectTemplate({
courseTaskId: p_data_id,
projectTemplateId: props.projectTemplateId,
@@ -595,6 +621,7 @@ export default {
}
message.destroy();
message.warning("在线课" + tipStr + "重复添加");
state.isClick = false;
return;
} else {
state.addOnlineList.map((value) => {
@@ -614,10 +641,12 @@ export default {
message.success(`${props.edit ? "编辑" : "新增"}模板库任务成功`);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error(`${props.edit ? "编辑" : "新增"}模板库任务失败`);
state.isClick = false;
});
})
}