|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="tw-h-screen">
|
|
|
+ <div v-if="!dataError" class="tw-h-screen">
|
|
|
<header
|
|
|
class="tw-flex tw-gap-2 tw-justify-between tw-items-center header-container"
|
|
|
>
|
|
@@ -213,6 +213,8 @@ let currentStudentId = $ref(-1);
|
|
|
const currentIndex = $computed(() => allIds.indexOf(currentStudentId) + 1);
|
|
|
|
|
|
let student: StudentInfo | null = $ref(null);
|
|
|
+/** 后台数据错误,停止整个页面的流程 */
|
|
|
+let dataError = $ref(false);
|
|
|
|
|
|
const answersComputed = $computed(() => {
|
|
|
let mains = student?.answers.map((v) => ({
|
|
@@ -276,6 +278,13 @@ async function getStudent(studentId: number) {
|
|
|
currentStudentId = stu.id;
|
|
|
currentImage = 0;
|
|
|
|
|
|
+ if (!stu.success) {
|
|
|
+ void message.error(stu.message);
|
|
|
+ dataError = true;
|
|
|
+
|
|
|
+ throw new Error("取学生信息出错: " + stu.message);
|
|
|
+ }
|
|
|
+
|
|
|
// for dev
|
|
|
// stu.answers = [
|
|
|
// { mainNumber: 1, subNumber: "1", answer: "A" },
|