This commit is contained in:
2025-10-04 13:57:53 +08:00
parent 204bbf2d3c
commit c8751223db
7 changed files with 80 additions and 53 deletions

View File

@@ -10,7 +10,7 @@ import storage from "~/utils/storage"
import { LANGUAGE } from "~/utils/types"
import Submit from "./Submit.vue"
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
import {Icon} from "@iconify/vue"
import IconButton from "~/shared/components/IconButton.vue"
interface Props {
storageKey: string
@@ -145,11 +145,12 @@ function showStatisticsPanel() {
<n-dropdown size="large" :options="menu" @select="select">
<n-button :size="isDesktop ? 'medium' : 'small'">操作</n-button>
</n-dropdown>
<n-button circle v-if="isDesktop && userStore.isSuperAdmin" @click="goEdit">
<template #icon>
<Icon icon="streamline-ultimate-color:file-code-edit" />
</template>
</n-button>
<IconButton
icon="streamline-ultimate-color:file-code-edit"
tip="编辑题目"
v-if="isDesktop && userStore.isSuperAdmin"
@click="goEdit"
/>
</n-flex>
</n-flex>
<n-modal

View File

@@ -32,7 +32,7 @@ function filterClass() {
</template>
</n-button>
</template>
{{ "搜索" + props.type}}
{{ "搜索" + props.type }}
</n-tooltip>
<n-tooltip v-if="showFilterClass">
<template #trigger>

View File

@@ -15,7 +15,7 @@ import ButtonWithSearch from "./components/ButtonWithSearch.vue"
import StatisticsPanel from "~/shared/components/StatisticsPanel.vue"
import SubmissionLink from "./components/SubmissionLink.vue"
import SubmissionDetail from "./detail.vue"
import { Icon } from "@iconify/vue"
import IconButton from "~/shared/components/IconButton.vue"
interface SubmissionQuery {
username: string
@@ -301,11 +301,11 @@ const columns = computed(() => {
<n-form-item
v-if="userStore.isSuperAdmin && route.name === 'submissions'"
>
<n-button circle @click="toggleStatisticPanel(true)">
<template #icon>
<Icon icon="streamline-emojis:bar-chart" />
</template>
</n-button>
<IconButton
icon="streamline-emojis:bar-chart"
tip="数据统计"
@click="toggleStatisticPanel(true)"
/>
</n-form-item>
<n-form-item v-if="todayCount > 0">
<component :is="isDesktop ? NH2 : NText" class="todayCount">

View File

@@ -7,9 +7,14 @@ const hitokoto = reactive({
})
async function receive() {
const res = await getHitokoto()
hitokoto.sentence = res.data.hitokoto
hitokoto.from = res.data.from
try {
const res = await getHitokoto()
hitokoto.sentence = res.data.hitokoto
hitokoto.from = res.data.from
} catch (error) {
hitokoto.sentence = "获取一言失败,请点击重试"
hitokoto.from = "DEV"
}
}
onMounted(receive)

View 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>

View File

@@ -1,36 +1,36 @@
import {
ArcElement,
BarElement,
BarController,
CategoryScale,
Chart as ChartJS,
Colors,
Legend,
LinearScale,
LineController,
Title,
Tooltip,
LineElement,
PointElement,
} from "chart.js"
let registered = false
export function registerChart() {
if (registered) return
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
BarController,
ArcElement,
LineElement,
LineController,
PointElement,
Colors,
Title,
Tooltip,
Legend,
)
registered = true
}
import {
ArcElement,
BarElement,
BarController,
CategoryScale,
Chart as ChartJS,
Colors,
Legend,
LinearScale,
LineController,
Title,
Tooltip,
LineElement,
PointElement,
} from "chart.js"
let registered = false
export function registerChart() {
if (registered) return
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
BarController,
ArcElement,
LineElement,
LineController,
PointElement,
Colors,
Title,
Tooltip,
Legend,
)
registered = true
}

View File

@@ -118,7 +118,7 @@ export interface Problem {
difficulty: "Low" | "Mid" | "High"
source: string
prompt: string
answers: {language: LANGUAGE, code: string}[]
answers: { language: LANGUAGE; code: string }[]
total_score: number
submission_number: number
accepted_number: number