mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 05:16:45 +08:00
feat:新增关卡路径下 考试和作业的 删除、修改、添加, 增加loading效果
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div class="headerTitle">{{EditTestId ? "编辑" : "添加" }}考试</div>
|
||||
<div class="headerTitle">{{edit ? "编辑" : "添加" }}考试</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@@ -194,13 +194,17 @@
|
||||
</div>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 加载动画 -->
|
||||
<div class="aeLoading" :style="{display:addLoading?'flex':'none'}">
|
||||
<a-spin :spinning="addLoading" tip="添加中..." />
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, ref } from "vue";
|
||||
import { reactive, ref, toRefs } from "vue";
|
||||
import {message} from"ant-design-vue";
|
||||
import {createExamination,queryExaminationDetailById,updateExamination} from "@/api/indexExam"
|
||||
import { ProjectEditTask } from "@/api/indexTask"
|
||||
import { ProjectEditTask, RouterEditTask } from "@/api/indexTask"
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
const rowSelection = ref({
|
||||
@@ -232,18 +236,26 @@ export default {
|
||||
type: Number,
|
||||
default: -1,
|
||||
},
|
||||
isactive: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
routerId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
projectId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
routerTaskId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
chooseStageId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
routerTaskId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
isLevel: { // 是否是关卡页面触发
|
||||
type: Boolean,
|
||||
default: null,
|
||||
@@ -271,6 +283,9 @@ export default {
|
||||
showAnswers:2,
|
||||
choosedTime:'',
|
||||
});
|
||||
const state = reactive({
|
||||
addLoading: false,
|
||||
})
|
||||
const formRef = ref();
|
||||
let checkExaminationName = async (_rule, value) => {
|
||||
if (!value) {
|
||||
@@ -421,20 +436,22 @@ export default {
|
||||
console.log("formState", bool);
|
||||
};
|
||||
const queryTest = () => {
|
||||
state.addLoading = true;
|
||||
console.log(props.EditTestId);
|
||||
queryExaminationDetailById({examinationId:props.EditTestId}).then((res) => {
|
||||
formState.examinationName = res.data.data.examinationName;
|
||||
formState.workRequirement = res.data.data.workRequirement;
|
||||
formState.examinationDuration = res.data.data.examinationDuration;
|
||||
formState.examinationLimit = res.data.data.examinationLimit || -1;
|
||||
formState.examinationLimit = Number(res.data.data.examinationLimit) || -1;
|
||||
formState.passLine = res.data.data.passLine;
|
||||
formState.examinationExplain = res.data.data.examinationExplain;
|
||||
formState.questionArrangement = res.data.data.questionArrangement || 1;
|
||||
formState.scoringModel = res.data.data.scoringModel || 1;
|
||||
formState.showAnalysis = res.data.data.showAnalysis || 1;
|
||||
formState.showAnswers = res.data.data.showAnswers || 1;
|
||||
formState.questionArrangement = Number(res.data.data.questionArrangement) || 1;
|
||||
formState.scoringModel = Number(res.data.data.scoringModel) || 1;
|
||||
formState.showAnalysis = Number(res.data.data.showAnalysis) || 1;
|
||||
formState.showAnswers = Number(res.data.data.showAnswers )|| 1;
|
||||
if(res.data.data.examinationEndTime && res.data.data.examinationStartTime){
|
||||
formState.choosedTime= [dayjs(res.data.data.examinationStartTime,"YYYY-MM-DD"),dayjs(res.data.data.examinationEndTime,"YYYY-MM-DD")]
|
||||
state.addLoading = false;
|
||||
} else { formState.choosedTime=[] }
|
||||
console.log(res);
|
||||
}).catch(() => {
|
||||
@@ -442,19 +459,12 @@ export default {
|
||||
})
|
||||
}
|
||||
const updateTest = () => {
|
||||
|
||||
// 如果是关卡页面进入 ---------------------------------
|
||||
if (props.isLevel) {
|
||||
//.
|
||||
} else { // 从任务界面进入
|
||||
state.addLoading = true;
|
||||
if(props.edit) { // 编辑任务
|
||||
myUpdateExamination()
|
||||
}else { // 创建任务
|
||||
myCreateExamination()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const myUpdateExamination = () => {
|
||||
@@ -482,7 +492,12 @@ export default {
|
||||
}
|
||||
updateExamination(obj).then((res)=>{
|
||||
console.log(res);
|
||||
myProjectEditTask(res.data.data.examinationId)
|
||||
// 如果是关卡页面进入 ---------------------------------
|
||||
if(props.isLevel) {
|
||||
myRouterEditTask(res.data.data.examinationId)
|
||||
}else {
|
||||
myProjectEditTask(res.data.data.examinationId)
|
||||
}
|
||||
}).catch(()=>{
|
||||
message.error(`编辑失败`)
|
||||
})
|
||||
@@ -512,7 +527,11 @@ export default {
|
||||
"updateUser": 0
|
||||
}
|
||||
createExamination(obj).then((res)=>{
|
||||
myProjectEditTask(res.data.data.examinationId)
|
||||
if(props.isLevel) {
|
||||
myRouterEditTask(res.data.data.examinationId)
|
||||
}else {
|
||||
myProjectEditTask(res.data.data.examinationId)
|
||||
}
|
||||
}).catch((err)=>{
|
||||
message.error(`添加失败${err}`)
|
||||
})
|
||||
@@ -533,6 +552,7 @@ export default {
|
||||
console.log(` 编辑项目成功的打印 ${res}`);
|
||||
message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`)
|
||||
ctx.emit("changeData", false);
|
||||
state.addLoading = false;
|
||||
closeDrawer();
|
||||
}).catch(err => {
|
||||
message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`)
|
||||
@@ -540,6 +560,30 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
const myRouterEditTask = (testId) => {
|
||||
let editObj1 = {
|
||||
"chapterId": props.isactive,
|
||||
"courseId": testId,
|
||||
"duration": 30,
|
||||
"flag": true,
|
||||
"name": formState.examinationName,
|
||||
"routerId": props.routerId,
|
||||
"routerTaskId": props.routerTaskId || 0,
|
||||
"type": 5
|
||||
}
|
||||
|
||||
RouterEditTask(editObj1).then(res => {
|
||||
console.log(` 编辑关卡成功的打印 ${res}`);
|
||||
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||
ctx.emit("changeData", false);
|
||||
state.addLoading = false;
|
||||
closeDrawer();
|
||||
}).catch(err => {
|
||||
message.error(`${props.edit ? '编辑' : '新增'}关卡任务失败`)
|
||||
console.log(` 编辑关卡失败的打印 ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
const cloradio1 = (value) => {
|
||||
if (value != "") {
|
||||
formState.showAnswers = "";
|
||||
@@ -579,6 +623,7 @@ export default {
|
||||
rules,
|
||||
updateTest,
|
||||
queryTest,
|
||||
...toRefs(state)
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user