跳转到首页

This commit is contained in:
xuyue committed 2025-04-28 09:28:41 +08:00
1 parent 69c3a36957
commit 4beab17b70
7 files changed
+52 -50

No files matched your search

+4 -14
View File
@@ -1,7 +1,9 @@
<template>
<n-flex class="container" :wrap="false">
<n-flex vertical class="menu">
<n-button secondary @click="goHome">返回</n-button>
<n-button secondary @click="() => goHome($router, taskTab, step)">
返回
</n-button>
<n-button
v-for="item in menu"
:key="item.label"
@@ -17,12 +19,9 @@
</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()
import { goHome } from "../utils/helper"
const menu = [
{
@@ -33,15 +32,6 @@ const menu = [
{ 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 {