合并课程

This commit is contained in:
kclf
2022-11-25 20:25:27 +08:00
parent c2e43611c8
commit 7a6f118bac
17 changed files with 3379 additions and 1298 deletions

View File

@@ -51,14 +51,6 @@
<button class="checkEval" @click="showEvalDrawer">
选择测评
</button>
<span style="margin-left: 10px">
<a-tag
class="tag-style"
v-if="evaluationTypeName != ''"
:closable="true"
>{{ evaluationTypeName }}</a-tag
>
</span>
</div>
</div>
<div class="main_item">
@@ -96,8 +88,11 @@
</div>
<EvList
v-model:EvalListVisible="EvalListVisible"
@getEvListData="checkFinish"
@getEvLsitDate="checkFinish"
/>
<!-- v-model:evaluationTypeId="evaluationTypeId"
v-model:evaluationTypeName="evaluationTypeName" -->
<!-- <div class="aeLoading" :style="{display:addLoading?'flex':'none'}">
<a-spin :spinning="addLoading" tip="添加中..." />
</div> -->
@@ -166,105 +161,106 @@ export default {
setup(props, ctx) {
const state = reactive({
inputV1: "",
inputV2: "",
time: undefined,
EvalId: null,
//子传回来的参数
evaluationTypeId: 0,
evaluationTypeId: null,
evaluationTypeName: "",
description: "",
EvalListVisible: false,
// addLoading:false,
});
const checkFinish = (value)=> {
state.evaluationTypeId = value.quiz_kid
state.evaluationTypeName = value.title
const checkFinish = (EvListDate)=> {
state.evaluationTypeId = EvListDate.Id
state.evaluationTypeName = EvListDate.Name
}
const closeDrawer = () => {
ctx.emit("update:addevalVisible", false);
ctx.emit("update:edit", false);
state.inputV1 = "";
state.inputV2 = "";
localStorage.setItem("stageId", props.chooseStageId);
localStorage.setItem("chapterId", props.isactive);
};
const afterVisibleChange = (bool) => {
if (props.edit && bool) {
queryInvistById()
queryEval();
}
};
const showEvalDrawer = () => {
state.EvalListVisible = true;
};
const updateTask = (value) => {
if (props.isLevel == 1) {
RouterEditTask({
chapterId: props.isactive,
courseId: Number(value.evaluationId),
name: value.evaluationName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 10,
const queryEval = () => {
api
.queryEvaluationDetailById({ evaluationId: props.evaluationId })
.then((res) => {
state.inputV1 = res.data.data.evaluationName;
state.time = [
dayjs(res.data.data.evaluationStartTime, "YYYY-MM-DD"),
dayjs(res.data.data.evaluationEndTime, "YYYY-MM-DD"),
];
state.evaluationTypeId = res.data.data.evaluationTypeId;
state.evaluationTypeName = res.data.data.evaluationTypeName;
})
.then(( ) => {
message.success(`${props.EditTestId ? "编辑" : "新增"}关卡任务成功`);
})
.catch(( ) => {
message.error(`${props.EditTestId ? "编辑" : "新增"}关卡任务失败`);
});
} else if (props.isLevel == 2) {
.catch(() => {
});
};
const updateTask = (res) => {
if (props.isLevel == 1) {
apitaskadd
.addTask({
duration: 0,
flag: true,
courseId: Number(value.evaluationId),
name: value.evaluationName,
courseId: res.data.data.evaluationId,
name: res.data.data.evaluationName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId,
evaluationTypeId: state.evaluationTypeId,
evaluationTypeName: state.evaluationTypeName,
type: 10,
})
.then(( ) => {
message.success(`${props.edit ? "编辑" : "新增"}阶段任务成功`);
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
})
.catch(( ) => {
message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
});
} else if (props.isLevel == 2) {
RouterEditTask({
chapterId: props.isactive,
courseId: res.data.data.evaluationId,
name: res.data.data.evaluationName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
evaluationTypeId: state.evaluationTypeId,
evaluationTypeName: state.evaluationTypeName,
type: 10,
})
.then(( ) => {
message.success(`${props.EditTestId ? "编辑" : "新增"}阶段任务成功`);
})
.catch(( ) => {
message.error(`${props.EditTestId ? "编辑" : "新增"}阶段任务失败`);
});
} else if (props.isLevel == 3) {
console.log("");
}
};
//根据id获取测评信息
const queryInvistById = ()=> {
let objqi = {
evaluationId : props.EditEvalId
}
api
.queryEvaluationDetailById(objqi)
.then((res) => {
message.destroy()
message.success("获取测评信息成功");
state.inputV1 = res.data.data.evaluationName
state.evaluationTypeName = res.data.data.evaluationTypeName
state.evaluationTypeId = res.data.data.evaluationTypeId;
state.time = [
dayjs(res.data.data.evaluationStartTime, "YYYY-MM-DD"),
dayjs(res.data.data.evaluationEndTime, "YYYY-MM-DD"),
];
})
.catch(() => {
message.destroy()
message.error("获取测量平信息失败");
});
}
//创建测评信息
//创建或编辑测评信息
const createEvalText = () => {
if (!state.inputV1) {
message.destroy();
return message.info("请输入测评名称");
}
if (!state.evaluationTypeId) {
if (!state.inputV2) {
message.destroy();
return message.info("请选择测评");
}
if (!state.time) {
message.destroy();
return message.warning("请输入直播时间");
}
let obj = {
evaluationName: state.inputV1,
evaluationEndTime: dayjs(state.time[1]).format("YYYY-MM-DD"),
@@ -272,15 +268,12 @@ export default {
evaluationStartTime: dayjs(state.time[0]).format("YYYY-MM-DD"),
evaluationTypeId: state.evaluationTypeId,
evaluationTypeName: state.evaluationTypeName,
evaluationFlag: "",
evaluationPictureAddress: "",
evaluationTag: "",
updateTime: "",
};
if (props.edit !== true) {
api
.createEvaluation(obj)
.then((res) => {
updateTask(res.data.data);
updateTask(res);
message.success("创建成功");
closeDrawer();
ctx.emit("changeData", false);
@@ -288,6 +281,19 @@ export default {
.catch(() => {
message.error("创建失败");
});
} else {
api
.updateEvaluation(obj)
.then((res) => {
updateTask(res);
message.success("编辑成功");
closeDrawer();
ctx.emit("changeData", false);
})
.catch(( ) => {
message.error("编辑失败");
});
}
};
return {
@@ -297,7 +303,6 @@ export default {
closeDrawer,
//增改
createEvalText,
queryInvistById,
showEvalDrawer,
updateTask,
};
@@ -361,10 +366,6 @@ export default {
margin-left: 15px;
color: #fff;
}
.tag-style {
color: rgb(113, 113, 237);
background-color: #d7d1f7;
}
}
}
.main_item2 {