feat:测试抽屉创建数据增加到学习路径

This commit is contained in:
dongwug
2022-11-04 11:46:22 +08:00
parent dd6924bb89
commit c03fb1007b
5 changed files with 133 additions and 84 deletions

View File

@@ -112,6 +112,7 @@ import * as api from "../../api/indexEval";
import * as apitaskadd from "../../api/indexTaskadd";
import { message } from "ant-design-vue";
import { toDate } from "../../api/method";
import { RouterEditTask } from "@/api/indexTask";
// const router = useRouter();
export default {
name: "AddEval",
@@ -126,6 +127,10 @@ export default {
type: Boolean,
default: false,
},
learn: {
type: Number,
default: 0,
},
},
setup(props, ctx) {
const state = reactive({
@@ -184,8 +189,7 @@ export default {
};
const beforeUpload = (file) => {
const isJpgOrPng =
file.type === "image/jpg" || file.type === "image/png";
const isJpgOrPng = file.type === "image/jpg" || file.type === "image/png";
if (!isJpgOrPng) {
message.error("You can upload JPG/PNG file!");
}
@@ -235,27 +239,49 @@ export default {
api
.createEvaluation(obj)
.then((res) => {
console.log("创建成功", res);
message.success("创建成功");
console.log("创建成功", res);
message.success("创建成功");
closeDrawer();
apitaskadd
.addTask({
console.log("1111", props.learn);
if (props.learn == 0)
apitaskadd
.addTask({
courseId: 0,
duration: 0,
flag: true,
name: obj.evaluationName,
projectId: 28,
projectTaskId: 0,
stageId: 3,
type: 10,
})
.then((res) => {
console.log("调用项目添加接口后", res.data);
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err);
});
else {
let editObj1 = {
chapterId: 36,
courseId: 0,
duration: 0,
flag: true,
name: obj.evaluationName,
projectId: 28,
projectTaskId: 0,
stageId: 3,
routerId: 92,
routerTaskId: 0,
type: 10,
})
.then((res) => {
console.log("调用项目添加接口后", res.data);
ctx.emit("changeData",false);
})
.catch((err) => {
console.log(err);
});
};
RouterEditTask(editObj1)
.then((res) => {
console.log("调用学历路径添加接口后", res.data);
ctx.emit("changeData", false);
})
.catch((err) => {
console.log(err);
});
}
})
.catch((err) => {
console.log("创建失败", err);