|
@@ -8,7 +8,7 @@ import { store } from "@/store/store";
|
|
import { PracticeExam } from "@/types/student-client";
|
|
import { PracticeExam } from "@/types/student-client";
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
import { SelectOption } from "naive-ui";
|
|
import { SelectOption } from "naive-ui";
|
|
-import { onMounted } from "vue";
|
|
|
|
|
|
+import { onMounted, watch } from "vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { checkExamInProgress } from "../UserLogin/useExamInProgress";
|
|
import { checkExamInProgress } from "../UserLogin/useExamInProgress";
|
|
|
|
|
|
@@ -21,7 +21,7 @@ let examList = $ref<SelectOption[]>([]);
|
|
async function getExamList() {
|
|
async function getExamList() {
|
|
const userId = store.user.id;
|
|
const userId = store.user.id;
|
|
const res = await onlinePracticeExamListApi(userId);
|
|
const res = await onlinePracticeExamListApi(userId);
|
|
- let exams = res.data || [];
|
|
|
|
|
|
+ let exams = (res.data || []).filter((e) => e.enable);
|
|
examList = exams.map((item) => {
|
|
examList = exams.map((item) => {
|
|
return {
|
|
return {
|
|
label: item.name,
|
|
label: item.name,
|
|
@@ -111,12 +111,19 @@ async function initData() {
|
|
} else {
|
|
} else {
|
|
examId = examList[0] && (examList[0].value as number);
|
|
examId = examList[0] && (examList[0].value as number);
|
|
}
|
|
}
|
|
- if (typeof examId === "number") void getCourseList();
|
|
|
|
|
|
+ // if (typeof examId === "number") void getCourseList();
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
void initData();
|
|
void initData();
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+watch(
|
|
|
|
+ () => examId,
|
|
|
|
+ () => {
|
|
|
|
+ if (typeof examId === "number") void getCourseList();
|
|
|
|
+ }
|
|
|
|
+);
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|