Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
yuping
2023-01-31 11:47:54 +08:00
4 changed files with 216 additions and 100 deletions

View File

@@ -19,3 +19,5 @@ export const IsExistenceProject = (obj) => http.post('/admin/project/queryTaskDo
// 判断当前在线课是否已经添加到该模板库下 // 判断当前在线课是否已经添加到该模板库下
export const IsExistenceProjectTemplate = (obj) => http.post('/admin/project/template/queryTaskDoesItExistForTemplate',obj); export const IsExistenceProjectTemplate = (obj) => http.post('/admin/project/template/queryTaskDoesItExistForTemplate',obj);
// 新建外部考试
export const CreateExternalExam = (obj) => http.post('/external/exam/createExternalExam',obj);

View File

@@ -899,7 +899,7 @@ export default {
process.env.VUE_APP_BASE_API process.env.VUE_APP_BASE_API
}/admin/student/exportTaskStudent?currentStageId=${ }/admin/student/exportTaskStudent?currentStageId=${
props.datasource.chapterId props.datasource.chapterId
}&type=2&pid=${props.datasource.courseId}&thirdType=1&taskId=${props.datasource.routerTaskId}` }&type=2&pid=${props.datasource.courseId}&thirdType=1&taskId=${props.datasource.routerTaskId}&taskType=${props.datasource.type}`
); );
}else{ }else{
window.open( window.open(
@@ -907,7 +907,7 @@ export default {
process.env.VUE_APP_BASE_API process.env.VUE_APP_BASE_API
}/admin/student/exportTaskStudent?currentStageId=${ }/admin/student/exportTaskStudent?currentStageId=${
props.datasource.stageId props.datasource.stageId
}&type=1&pid=${props.datasource.courseId}&thirdType=1&taskId=${props.datasource.projectTaskId}` }&type=1&pid=${props.datasource.courseId}&thirdType=1&taskId=${props.datasource.projectTaskId}&taskType=${props.datasource.type}`
); );
} }

View File

