This commit is contained in:
25
src/oj/submission/components/FlowchartLink.vue
Normal file
25
src/oj/submission/components/FlowchartLink.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<n-button v-if="showLink" type="info" text @click="goto">
|
||||
{{ flowchart.id.slice(0, 12) }}
|
||||
</n-button>
|
||||
<n-text v-else>{{ flowchart.id.slice(0, 12) }}</n-text>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useUserStore } from "shared/store/user"
|
||||
import { FlowchartSubmissionListItem } from "utils/types"
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
interface Props {
|
||||
flowchart: FlowchartSubmissionListItem
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const showLink = computed(() => {
|
||||
if (!userStore.isAuthed) return false
|
||||
if (userStore.isSuperAdmin) return true
|
||||
return props.flowchart.username === userStore.user?.username
|
||||
})
|
||||
|
||||
function goto() {}
|
||||
</script>
|
||||
25
src/oj/submission/components/Grade.vue
Normal file
25
src/oj/submission/components/Grade.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<n-text :type="gradeType(grade)">
|
||||
<span>{{ score }}</span>
|
||||
<span>({{ grade }})</span>
|
||||
</n-text>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Grade } from "utils/types"
|
||||
defineProps<{
|
||||
score: number
|
||||
grade: Grade
|
||||
}>()
|
||||
|
||||
function gradeType(grade: Grade) {
|
||||
return (
|
||||
{
|
||||
S: "success",
|
||||
A: "info",
|
||||
B: "warning",
|
||||
C: "error",
|
||||
} as const
|
||||
)[grade]
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user