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

@@ -23,3 +23,5 @@ export const queryExaminationAloneExtendList = (obj) => http.post('/examination/
export const examinationTaskSave = (obj) => http.post('/examination/examinationTaskSave', obj);
//编辑考试信息
export const updateExamination = (obj) => http.post('/examination/updateExamination', obj);
//编辑外部考试信息
export const updateExternalExam = (obj) => http.post('/external/exam/updateExternalExam', obj);

View File

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

View File

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

View File

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