feat:增加内部考试,外部考试编辑

This commit is contained in:
wyx
2023-02-10 17:55:42 +08:00
parent 962f55dee5
commit 1b4bb2b5ee
4 changed files with 121 additions and 68 deletions

View File

@@ -22,4 +22,6 @@ export const queryExaminationAloneExtendList = (obj) => http.post('/examination/
// 对接三方考试任务保存接口-三方 // 对接三方考试任务保存接口-三方
export const examinationTaskSave = (obj) => http.post('/examination/examinationTaskSave', obj); export const examinationTaskSave = (obj) => http.post('/examination/examinationTaskSave', obj);
//编辑考试信息 //编辑考试信息
export const updateExamination = (obj) => http.post('/examination/updateExamination', obj); export const updateExamination = (obj) => http.post('/examination/updateExamination', obj);
//编辑外部考试信息
export const updateExternalExam = (obj) => http.post('/external/exam/updateExternalExam', obj);

View File

@@ -17,21 +17,44 @@
</div> </div>
<!-- 2022-11-30注释 后面放开 修改div的padding-topL:32 --> <!-- 2022-11-30注释 后面放开 修改div的padding-topL:32 -->
<div style="display: flex; flex-direction: row; padding-top: 0px; margin-top: 20px; margin-left: 32px;"> <div style="display: flex; flex-direction: row; padding-top: 0px; margin-top: 20px; margin-left: 32px;">
<button
style="width: 100px; cursor: pointer;"
@click="changeOuter(1)"
:class="[isOuter == 1 ? 'outer' : 'notOuter']"
>
系统考试
</button>
<button <div v-if="edit">
style="width: 100px; cursor: pointer;" <button
@click="changeOuter(2)" v-if="isOuter == 1"
:class="[isOuter == 2 ? 'outer' : 'notOuter']" style="width: 100px; cursor: pointer;"
> @click="changeOuter(1)"
外部考试 :class="[isOuter == 1 ? 'outer' : 'notOuter']"
</button> >
系统考试
</button>
<button
v-else
style="width: 100px; cursor: pointer;"
@click="changeOuter(2)"
:class="[isOuter == 2 ? 'outer' : 'notOuter']"
>
外部考试
</button>
</div>
<div v-else>
<button
style="width: 100px; cursor: pointer;"
@click="changeOuter(1)"
:class="[isOuter == 1 ? 'outer' : 'notOuter']"
>
系统考试
</button>
<button
style="width: 100px; cursor: pointer;"
@click="changeOuter(2)"
:class="[isOuter == 2 ? 'outer' : 'notOuter']"
>
外部考试
</button>
</div>
</div> </div>
<div v-if="isOuter==1" class="contentMain"> <div v-if="isOuter==1" class="contentMain">
@@ -366,6 +389,8 @@ import {message} from "ant-design-vue";
import { import {
createExamination, createExamination,
queryExaminationDetailById, queryExaminationDetailById,
updateExamination,
updateExternalExam
} from "@/api/indexExam"; } from "@/api/indexExam";
// updateExamination, // updateExamination,
import STest from "./SelectTest.vue"; import STest from "./SelectTest.vue";
@@ -496,6 +521,12 @@ export default {
scoringModel: 2, scoringModel: 2,
questionArrangement: 4, questionArrangement: 4,
}; };
state.test1 = {
externalName: '',
source: '',
externalExplain: null
}
}; };
const closeDrawer = () => { const closeDrawer = () => {
@@ -522,7 +553,7 @@ export default {
console.log("props", props); console.log("props", props);
if (props.addtestVisible && props.EditTestId && props.EditTestId >0) { if (props.addtestVisible && props.EditTestId && props.EditTestId >0) {
// 该页面显示同时 edit为true 时,发送查询请求, // 该页面显示同时 edit为true 时,发送查询请求,
// queryTest(); queryTest();
} }
if (bool) { if (bool) {
state.test.showAnswers = 1; state.test.showAnswers = 1;
@@ -541,22 +572,36 @@ export default {
const queryTest = () => { const queryTest = () => {
queryExaminationDetailById({examinationId: props.EditTestId}) queryExaminationDetailById({examinationId: props.EditTestId})
.then((res) => { .then((res) => {
state.test = res.data.data; console.log(res)
state.test.showAnswers = Number(state.test.showAnswers); // 判断获取的考试
state.test.showAnalysis = Number(state.test.showAnalysis); if(res.data.data.examType==2){
state.test.scoringModel = Number(state.test.scoringModel); state.isOuter = 2;
state.test.questionArrangement = Number( // 外部考试
state.test.questionArrangement state.test1 = {
); externalName: res.data.data.examinationName,
state.test.chooseTime = [ source: res.data.data.source,
dayjs(res.data.data.examinationStartTime, "YYYY-MM-DD HH:mm"), externalExplain: res.data.data.examinationExplain
dayjs(res.data.data.examinationEndTime, "YYYY-MM-DD HH:mm"), }
]; }else{
state.paperName = state.test.examinationTestName; // 系统考试
// state.paperId=dayjs state.isOuter = 1;
state.paperId = state.test.examinationTestId; state.test = res.data.data;
state.test.showAnswers = Number(state.test.showAnswers);
state.test.showAnalysis = Number(state.test.showAnalysis);
state.test.scoringModel = Number(state.test.scoringModel);
state.test.questionArrangement = Number(
state.test.questionArrangement
);
state.test.chooseTime = [
dayjs(res.data.data.examinationStartTime, "YYYY-MM-DD HH:mm"),
dayjs(res.data.data.examinationEndTime, "YYYY-MM-DD HH:mm"),
];
state.paperName = state.test.examinationTestName;
// state.paperId=dayjs
state.paperId = state.test.examinationTestId;
console.log("querytest", state.test); console.log("querytest", state.test);
}
}) })
.catch(() => { .catch(() => {
//message.error(`查询失败`); //message.error(`查询失败`);
@@ -630,18 +675,18 @@ export default {
// if (props.EditTestId > 0) { if (props.EditTestId > 0) {
// // 编辑任务 // 编辑任务
// updateExamination(state.test) updateExamination(state.test)
// .then(async (res) => { .then(async (res) => {
// await updateTask(res); await updateTask(res);
// // closeDrawer(); // closeDrawer();
// }) })
// .catch(() => { .catch(() => {
// message.destroy(); message.destroy();
// message.error(`编辑失败`); message.error(`编辑失败`);
// }); });
// } else { } else {
// 创建任务 // 创建任务
createExamination(state.test) createExamination(state.test)
.then(async (res) => { .then(async (res) => {
@@ -652,7 +697,7 @@ export default {
message.destroy(); message.destroy();
message.error(`创建失败`); message.error(`创建失败`);
}); });
// } }
}else{ }else{
// 创建外部考试 // 创建外部考试
console.log('我是点了外部考试') console.log('我是点了外部考试')
@@ -687,14 +732,34 @@ export default {
} }
} }
// 新建外部考试
CreateExternalExam(state.test1).then( async res=>{ if (props.EditTestId > 0) {
console.log('新建外部考试返回的参数',res) console.log('我要开始编辑外部考试任务了 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊')
// 添加更新到任务 let obj = {
await updateTask1(res); examinationId:props.EditTestId,
}).catch(err=>{ examinationName:state.test1.externalName,
console.log(err) examinationExplain:state.test1.externalExplain,
}) source:state.test1.source
}
updateExternalExam(obj)
.then(async (res) => {
await updateTask1(res);
// closeDrawer();
})
.catch(() => {
message.destroy();
message.error(`编辑失败`);
});
}else{
// 新建外部考试
CreateExternalExam(state.test1).then( async res=>{
console.log('新建外部考试返回的参数',res)
// 添加更新到任务
await updateTask1(res);
}).catch(err=>{
console.log(err)
})
}
} }
}; };
// 系统考试 // 系统考试

View File

@@ -545,7 +545,7 @@
"> ">
<div class="opa"> <div class="opa">
<div class="opacation"> <div class="opacation">
<span v-if="element.type !== 5" style=" <span style="
color: #4ea6ff; color: #4ea6ff;
margin-right: 25px; margin-right: 25px;
cursor: pointer; cursor: pointer;
@@ -558,12 +558,6 @@
"> ">
编辑 编辑
</span> </span>
<span v-else style="
color: #4ea6ff;
margin-right: 55px;
cursor: pointer;
">
</span>
<span style="color: #4ea6ff; cursor: pointer" @click="showDeleteModal(element.id)"> <span style="color: #4ea6ff; cursor: pointer" @click="showDeleteModal(element.id)">
删除 删除
</span> </span>

View File

@@ -507,7 +507,7 @@
"> ">
<div class="opa"> <div class="opa">
<div class="opacation"> <div class="opacation">
<span v-if="element.type!==5" style=" <span style="
color: #4ea6ff; color: #4ea6ff;
margin-right: 25px; margin-right: 25px;
cursor: pointer; cursor: pointer;
@@ -520,14 +520,6 @@
"> ">
编辑 编辑
</span> </span>
<span
v-else
style="
color: #4ea6ff;
margin-right: 55px;
cursor: pointer;
">
</span>
<span style="color: #4ea6ff; cursor: pointer" @click="showDelete(element.id)"> <span style="color: #4ea6ff; cursor: pointer" @click="showDelete(element.id)">
删除 删除
</span> </span>