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

@@ -317,6 +317,7 @@ export default {
textV2: "",
radioV1: "",
time: "",
isClick: false
});
const closeDrawer = () => {
ctx.emit("update:addactiveVisible", false);
@@ -464,6 +465,13 @@ export default {
return message.warning("请输入活动地址");
}
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
let obj = {
activityAddress: state.inputV3, //活动地址
activityDuration: state.inputV2, //活动时长
@@ -489,10 +497,12 @@ export default {
ctx.emit("changeData", false);
message.destroy();
message.success("更新成功");
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error("更新失败");
state.isClick = false;
});
} else {
//新建活动信息
@@ -504,10 +514,12 @@ export default {
closeDrawer();
await updateTask(res);
ctx.emit("changeData", false);
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error("创建失败");
state.isClick = false;
});
}
};

View File

@@ -171,6 +171,7 @@ export default {
time: undefined,
caseId: null,
caseName: "",
isClick: false
});
const closeDrawer = () => {
ctx.emit("update:addcaseVisible", false);
@@ -279,6 +280,12 @@ export default {
message.destroy();
return message.warning("请先选中关卡");
}
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
for (let i = 0; i < state.apiTaskList.length; i++) {
RouterEditTask({
chapterId: props.isactive,
@@ -293,12 +300,20 @@ export default {
ctx.emit("changeData", false);
closeDrawer();
state.addLoading = false;
state.isClick = false;
})
.catch(() => {
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
state.isClick = false;
});
}
} else if (props.isLevel == 2) {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
for (let i = 0; i < state.apiTaskList.length; i++) {
apiTask
.addTask({
@@ -314,13 +329,21 @@ export default {
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error(`${props.edit ? "编辑" : "新增"}任务失败`);
state.isClick = false;
});
}
} else if (props.isLevel == 3) {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
for (let i = 0; i < state.apiTaskList.length; i++) {
apiTask
.addTaskTemplate({
@@ -336,10 +359,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;
});
}
}

View File

@@ -194,6 +194,7 @@ export default {
const state = reactive({
addLoading: false,
workEnclosureAddress: "",
isClick: false
});
const formRef = ref();
@@ -337,29 +338,47 @@ export default {
workName: formState.workName,
workRequirement: formState.workRequirement,
};
if (props.EditWorkId > 0) {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
updateWorkTaskUsing(obj)
.then(async(res) => {
// console.log("添加成功", res);
await updateTask(res);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch((err) => {
message.destroy();
message.error(`添加失败${err}`);
state.isClick = false;
});
} else {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
createWorkTask(obj)
.then(async(res) => {
console.log("添加成功", res);
await updateTask(res);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch((err) => {
message.destroy();
message.error(`添加失败${err}`);
state.isClick = false;
});
}
};

View File

@@ -105,6 +105,7 @@ export default {
assessment1: null,
assessmentVisible: false,
titleTag: false,
isClick: false
});
// const getCheckedAss = (ass) => {
// state.assessmentId = ass.assessmentId;
@@ -153,6 +154,12 @@ export default {
message.destroy();
return message.warning("请先选中关卡");
}
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistence({
chapterId: Number(props.isactive),
courseTaskId: l_data_id,
@@ -174,6 +181,7 @@ export default {
}
message.destroy();
message.warning("评估(" + tipStr + ")重复添加");
state.isClick = false;
return;
} else {
RouterEditTask({
@@ -192,17 +200,26 @@ export default {
ctx.emit("changeData", false);
closeDrawer();
state.addLoading = false;
state.isClick = false;
})
.catch(() => {
message.destroy();
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
state.isClick = false;
});
}
})
.catch((err) => {
console.log(err);
state.isClick = false;
});
} else if (props.isLevel == 2) {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistenceProject({
courseTaskId: l_data_id,
projectId: props.projectId,
@@ -224,6 +241,7 @@ export default {
}
message.destroy();
message.warning("评估(" + tipStr + ")重复添加");
state.isClick = false;
return;
} else {
apiTask
@@ -239,16 +257,25 @@ export default {
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
closeDrawer();
state.isClick = false;
})
.catch(() => {
message.error(`${props.edit ? "编辑" : "新增"}任务失败`);
state.isClick = false;
});
}
})
.catch((err) => {
console.log(err);
state.isClick = false;
});
} else if (props.isLevel == 3) {
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
IsExistenceProjectTemplate({
courseTaskId: l_data_id,
projectTemplateId: props.projectTemplateId,
@@ -269,6 +296,7 @@ export default {
}
message.destroy();
message.warning("评估(" + tipStr + ")重复添加");
state.isClick = false;
return;
} else {
addTempTask({
@@ -284,10 +312,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;
});
}
});

View File

@@ -482,6 +482,7 @@ export default {
switchC2: false,
assessmentVisible: false,
assessmentName: "",
isClick: false
});
const closeDrawer = () => {
ctx.emit("update:addliveVisible", false);
@@ -693,6 +694,13 @@ export default {
message.destroy();
return message.warning("请输入直播公告");
}
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
const regular = /^[+]{0,1}(\d+)$/;
if (!regular.test(state.inputV2)) {
message.destroy();
@@ -743,9 +751,11 @@ export default {
message.success("提交成功");
closeDrawer();
await updateTask(res);
state.isClick = false;
})
.catch((err) => {
console.log(err);
state.isClick = false;
});
} else {
api
@@ -755,8 +765,11 @@ export default {
message.success("提交成功");
await updateTask(res);
closeDrawer();
state.isClick = false;
})
.catch(() => {});
.catch(() => {
state.isClick = false;
});
}
};
const beforeUpload = (file) => {

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;
});
})
}

View File

@@ -155,6 +155,7 @@ export default {
inputV2: "",
textV1: "",
title: null,
isClick: false
});
const closeDrawer = () => {
ctx.emit("update:addrefVisible", false);
@@ -253,6 +254,14 @@ export default {
return message.warning("请输入合法的链接地址");
}
}
if(state.isClick){
message.destroy();
message.error('请勿频繁点击')
return
}
state.isClick = true;
let obj = {
linkAddress: state.inputV2,
linkDescription: state.textV1,
@@ -266,8 +275,11 @@ export default {
message.success("编辑成功");
await updateTask(res);
ctx.emit("changeData", false);
state.isClick = false;
})
.catch(() => {});
.catch(() => {
state.isClick = false;
});
} else {
api
.createExternalChain(obj)
@@ -275,8 +287,11 @@ export default {
message.success("提交成功");
await updateTask(res);
ctx.emit("changeData", false);
state.isClick = false;
})
.catch(() => {});
.catch(() => {
state.isClick = false;
});
}
};
// 查询任务