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