隐藏所有提交
This commit is contained in:
@@ -198,7 +198,7 @@ onMounted(() => {
|
|||||||
<n-switch v-model:value="websiteConfig.allow_register" />
|
<n-switch v-model:value="websiteConfig.allow_register" />
|
||||||
</n-flex>
|
</n-flex>
|
||||||
<n-flex align="center">
|
<n-flex align="center">
|
||||||
<span>显示全部题目的提交</span>
|
<span>显示所有提交</span>
|
||||||
<n-switch v-model:value="websiteConfig.submission_list_show_all" />
|
<n-switch v-model:value="websiteConfig.submission_list_show_all" />
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import { NButton } from "naive-ui"
|
|||||||
import { getSubmissions } from "~/oj/api"
|
import { getSubmissions } from "~/oj/api"
|
||||||
import Pagination from "~/shared/components/Pagination.vue"
|
import Pagination from "~/shared/components/Pagination.vue"
|
||||||
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
|
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
|
||||||
|
import { useConfigStore } from "~/shared/store/config"
|
||||||
import { useUserStore } from "~/shared/store/user"
|
import { useUserStore } from "~/shared/store/user"
|
||||||
import { LANGUAGE_SHOW_VALUE } from "~/utils/constants"
|
import { LANGUAGE_SHOW_VALUE } from "~/utils/constants"
|
||||||
import { parseTime } from "~/utils/functions"
|
import { parseTime } from "~/utils/functions"
|
||||||
import { renderTableTitle } from "~/utils/renders"
|
import { renderTableTitle } from "~/utils/renders"
|
||||||
import { Submission } from "~/utils/types"
|
import { Submission } from "~/utils/types"
|
||||||
|
|
||||||
|
const configStore = useConfigStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -67,6 +69,18 @@ const query = reactive({
|
|||||||
page: 1,
|
page: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const showList = computed(() => {
|
||||||
|
if (!userStore.isAuthed) return false
|
||||||
|
else if (userStore.isSuperAdmin) return true
|
||||||
|
else return configStore.config.submission_list_show_all
|
||||||
|
})
|
||||||
|
|
||||||
|
const errorMsg = computed(() => {
|
||||||
|
if (!userStore.isAuthed) return "请先登录"
|
||||||
|
else if (!configStore.config.submission_list_show_all) return "不让看了"
|
||||||
|
else return ""
|
||||||
|
})
|
||||||
|
|
||||||
async function listSubmissions() {
|
async function listSubmissions() {
|
||||||
const offset = query.limit * (query.page - 1)
|
const offset = query.limit * (query.page - 1)
|
||||||
const res = await getSubmissions({
|
const res = await getSubmissions({
|
||||||
@@ -83,17 +97,13 @@ onMounted(listSubmissions)
|
|||||||
watch(query, listSubmissions)
|
watch(query, listSubmissions)
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<n-data-table
|
<n-alert type="error" v-if="!showList" :title="errorMsg" />
|
||||||
v-if="userStore.isAuthed"
|
<template v-else>
|
||||||
striped
|
<n-data-table striped :columns="columns" :data="submissions" />
|
||||||
:columns="columns"
|
|
||||||
:data="submissions"
|
|
||||||
/>
|
|
||||||
<Pagination
|
<Pagination
|
||||||
v-if="userStore.isAuthed"
|
|
||||||
:total="total"
|
:total="total"
|
||||||
v-model:limit="query.limit"
|
v-model:limit="query.limit"
|
||||||
v-model:page="query.page"
|
v-model:page="query.page"
|
||||||
/>
|
/>
|
||||||
<n-alert type="error" v-if="!userStore.isAuthed" title="请先登录" />
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,7 +2,15 @@ import { getWebsiteConfig } from "~/oj/api"
|
|||||||
import { WebsiteConfig } from "~/utils/types"
|
import { WebsiteConfig } from "~/utils/types"
|
||||||
|
|
||||||
export const useConfigStore = defineStore("config", () => {
|
export const useConfigStore = defineStore("config", () => {
|
||||||
const config = ref<WebsiteConfig>()
|
const config = ref<WebsiteConfig>({
|
||||||
|
website_base_url: "",
|
||||||
|
website_name: "",
|
||||||
|
website_name_shortcut: "",
|
||||||
|
website_footer: "",
|
||||||
|
submission_list_show_all: true,
|
||||||
|
allow_register: true,
|
||||||
|
class_list: [],
|
||||||
|
})
|
||||||
async function getConfig() {
|
async function getConfig() {
|
||||||
const res = await getWebsiteConfig()
|
const res = await getWebsiteConfig()
|
||||||
config.value = res.data
|
config.value = res.data
|
||||||
|
|||||||
Reference in New Issue
Block a user