添加挑战

This commit is contained in:
2025-04-27 20:35:16 +08:00
parent d7f33bfca2
commit dd9233a6d6
19 changed files with 344 additions and 207 deletions

1
src/pages/Challenge.vue Normal file
View File

@@ -0,0 +1 @@
<template>Dashboard Challenge</template>

View File

@@ -1,9 +1,7 @@
<template>
<n-flex class="container" :wrap="false">
<n-flex vertical class="menu">
<n-button secondary @click="$router.push({ name: 'home' })">
返回
</n-button>
<n-button secondary @click="goHome"> 返回 </n-button>
<n-button
v-for="item in menu"
:key="item.label"
@@ -19,16 +17,31 @@
</n-flex>
</template>
<script lang="ts" setup>
import { useRouter } from "vue-router"
import { taskTab } from "../store/task"
import { step } from "../store/tutorial"
import { TASK_TYPE } from "../utils/const"
const router = useRouter()
const menu = [
{
label: "教程",
route: { name: "tutorial", params: { display: step.value } },
},
{ label: "挑战", route: { name: "challenge" } },
{ label: "用户", route: { name: "user-manage", params: { page: 1 } } },
{ label: "提交", route: { name: "submissions", params: { page: 1 } } },
]
function goHome() {
const query = { task: taskTab.value } as any
if (taskTab.value === TASK_TYPE.Tutorial) query.step = step.value
router.push({
name: "home",
query,
})
}
</script>
<style scoped>
.container {

View File

@@ -6,7 +6,7 @@
max="900px"
>
<template #1>
<Tutorial @hide="hide" />
<Task @hide="hide" />
</template>
<template #2>
<n-split direction="vertical" min="200px">
@@ -24,7 +24,7 @@
import { useMagicKeys, whenever } from "@vueuse/core"
import Editors from "../components/Editors.vue"
import Preview from "../components/Preview.vue"
import Tutorial from "../components/Tutorial.vue"
import Task from "../components/Task.vue"
import { show, tutorialSize } from "../store/tutorial"
import { html, css, js } from "../store/editors"

View File

@@ -179,6 +179,7 @@ onUnmounted(() => {
id: "",
userid: 0,
username: "",
task_id: 0,
task_title: "",
task_type: "tutorial",
score: 0,