diff --git a/apps/client/store/statement.ts b/apps/client/store/statement.ts index cf4407367..b9e89c3b0 100644 --- a/apps/client/store/statement.ts +++ b/apps/client/store/statement.ts @@ -16,7 +16,14 @@ const statementIndex = ref(0); export function useStatement() { function setupStatement(course: Ref) { - statementIndex.value = course.value!.statementIndex || 0; + // 课程的 statement 会被删除, + // 如果记录的 statementIndex 所对应的 statement 被删除了 + // 那么默认返回第一个 statement + if (course.value!.statementIndex >= course.value!.statements.length) { + statementIndex.value = 0; + } else { + statementIndex.value = course.value!.statementIndex || 0; + } const debouncedSaveProgress = debounce(() => { saveProgress();