fix
Some checks failed
Deploy / deploy (build, debian, 22) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822) (push) Has been cancelled

This commit is contained in:
2026-04-01 05:17:53 -06:00
parent 501f314aff
commit 7f0bfd67fa
2 changed files with 14 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ import { marked } from "marked"
import copyFn from "copy-text-to-clipboard"
import { css, html, js, tab } from "../../store/editors"
import { Tutorial } from "../../api"
import { step, tutorialIds } from "../../store/tutorial"
import { step, tutorialIds, loadTutorials } from "../../store/tutorial"
import { taskId } from "../../store/task"
import { useRouter } from "vue-router"
@@ -36,17 +36,6 @@ const router = useRouter()
const content = ref("")
const $content = useTemplateRef<any>("$content")
async function prepare() {
tutorialIds.value = await Tutorial.listDisplay()
if (!tutorialIds.value.length) {
content.value = "暂无教程"
return
}
if (!tutorialIds.value.includes(step.value)) {
step.value = tutorialIds.value[0] as number
}
}
async function render() {
const data = await Tutorial.get(step.value)
taskId.value = data.task_ptr
@@ -85,7 +74,11 @@ function setupCodeActions() {
}
async function init() {
await prepare()
await loadTutorials()
if (!tutorialIds.value.length) {
content.value = "暂无教程"
return
}
render()
}