fix
This commit is contained in:
@@ -185,7 +185,7 @@ onMounted(() => {
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
v-if="userStore.isSuperAdmin"
|
||||
v-if="userStore.isTeacherOrAbove"
|
||||
:size="buttonSize"
|
||||
@click="statisticPanel = true"
|
||||
>
|
||||
@@ -247,7 +247,7 @@ onMounted(() => {
|
||||
</n-flex>
|
||||
|
||||
<n-modal
|
||||
v-if="userStore.isSuperAdmin"
|
||||
v-if="userStore.isTeacherOrAbove"
|
||||
v-model:show="statisticPanel"
|
||||
preset="card"
|
||||
title="提交记录的统计"
|
||||
|
||||
@@ -260,7 +260,7 @@ const columns = computed(() => {
|
||||
),
|
||||
},
|
||||
]
|
||||
if (!route.params.contestID && userStore.isSuperAdmin) {
|
||||
if (!route.params.contestID && userStore.isTeacherOrAbove) {
|
||||
res.push({
|
||||
title: renderTableTitle("选项", "streamline-emojis:wrench"),
|
||||
key: "rejudge",
|
||||
@@ -399,7 +399,7 @@ const flowchartColumns: DataTableColumn<FlowchartSubmissionListItem>[] = [
|
||||
<n-button @click="clear" quaternary>重置</n-button>
|
||||
</n-form-item>
|
||||
<n-form-item
|
||||
v-if="userStore.isSuperAdmin && route.name === 'submissions'"
|
||||
v-if="userStore.isTeacherOrAbove && route.name === 'submissions'"
|
||||
>
|
||||
<n-button
|
||||
quaternary
|
||||
@@ -443,7 +443,7 @@ const flowchartColumns: DataTableColumn<FlowchartSubmissionListItem>[] = [
|
||||
v-model:page="query.page"
|
||||
/>
|
||||
<n-modal
|
||||
v-if="userStore.isSuperAdmin"
|
||||
v-if="userStore.isTeacherOrAbove"
|
||||
v-model:show="statisticPanel"
|
||||
preset="card"
|
||||
:style="{ maxWidth: isDesktop && '800px', maxHeight: '80vh' }"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import axios from "axios"
|
||||
import { createDiscreteApi } from "naive-ui"
|
||||
import { useAuthModalStore } from "shared/store/authModal"
|
||||
import storage from "./storage"
|
||||
import { STORAGE_KEY } from "./constants"
|
||||
|
||||
const { message } = createDiscreteApi(["message"])
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: "/api",
|
||||
xsrfHeaderName: "X-CSRFToken",
|
||||
@@ -12,9 +15,11 @@ const http = axios.create({
|
||||
http.interceptors.response.use(
|
||||
(res) => {
|
||||
if (res.data.error) {
|
||||
if (res.data.data && res.data.data.startsWith("Please login")) {
|
||||
if (res.data.error === "login-required") {
|
||||
storage.remove(STORAGE_KEY.AUTHED)
|
||||
useAuthModalStore().openLoginModal()
|
||||
} else if (res.data.error === "permission-denied") {
|
||||
message.error(res.data.data || "权限不足")
|
||||
}
|
||||
return Promise.reject(res.data)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user