From e2fe633b28a7d3fee556cb3b494ee0222131626c Mon Sep 17 00:00:00 2001 From: ygx Date: Sun, 25 Jan 2026 17:31:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axios.ts | 10 +++++++--- src/enums/pageEnum.ts | 4 ++++ src/router/modules/project.router.ts | 9 +++++++++ src/utils/router.ts | 3 ++- .../ProjectItemsList/hooks/useData.hook.ts | 17 +++++++++++------ .../items/components/ProjectItemsList/index.vue | 9 +++++++-- src/views/project/items/index.vue | 10 ++++++++-- 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/api/axios.ts b/src/api/axios.ts index 1ab9941..b3a7166 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -78,8 +78,11 @@ axiosInstance.interceptors.response.use( // 登录过期 if (code === ResultEnum.TOKEN_OVERDUE) { window['$message'].error(window['$t']('http.token_overdue_message')) - // iframe 嵌入模式下,token 过期不重定向到登录页 - console.error('[GoView] iframe 模式:token 已过期,请更新 URL 中的 token 参数') + // token 过期,跳转到源站首页 + console.error('[GoView] token 已过期,即将跳转到源站首页') + setTimeout(() => { + window.location.href = window.location.origin + }, 1500) return Promise.resolve(responseData) } @@ -97,7 +100,8 @@ axiosInstance.interceptors.response.use( const status = err.response?.status switch (status) { case 401: - routerTurnByName(PageEnum.BASE_LOGIN_NAME) + // token 失效,跳转到源站首页 + window.location.href = window.location.origin Promise.reject(err) break diff --git a/src/enums/pageEnum.ts b/src/enums/pageEnum.ts index 609e3f3..a08731f 100644 --- a/src/enums/pageEnum.ts +++ b/src/enums/pageEnum.ts @@ -43,6 +43,10 @@ export enum PageEnum { BASE_HOME_ITEMS = '/project/items', BASE_HOME_ITEMS_NAME = 'Project-Items', + // 项目管理 + BASE_HOME_MANAGEMENT = '/project/management', + BASE_HOME_MANAGEMENT_NAME = 'Project-Management', + // 我的模板 BASE_HOME_TEMPLATE = '/project/my-template', BASE_HOME_TEMPLATE_NAME = 'Project-My-Template', diff --git a/src/router/modules/project.router.ts b/src/router/modules/project.router.ts index 45f51f1..cc6b6ae 100644 --- a/src/router/modules/project.router.ts +++ b/src/router/modules/project.router.ts @@ -5,6 +5,7 @@ import { PageEnum } from '@/enums/pageEnum' const importPath = { 'PageEnum.BASE_HOME_NAME': () => import('@/views/project/index.vue'), 'PageEnum.BASE_HOME_ITEMS_NAME': () => import('@/views/project/items/index.vue'), + 'PageEnum.BASE_HOME_MANAGEMENT_NAME': () => import('@/views/project/items/index.vue'), 'PageEnum.BASE_HOME_TEMPLATE_NAME': () => import('@/views/project/mtTemplate/index.vue'), 'PageEnum.BASE_HOME_TEMPLATE_MARKET_NAME': () => import('@/views/project/templateMarket/index.vue') } @@ -27,6 +28,14 @@ const projectRoutes: RouteRecordRaw = { title: '我的项目' } }, + { + path: PageEnum.BASE_HOME_MANAGEMENT, + name: PageEnum.BASE_HOME_MANAGEMENT_NAME, + component: importPath['PageEnum.BASE_HOME_MANAGEMENT_NAME'], + meta: { + title: '项目管理' + } + }, { path: PageEnum.BASE_HOME_TEMPLATE, name: PageEnum.BASE_HOME_TEMPLATE_NAME, diff --git a/src/utils/router.ts b/src/utils/router.ts index 623ce64..ca8a965 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -111,7 +111,8 @@ export const logout = async () => { window['$message'].success(window['$t']('global.logout_success')) clearCookie(RequestHttpHeaderEnum.COOKIE) clearLocalStorage(StorageEnum.GO_SYSTEM_STORE) - routerTurnByName(PageEnum.BASE_LOGIN_NAME) + // 退出登录后跳转到源站首页 + window.location.href = window.location.origin } } catch (error) { window['$message'].success(window['$t']('global.logout_failure')) diff --git a/src/views/project/items/components/ProjectItemsList/hooks/useData.hook.ts b/src/views/project/items/components/ProjectItemsList/hooks/useData.hook.ts index 0dde139..86aa232 100644 --- a/src/views/project/items/components/ProjectItemsList/hooks/useData.hook.ts +++ b/src/views/project/items/components/ProjectItemsList/hooks/useData.hook.ts @@ -6,16 +6,16 @@ import { Chartype, ChartList } from '../../../index.d' import { ResultEnum } from '@/enums/httpEnum' // 数据初始化 -export const useDataListInit = () => { +export const useDataListInit = (filterState?: number) => { const loading = ref(true) const paginat = reactive({ // 当前页数 page: 1, // 每页值 - limit: 10, + limit: 12, // 总数 - count: 10 + count: 0 }) const list = ref([]) @@ -23,13 +23,18 @@ export const useDataListInit = () => { // 数据请求 const fetchList = async () => { loading.value = true - const { code, data }: any = await projectListApi({ + const params: any = { page: paginat.page, size: paginat.limit - }) + } + // 如果有 filterState 参数,添加到请求中 + if (filterState !== undefined) { + params.state = filterState + } + const { code, data }: any = await projectListApi(params) if (code === 0) { paginat.count = data.total - list.value = (data.list).map(e => { + list.value = (data.list).map((e: any) => { const { identity, projectName, state, createTime, indexImage, createUserId, backgroundImage } = e return { identity: identity, diff --git a/src/views/project/items/components/ProjectItemsList/index.vue b/src/views/project/items/components/ProjectItemsList/index.vue index 81aea4d..71bac35 100644 --- a/src/views/project/items/components/ProjectItemsList/index.vue +++ b/src/views/project/items/components/ProjectItemsList/index.vue @@ -7,7 +7,7 @@
- + () + const { CopyIcon, EllipsisHorizontalCircleSharpIcon } = icon.ionicons5 const { modalData, modalShow, closeModal, previewHandle, resizeHandle, editHandle } = useModalDataInit() -const { loading, paginat, list, changeSize, changePage, releaseHandle, deleteHandle } = useDataListInit() +const { loading, paginat, list, changeSize, changePage, releaseHandle, deleteHandle } = useDataListInit(props.filterState)