diff --git a/src/api/system.ts b/src/api/system.ts index 5a64ee3..85084b4 100644 --- a/src/api/system.ts +++ b/src/api/system.ts @@ -17,3 +17,4 @@ export const editExperimentalData = async (data: Record): Promise): Promise => (await axios.get('/python/python/getStartTime', { params })).data; export const getCurrentTime = async (): Promise => (await axios.get('/competition/competition/management/getCurrentTime')).data; export const heartbeatDetection = async (): Promise => (await axios.get('/nakadai/message/heartbeatDetection')).data; +export const initData = async (data: Record): Promise => (await axios.post(`/product/product/bank/operation/initData`, data)).data; diff --git a/src/api/user.ts b/src/api/user.ts deleted file mode 100644 index 38a389c..0000000 --- a/src/api/user.ts +++ /dev/null @@ -1,31 +0,0 @@ -import axios from '@/utils/request'; - -export const queryOrgList = async (params?: Record): Promise => (await axios.get('/backend/core/org', { params })).data; -export const queryOrg = async (id: number): Promise => (await axios.get(`/backend/core/org/${id}`)).data; -export const createOrg = async (data: Record): Promise => (await axios.post('/backend/core/org', data)).data; -export const updateOrg = async (data: Record): Promise => (await axios.post('/backend/core/org?_method=put', data)).data; -export const updateOrgOrder = async (data: number[]): Promise => (await axios.post('/backend/core/org/order?_method=put', data)).data; -export const deleteOrg = async (data: number[]): Promise => (await axios.post('/backend/core/org?_method=delete', data)).data; - -export const queryRoleList = async (params?: Record): Promise => (await axios.get('/backend/core/role', { params })).data; -export const queryRole = async (id: number): Promise => (await axios.get(`/backend/core/role/${id}`)).data; -export const createRole = async (data: Record): Promise => (await axios.post('/backend/core/role', data)).data; -export const updateRole = async (data: Record): Promise => (await axios.post('/backend/core/role?_method=put', data)).data; -export const updateRoleOrder = async (data: number[]): Promise => (await axios.post('/backend/core/role/order?_method=put', data)).data; -export const deleteRole = async (data: number[]): Promise => (await axios.post('/backend/core/role?_method=delete', data)).data; - -export const queryGroupList = async (params?: Record): Promise => (await axios.get('/backend/core/group', { params })).data; -export const queryGroup = async (id: number): Promise => (await axios.get(`/backend/core/group/${id}`)).data; -export const createGroup = async (data: Record): Promise => (await axios.post('/backend/core/group', data)).data; -export const updateGroup = async (data: Record): Promise => (await axios.post('/backend/core/group?_method=put', data)).data; -export const updateGroupOrder = async (data: number[]): Promise => (await axios.post('/backend/core/group/order?_method=put', data)).data; -export const deleteGroup = async (data: number[]): Promise => (await axios.post('/backend/core/group?_method=delete', data)).data; - -export const queryUserPage = async (params?: Record): Promise => (await axios.get('/backend/core/user', { params })).data; -export const queryUser = async (id: number): Promise => (await axios.get(`/backend/core/user/${id}`)).data; -export const createUser = async (data: Record): Promise => (await axios.post('/backend/core/user', data)).data; -export const updateUser = async (data: Record): Promise => (await axios.post('/backend/core/user?_method=put', data)).data; -export const deleteUser = async (data: number[]): Promise => (await axios.post('/backend/core/user?_method=delete', data)).data; -export const usernameValidation = async (username?: string): Promise => (await axios.get('/backend/core/user/username-validation', { params: { username } })).data; -export const emailValidation = async (email?: string): Promise => (await axios.get('/backend/core/user/email-validation', { params: { email } })).data; -export const mobileValidation = async (mobile?: string): Promise => (await axios.get('/backend/core/user/mobile-validation', { params: { mobile } })).data; diff --git a/src/components/Panel/index.vue b/src/components/Panel/index.vue index 2ff7b12..d80fa6e 100644 --- a/src/components/Panel/index.vue +++ b/src/components/Panel/index.vue @@ -224,7 +224,7 @@ import { ref, reactive, onMounted, inject, computed, watch, onUnmounted } from 'vue'; import { submitOpe } from '@/api/bank'; import { getSandTableLastCache, deleteOperationData } from '@/api/judgment'; -import { getProjectBySystemId, getProjectDetail, getDetailById, getCompetition, getStartTime, heartbeatDetection } from '@/api/system'; +import { getProjectBySystemId, getProjectDetail, getDetailById, getCompetition, getStartTime, heartbeatDetection, initData } from '@/api/system'; import Settings from '@/settings'; import { useRouter, useRoute, beforeRouteLeave } from 'vue-router'; import type { Action } from 'element-plus'; @@ -493,8 +493,18 @@ let setNewProject = (reloadPage?: number) => { } } }; +// 初始化数据 +const initBuiltInData = async () => { + await initData({ + assessmentId: param.assessmentId, + cid: param.cid, + competitionId: param.competitionId, + projectId: param.projectId, + }); +}; // 项目选择回调 let getCache = async (reloadPage?: number) => { + initBuiltInData(); // 查询该项目是否有缓存记录 const res = await getSandTableLastCache({ cid: param.cid, diff --git a/src/utils/auth.ts b/src/utils/auth.ts index c785dc9..a09fcb3 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -24,6 +24,7 @@ export const removeParam = (): void => { Cookies.remove('sand-systemId'); Cookies.remove('sand-level'); Cookies.remove('sand-submit'); + Cookies.remove('sand-loaded'); }; export const getAuthHeaders = (): any => { diff --git a/src/utils/request.ts b/src/utils/request.ts index df8fa2f..f0163f1 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -23,7 +23,8 @@ service.interceptors.response.use( if (status === 200) { return res; } - message === '无缓存' || ElMessage.error(message); + + ElMessage.error(message); } else { return res; } diff --git a/src/views/Home.vue b/src/views/Home.vue index b955052..654ca9d 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -129,9 +129,7 @@ const move = (dir: string) => { if (dir === 'up' || dir === 'down') param.top = el.scrollTop + (dir === 'up' ? -150 : 150); el.scrollTo(param); }; -onMounted(() => { - getLevel(); -}); +onMounted(getLevel);