update
This commit is contained in:
@@ -10,7 +10,7 @@ import storage from "~/utils/storage"
|
|||||||
import { LANGUAGE } from "~/utils/types"
|
import { LANGUAGE } from "~/utils/types"
|
||||||
import Submit from "./Submit.vue"
|
import Submit from "./Submit.vue"
|
||||||
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
|
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
|
||||||
import {Icon} from "@iconify/vue"
|
import IconButton from "~/shared/components/IconButton.vue"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
storageKey: string
|
storageKey: string
|
||||||
@@ -145,11 +145,12 @@ function showStatisticsPanel() {
|
|||||||
<n-dropdown size="large" :options="menu" @select="select">
|
<n-dropdown size="large" :options="menu" @select="select">
|
||||||
<n-button :size="isDesktop ? 'medium' : 'small'">操作</n-button>
|
<n-button :size="isDesktop ? 'medium' : 'small'">操作</n-button>
|
||||||
</n-dropdown>
|
</n-dropdown>
|
||||||
<n-button circle v-if="isDesktop && userStore.isSuperAdmin" @click="goEdit">
|
<IconButton
|
||||||
<template #icon>
|
icon="streamline-ultimate-color:file-code-edit"
|
||||||
<Icon icon="streamline-ultimate-color:file-code-edit" />
|
tip="编辑题目"
|
||||||
</template>
|
v-if="isDesktop && userStore.isSuperAdmin"
|
||||||
</n-button>
|
@click="goEdit"
|
||||||
|
/>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
<n-modal
|
<n-modal
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function filterClass() {
|
|||||||
</template>
|
</template>
|
||||||
</n-button>
|
</n-button>
|
||||||
</template>
|
</template>
|
||||||
{{ "搜索" + props.type}}
|
{{ "搜索" + props.type }}
|
||||||
</n-tooltip>
|
</n-tooltip>
|
||||||
<n-tooltip v-if="showFilterClass">
|
<n-tooltip v-if="showFilterClass">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import ButtonWithSearch from "./components/ButtonWithSearch.vue"
|
|||||||
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
|
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
|
||||||
import SubmissionLink from "./components/SubmissionLink.vue"
|
import SubmissionLink from "./components/SubmissionLink.vue"
|
||||||
import SubmissionDetail from "./detail.vue"
|
import SubmissionDetail from "./detail.vue"
|
||||||
import { Icon } from "@iconify/vue"
|
import IconButton from "~/shared/components/IconButton.vue"
|
||||||
|
|
||||||
interface SubmissionQuery {
|
interface SubmissionQuery {
|
||||||
username: string
|
username: string
|
||||||
@@ -301,11 +301,11 @@ const columns = computed(() => {
|
|||||||
<n-form-item
|
<n-form-item
|
||||||
v-if="userStore.isSuperAdmin && route.name === 'submissions'"
|
v-if="userStore.isSuperAdmin && route.name === 'submissions'"
|
||||||
>
|
>
|
||||||
<n-button circle @click="toggleStatisticPanel(true)">
|
<IconButton
|
||||||
<template #icon>
|
icon="streamline-emojis:bar-chart"
|
||||||
<Icon icon="streamline-emojis:bar-chart" />
|
tip="数据统计"
|
||||||
</template>
|
@click="toggleStatisticPanel(true)"
|
||||||
</n-button>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item v-if="todayCount > 0">
|
<n-form-item v-if="todayCount > 0">
|
||||||
<component :is="isDesktop ? NH2 : NText" class="todayCount">
|
<component :is="isDesktop ? NH2 : NText" class="todayCount">
|
||||||
|
|||||||
@@ -7,9 +7,14 @@ const hitokoto = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function receive() {
|
async function receive() {
|
||||||
const res = await getHitokoto()
|
try {
|
||||||
hitokoto.sentence = res.data.hitokoto
|
const res = await getHitokoto()
|
||||||
hitokoto.from = res.data.from
|
hitokoto.sentence = res.data.hitokoto
|
||||||
|
hitokoto.from = res.data.from
|
||||||
|
} catch (error) {
|
||||||
|
hitokoto.sentence = "获取一言失败,请点击重试"
|
||||||
|
hitokoto.from = "DEV"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(receive)
|
onMounted(receive)
|
||||||
|
|||||||
21
src/shared/components/IconButton.vue
Normal file
21
src/shared/components/IconButton.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<n-tooltip>
|
||||||
|
<template #trigger>
|
||||||
|
<n-button circle @click="$emit('click')">
|
||||||
|
<template #icon>
|
||||||
|
<Icon :icon="icon" />
|
||||||
|
</template>
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
{{ tip }}
|
||||||
|
</n-tooltip>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { Icon } from "@iconify/vue"
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
tip: string
|
||||||
|
icon: string
|
||||||
|
}>()
|
||||||
|
defineEmits(["click"])
|
||||||
|
</script>
|
||||||
@@ -1,36 +1,36 @@
|
|||||||
import {
|
import {
|
||||||
ArcElement,
|
ArcElement,
|
||||||
BarElement,
|
BarElement,
|
||||||
BarController,
|
BarController,
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
Chart as ChartJS,
|
Chart as ChartJS,
|
||||||
Colors,
|
Colors,
|
||||||
Legend,
|
Legend,
|
||||||
LinearScale,
|
LinearScale,
|
||||||
LineController,
|
LineController,
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
LineElement,
|
LineElement,
|
||||||
PointElement,
|
PointElement,
|
||||||
} from "chart.js"
|
} from "chart.js"
|
||||||
|
|
||||||
let registered = false
|
let registered = false
|
||||||
|
|
||||||
export function registerChart() {
|
export function registerChart() {
|
||||||
if (registered) return
|
if (registered) return
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
LinearScale,
|
LinearScale,
|
||||||
BarElement,
|
BarElement,
|
||||||
BarController,
|
BarController,
|
||||||
ArcElement,
|
ArcElement,
|
||||||
LineElement,
|
LineElement,
|
||||||
LineController,
|
LineController,
|
||||||
PointElement,
|
PointElement,
|
||||||
Colors,
|
Colors,
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend,
|
||||||
)
|
)
|
||||||
registered = true
|
registered = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export interface Problem {
|
|||||||
difficulty: "Low" | "Mid" | "High"
|
difficulty: "Low" | "Mid" | "High"
|
||||||
source: string
|
source: string
|
||||||
prompt: string
|
prompt: string
|
||||||
answers: {language: LANGUAGE, code: string}[]
|
answers: { language: LANGUAGE; code: string }[]
|
||||||
total_score: number
|
total_score: number
|
||||||
submission_number: number
|
submission_number: number
|
||||||
accepted_number: number
|
accepted_number: number
|
||||||
|
|||||||
Reference in New Issue
Block a user