add stats
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-03-18 19:46:33 +08:00
parent 4e95a2fad0
commit 83cd62a110
5 changed files with 363 additions and 3 deletions

View File

@@ -38,6 +38,13 @@
</template>
</n-flex>
<n-flex>
<n-button
v-if="(roleAdmin || roleSuper) && taskTab === TASK_TYPE.Challenge && taskId > 0"
text
@click="statsModal = true"
>
<Icon :width="16" icon="lucide:bar-chart-2"></Icon>
</n-button>
<n-button
v-if="authed"
text
@@ -56,21 +63,24 @@
<Tutorial v-if="taskTab === TASK_TYPE.Tutorial" ref="tutorialRef" />
<Challenge v-else />
</div>
<TaskStatsModal v-model:show="statsModal" :task-id="taskId" />
</template>
<script lang="ts" setup>
import { Icon } from "@iconify/vue"
import { computed, onMounted, ref } from "vue"
import { step } from "../store/tutorial"
import { authed, roleSuper } from "../store/user"
import { taskTab, challengeDisplay } from "../store/task"
import { authed, roleAdmin, roleSuper } from "../store/user"
import { taskTab, taskId, challengeDisplay } from "../store/task"
import { useRoute, useRouter } from "vue-router"
import { TASK_TYPE } from "../utils/const"
import Challenge from "./Challenge.vue"
import Tutorial from "./Tutorial.vue"
import TaskStatsModal from "./TaskStatsModal.vue"
const route = useRoute()
const router = useRouter()
const tutorialRef = ref<InstanceType<typeof Tutorial>>()
const statsModal = ref(false)
defineEmits(["hide"])