|
@@ -1,36 +1,36 @@
|
|
import { StudentObjectiveInfo } from "@/types";
|
|
import { StudentObjectiveInfo } from "@/types";
|
|
import { studentObjectiveConfirmData } from "@/api/checkPage";
|
|
import { studentObjectiveConfirmData } from "@/api/checkPage";
|
|
import { message } from "ant-design-vue";
|
|
import { message } from "ant-design-vue";
|
|
-import { onMounted } from "vue";
|
|
|
|
|
|
+import { onMounted, computed } from "vue";
|
|
import { useCheckObjectiveStore } from "@/store";
|
|
import { useCheckObjectiveStore } from "@/store";
|
|
|
|
|
|
export default function useStudent() {
|
|
export default function useStudent() {
|
|
const checkObjectiveStore = useCheckObjectiveStore();
|
|
const checkObjectiveStore = useCheckObjectiveStore();
|
|
|
|
|
|
- const currentIndex = $computed(() =>
|
|
|
|
|
|
+ const currentIndex = computed(() =>
|
|
checkObjectiveStore.studentIds.indexOf(checkObjectiveStore.currentStudentId)
|
|
checkObjectiveStore.studentIds.indexOf(checkObjectiveStore.currentStudentId)
|
|
);
|
|
);
|
|
- const isFirst = $computed(() => currentIndex === 0);
|
|
|
|
- const isLast = $computed(
|
|
|
|
- () => currentIndex === checkObjectiveStore.studentIds.length - 1
|
|
|
|
|
|
+ const isFirst = computed(() => currentIndex.value === 0);
|
|
|
|
+ const isLast = computed(
|
|
|
|
+ () => currentIndex.value === checkObjectiveStore.studentIds.length - 1
|
|
);
|
|
);
|
|
- const isMultiStudent = $computed(
|
|
|
|
|
|
+ const isMultiStudent = computed(
|
|
() => checkObjectiveStore.studentIds.length > 1
|
|
() => checkObjectiveStore.studentIds.length > 1
|
|
);
|
|
);
|
|
|
|
|
|
- const totalScore = $computed(() => {
|
|
|
|
|
|
+ const totalScore = computed(() => {
|
|
if (!checkObjectiveStore.student) return 0;
|
|
if (!checkObjectiveStore.student) return 0;
|
|
return checkObjectiveStore.student.objectiveScore || 0;
|
|
return checkObjectiveStore.student.objectiveScore || 0;
|
|
});
|
|
});
|
|
|
|
|
|
- const curImageUrl = $computed(() =>
|
|
|
|
|
|
+ const curImageUrl = computed(() =>
|
|
checkObjectiveStore.student
|
|
checkObjectiveStore.student
|
|
? checkObjectiveStore.student.sheetUrls[checkObjectiveStore.currentImage]
|
|
? checkObjectiveStore.student.sheetUrls[checkObjectiveStore.currentImage]
|
|
?.url
|
|
?.url
|
|
: ""
|
|
: ""
|
|
);
|
|
);
|
|
|
|
|
|
- const answersComputed = $computed(() => {
|
|
|
|
|
|
+ const answersComputed = computed(() => {
|
|
let mains = checkObjectiveStore.student?.answers.map((v) => ({
|
|
let mains = checkObjectiveStore.student?.answers.map((v) => ({
|
|
mainTitle: "",
|
|
mainTitle: "",
|
|
mainNumber: v.mainNumber,
|
|
mainNumber: v.mainNumber,
|
|
@@ -55,19 +55,19 @@ export default function useStudent() {
|
|
});
|
|
});
|
|
|
|
|
|
async function getNextStudent() {
|
|
async function getNextStudent() {
|
|
- if (isLast) {
|
|
|
|
|
|
+ if (isLast.value) {
|
|
void message.warning("已经是最后一份!");
|
|
void message.warning("已经是最后一份!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- await getStudent(checkObjectiveStore.studentIds[currentIndex + 1]);
|
|
|
|
|
|
+ await getStudent(checkObjectiveStore.studentIds[currentIndex.value + 1]);
|
|
}
|
|
}
|
|
|
|
|
|
async function getPreviousStudent() {
|
|
async function getPreviousStudent() {
|
|
- if (isFirst) {
|
|
|
|
|
|
+ if (isFirst.value) {
|
|
void message.warning("已经是第一份!");
|
|
void message.warning("已经是第一份!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- await getStudent(checkObjectiveStore.studentIds[currentIndex - 1]);
|
|
|
|
|
|
+ await getStudent(checkObjectiveStore.studentIds[currentIndex.value - 1]);
|
|
}
|
|
}
|
|
|
|
|
|
async function getStudent(studentId: string) {
|
|
async function getStudent(studentId: string) {
|