@@ -303,7 +303,7 @@
</div> </div>
<div class="btnbox"> <div class="btnbox">
<a-input <a-input
v-model:value="test1.examinationName" v-model:value="test1.externalName"
style="width: 400px; height: 40px; border-radius: 8px" style="width: 400px; height: 40px; border-radius: 8px"
placeholder="请输入考试名称" placeholder="请输入考试名称"
:maxlength="20" :maxlength="20"
@@ -322,9 +322,9 @@
</div> </div>
<div class="btnbox"> <div class="btnbox">
<a-input <a-input
v-model:value="test1.examinationName" v-model:value="test1.source"
style="width: 400px; height: 40px; border-radius: 8px" style="width: 400px; height: 40px; border-radius: 8px"
placeholder="请输入考试名称" placeholder="请输入数据来源"
:maxlength="20" :maxlength="20"
/> />
</div> </div>
@@ -335,7 +335,7 @@
</div> </div>
<div class="textarea"> <div class="textarea">
<a-textarea <a-textarea
v-model:value="test1.examinationExplain" v-model:value="test1.externalExplain"
placeholder="请输入考试说明" placeholder="请输入考试说明"
allow-clear allow-clear
show-count show-count
@@ -369,7 +369,7 @@ import {
} from "@/api/indexExam"; } from "@/api/indexExam";
// updateExamination, // updateExamination,
import STest from "./SelectTest.vue"; import STest from "./SelectTest.vue";
import {ProjectEditTask, RouterEditTask} from "@/api/indexTask"; import {ProjectEditTask, RouterEditTask,CreateExternalExam} from "@/api/indexTask";
import {addTempTask} from "../../api/indexTaskadd"; import {addTempTask} from "../../api/indexTaskadd";
import dayjs from "dayjs"; import dayjs from "dayjs";
//import { toDate } from "@/api/method"; //import { toDate } from "@/api/method";
@@ -456,16 +456,9 @@ export default {
questionArrangement: 4, questionArrangement: 4,
}, },
test1: { test1: {
examinationName: '', externalName: '',
chooseTime: '', source: '',
examinationDuration: '', externalExplain: null
passLine: '',
examinationExplain: null,
examinationLimit: null,
showAnswers: 1,
showAnalysis: 1,
scoringModel: 2,
questionArrangement: 4,
}, },
addLoading: false, addLoading: false,
@@ -510,7 +503,7 @@ export default {
ctx.emit("update:addtestVisible", false); ctx.emit("update:addtestVisible", false);
ctx.emit("update:edit", false); ctx.emit("update:edit", false);
ctx.emit("update:EditTestId", state.EditTestId); ctx.emit("update:EditTestId", state.EditTestId);
ctx.emit("update:testName", state.test.examinationName); ctx.emit("update:testName", state.isOuter==1 ? state.test.examinationName : state.test1.externalName);
console.log("statetestName", state.test.examinationName); console.log("statetestName", state.test.examinationName);
localStorage.setItem("stageId", props.chooseStageId); localStorage.setItem("stageId", props.chooseStageId);
localStorage.setItem("chapterId", props.isactive); localStorage.setItem("chapterId", props.isactive);
@@ -570,95 +563,141 @@ export default {
}); });
}; };
const updateTest = () => { const updateTest = () => {
if (!state.test.examinationName) { if(state.isOuter==1){
message.destroy();
return message.warning("请输入考试名称"); if (!state.test.examinationName) {
} message.destroy();
if (!state.paperId) { return message.warning("请输入考试名称");
message.destroy(); }
return message.warning("请输入选择试卷"); if (!state.paperId) {
} message.destroy();
if (!state.test.chooseTime) { return message.warning("请输入选择试卷");
message.destroy(); }
return message.warning("请输入开始结束时间"); if (!state.test.chooseTime) {
} message.destroy();
if (!state.test.examinationDuration) { return message.warning("请输入开始结束时间");
message.destroy(); }
return message.warning("请输入考试时长"); if (!state.test.examinationDuration) {
} message.destroy();
if (!state.test.passLine) { return message.warning("请输入考试时长");
message.destroy(); }
return message.warning("请输入及格线"); if (!state.test.passLine) {
} message.destroy();
return message.warning("请输入及格线");
}
state.addLoading = true;
console.log("test", state.test);
// state.test.examinationStartTime = toDate(
// new Date(state.test.chooseTime[0].$d).getTime() / 1000,
// "Y-M-D h:m"
// );
// state.test.examinationEndTime =toDate(
// new Date(state.test.$slotschooseTime[1].$d).getTime() / 1000,
// "Y-M-D h:m"
// );
(state.test.examinationStartTime = dayjs(state.test.chooseTime[0]).format(
"YYYY-MM-DD HH:mm"
)),
(state.test.examinationEndTime = dayjs(state.test.chooseTime[1]).format(
"YYYY-MM-DD HH:mm"
)),
(state.test.examinationPaperId = state.paperId);
//TODO缺少paperName字段
state.test.examinationTestName = state.paperName;
//考试推送
state.test.targetId = 0;
state.test.type = 0;
state.test.chapterId=0;
console.log("props.offCourseId",props.offCourseId);
if (props.faceLevel && props.offCourseId > 0) {
state.test.targetId = props.offCourseId;
state.test.type = 3;
}else{
if(props.isLevel == 1){
state.test.targetId = props.routerId;
state.test.chapterId = props.isactive;
state.test.type = 2;
} else if (props.isLevel == 2) {
state.test.targetId = props.projectId;
state.test.type = 1;
}
}
state.addLoading = true;
console.log("test", state.test);
// state.test.examinationStartTime = toDate(
// new Date(state.test.chooseTime[0].$d).getTime() / 1000,
// "Y-M-D h:m"
// );
// state.test.examinationEndTime =toDate(
// new Date(state.test.$slotschooseTime[1].$d).getTime() / 1000,
// "Y-M-D h:m"
// );
(state.test.examinationStartTime = dayjs(state.test.chooseTime[0]).format(
"YYYY-MM-DD HH:mm"
)),
(state.test.examinationEndTime = dayjs(state.test.chooseTime[1]).format(
"YYYY-MM-DD HH:mm"
)),
(state.test.examinationPaperId = state.paperId);
//TODO缺少paperName字段
state.test.examinationTestName = state.paperName;
//考试推送
state.test.targetId = 0;
state.test.type = 0;
state.test.chapterId=0;
console.log("props.offCourseId",props.offCourseId);
if (props.faceLevel && props.offCourseId > 0) {
state.test.targetId = props.offCourseId;
state.test.type = 3;
}else{
if(props.isLevel == 1){
state.test.targetId = props.routerId;
state.test.chapterId = props.isactive;
state.test.type = 2;
} else if (props.isLevel == 2) {
state.test.targetId = props.projectId;
state.test.type = 1;
}
}
// if (props.EditTestId > 0) {
// // 编辑任务
// updateExamination(state.test)
// .then(async (res) => {
// await updateTask(res);
// // closeDrawer();
// })
// .catch(() => {
// message.destroy();
// message.error(`编辑失败`);
// });
// } else {
// 创建任务
createExamination(state.test)
.then(async (res) => {
await updateTask(res);
// closeDrawer();
})
.catch(() => {
message.destroy();
message.error(`创建失败`);
});
// }
}else{
// 创建外部考试
console.log('我是点了外部考试')
if (!state.test1.externalName) {
message.destroy();
message.warning("请输入考试名称");
return
}
if (!state.test1.source) {
message.destroy();
message.warning("请输入数据来源");
return
}
//考试推送
state.test1.targetId = 0;
state.test1.type = 0;
state.test1.chapterId=0;
console.log("props.offCourseId",props.offCourseId);
if (props.faceLevel && props.offCourseId > 0) {
state.test1.targetId = props.offCourseId;
state.test1.type = 3;
}else{
if(props.isLevel == 1){
state.test1.targetId = props.routerId;
state.test1.chapterId = props.isactive;
state.test1.type = 2;
} else if (props.isLevel == 2) {
state.test1.targetId = props.projectId;
state.test1.type = 1;
// if (props.EditTestId > 0) { }
// // 编辑任务 }
// updateExamination(state.test) // 新建外部考试
// .then(async (res) => { CreateExternalExam(state.test1).then( async res=>{
// await updateTask(res); console.log(res)
// // closeDrawer(); // 添加更新到任务
// }) await updateTask1(res);
// .catch(() => { }).catch(err=>{
// message.destroy(); console.log(err)
// message.error(`编辑失败`); })
// }); }
// } else {
// 创建任务
createExamination(state.test)
.then(async (res) => {
await updateTask(res);
// closeDrawer();
})
.catch(() => {
message.destroy();
message.error(`创建失败`);
});
// }
}; };
// 系统考试
const updateTask = (res) => { const updateTask = (res) => {
state.EditTestId = res.data.data.examinationId; state.EditTestId = res.data.data.examinationId;
if (props.faceLevel) { if (props.faceLevel) {
@@ -734,6 +773,81 @@ export default {
} }
} }
}; };
// 外部考试
const updateTask1 = (res) => {
state.EditTestId = res.data.data.externalId;
if (props.faceLevel) {
state.EditTestId = res.data.data.externalId;
state.paperName = "";
closeDrawer();
} else {
if (props.isLevel == 1) {
if (!props.isactive) {
message.destroy();
return message.warning("请先选中关卡");
}
let editObj1 = {
chapterId: props.isactive,
courseId: res.data.data.externalId,
name: res.data.data.externalName,
routerId: props.routerId,
routerTaskId: props.routerTaskId || 0,
type: 5,
};
RouterEditTask(editObj1)
.then(() => {
console.log("props.edit", props.edit);
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
state.paperName = "";
closeDrawer();
})
.catch(() => {
//message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
});
} else if (props.isLevel == 2) {
let editObj = {
courseId: res.data.data.externalId,
name: res.data.data.externalName,
projectId: props.projectId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId || 0,
type: 5,
};
// 新增编辑或新增项目
ProjectEditTask(editObj)
.then(() => {
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
state.paperName = "";
closeDrawer();
})
.catch(() => {
//message.error(`${props.EditTestId ? "编辑" : "新增"}阶段任务失败`);
});
} else if (props.isLevel == 3) {
addTempTask({
courseId: res.data.data.externalId,
name: res.data.data.externalName,
projectTemplateId: props.projectTemplateId,
projectTaskId: props.projectTaskId || 0,
stageId: props.chooseStageId || 0,
type: 5,
})
.then(() => {
message.success(`${props.edit ? "编辑" : "新增"}任务成功`);
ctx.emit("changeData", false);
state.paperName = "";
closeDrawer();
})
.catch(() => {
//message.error(`${props.EditTestId ? "编辑" : "新增"}阶段任务失败`);
});
}
}
};
const cloradio1 = (value) => { const cloradio1 = (value) => {
if (value != "") { if (value != "") {
state.showAnswers = ""; state.showAnswers = "";

View File

@@ -28,7 +28,7 @@
</template> </template>
<script setup> <script setup>
import { defineEmits, defineProps, ref, watch } from "vue"; import { defineEmits, defineProps, ref, watch } from "vue";
import {boeRequest, request, useBoeApi} from "@/api/request"; import {boeRequest, useBoeApi} from "@/api/request";
import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi"; import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi";
const props = defineProps({ const props = defineProps({