diff --git a/src/admin/tutorial/components/ExerciseManager.vue b/src/admin/tutorial/components/ExerciseManager.vue
index b41572c..c538ca3 100644
--- a/src/admin/tutorial/components/ExerciseManager.vue
+++ b/src/admin/tutorial/components/ExerciseManager.vue
@@ -21,6 +21,7 @@ const mcqQuestion = ref("")
const mcqOptions = ref(["", ""])
const mcqAnswer = ref(0)
+const sortQuestion = ref("")
const sortCode = ref("")
async function load() {
@@ -36,6 +37,7 @@ function openCreate() {
mcqQuestion.value = ""
mcqOptions.value = ["", ""]
mcqAnswer.value = 0
+ sortQuestion.value = ""
sortCode.value = ""
showForm.value = true
}
@@ -51,6 +53,7 @@ function openEdit(ex: Exercise) {
mcqAnswer.value = d.answer
} else {
const d = ex.data as ExerciseSortData
+ sortQuestion.value = d.question
sortCode.value = d.lines.join("\n")
}
showForm.value = true
@@ -61,7 +64,7 @@ async function save() {
formType.value === "mcq"
? { question: mcqQuestion.value, options: mcqOptions.value, answer: mcqAnswer.value }
: {
- question: "将下列代码行排列为正确顺序",
+ question: sortQuestion.value || "将下列代码行排列为正确顺序",
lines: sortCode.value.split("\n").filter((l) => l.trim() !== ""),
}
@@ -179,7 +182,7 @@ function typeName(type: string) {
{ mcqOptions.splice(i, 1); if (mcqAnswer >= mcqOptions.length) mcqAnswer = mcqOptions.length - 1 }"
>
✕
@@ -190,6 +193,9 @@ function typeName(type: string) {
+
+
+
item.originalIdx === i)
- return isCorrect && a.length > 1 ? shuffle(arr) : a
+ if (isCorrect && a.length > 1) [a[0], a[1]] = [a[1], a[0]]
+ return a
}
function init() {
diff --git a/src/oj/learn/index.vue b/src/oj/learn/index.vue
index 6e323e8..858270f 100644
--- a/src/oj/learn/index.vue
+++ b/src/oj/learn/index.vue
@@ -147,9 +147,9 @@ async function init() {
titles.value = res1.data
if (titles.value.length === 0) return
const id = titles.value[step.value - 1].id
- const [res2, exs] = await Promise.all([getTutorial(id), getExercises(id)])
- tutorial.value = res2.data
- exercises.value = exs
+ const [res2, exs] = await Promise.allSettled([getTutorial(id), getExercises(id)])
+ if (res2.status === "fulfilled") tutorial.value = res2.value.data
+ exercises.value = exs.status === "fulfilled" ? exs.value : []
}
watch(