From 0a6f6f0114d9e9ea7b1f63657428cb5215a5e86b Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 10 Jul 2024 11:27:52 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/App.vue | 2 +- ui/src/layout/components/app-main/index.vue | 5 +- .../AppLayout.vue} | 2 +- .../DetailLayout.vue} | 2 +- .../layout/layout-template/SystemLayout.vue | 53 +++++++++++++++++++ ui/src/router/modules/application.ts | 3 +- ui/src/router/modules/dataset.ts | 3 +- ui/src/router/modules/setting.ts | 2 +- ui/src/router/routes.ts | 1 - ui/src/views/authentication/index.vue | 8 +-- 10 files changed, 67 insertions(+), 14 deletions(-) rename ui/src/layout/{app-layout/index.vue => layout-template/AppLayout.vue} (95%) rename ui/src/layout/{main-layout/index.vue => layout-template/DetailLayout.vue} (90%) create mode 100644 ui/src/layout/layout-template/SystemLayout.vue diff --git a/ui/src/App.vue b/ui/src/App.vue index 3ed4b37bf..86643068a 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -1,7 +1,7 @@ diff --git a/ui/src/layout/components/app-main/index.vue b/ui/src/layout/components/app-main/index.vue index d9a3fabe5..1598772f2 100644 --- a/ui/src/layout/components/app-main/index.vue +++ b/ui/src/layout/components/app-main/index.vue @@ -2,7 +2,7 @@ - + @@ -17,8 +17,7 @@ const route = useRoute() const cachedViews: any = ref([]) onBeforeUpdate(() => { const { name, meta } = route - let isCached = meta?.cache - if (isCached && name && !cachedViews.value.includes(name)) { + if (name && !cachedViews.value.includes(name)) { cachedViews.value.push(name) } }) diff --git a/ui/src/layout/app-layout/index.vue b/ui/src/layout/layout-template/AppLayout.vue similarity index 95% rename from ui/src/layout/app-layout/index.vue rename to ui/src/layout/layout-template/AppLayout.vue index 98c3f8019..f47a0b80a 100644 --- a/ui/src/layout/app-layout/index.vue +++ b/ui/src/layout/layout-template/AppLayout.vue @@ -12,7 +12,7 @@ import { TopBar, AppMain } from '../components' - diff --git a/ui/src/router/modules/application.ts b/ui/src/router/modules/application.ts index b5f2822e1..366f49ac8 100644 --- a/ui/src/router/modules/application.ts +++ b/ui/src/router/modules/application.ts @@ -1,9 +1,10 @@ -import Layout from '@/layout/main-layout/index.vue' +import Layout from '@/layout/layout-template/DetailLayout.vue' const applicationRouter = { path: '/application', name: 'application', meta: { title: '应用', permission: 'APPLICATION:READ' }, redirect: '/application', + component: () => import('@/layout/layout-template/AppLayout.vue'), children: [ { path: '/application', diff --git a/ui/src/router/modules/dataset.ts b/ui/src/router/modules/dataset.ts index abc8a5406..05177edd2 100644 --- a/ui/src/router/modules/dataset.ts +++ b/ui/src/router/modules/dataset.ts @@ -1,8 +1,9 @@ -import Layout from '@/layout/main-layout/index.vue' +import Layout from '@/layout/layout-template/DetailLayout.vue' const datasetRouter = { path: '/dataset', name: 'dataset', meta: { title: '知识库', permission: 'DATASET:READ' }, + component: () => import('@/layout/layout-template/AppLayout.vue'), redirect: '/dataset', children: [ { diff --git a/ui/src/router/modules/setting.ts b/ui/src/router/modules/setting.ts index f9dd1e460..417bf0f59 100644 --- a/ui/src/router/modules/setting.ts +++ b/ui/src/router/modules/setting.ts @@ -1,5 +1,5 @@ import { hasPermission } from '@/utils/permission/index' -import Layout from '@/layout/main-layout/index.vue' +import Layout from '@/layout/layout-template/SystemLayout.vue' import { Role } from '@/utils/permission/type' const settingRouter = { path: '/setting', diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index b865da0f5..82ddb0596 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -8,7 +8,6 @@ export const routes: Array = [ { path: '/', name: 'home', - component: () => import('@/layout/app-layout/index.vue'), redirect: '/application', children: [...rolesRoutes] }, diff --git a/ui/src/views/authentication/index.vue b/ui/src/views/authentication/index.vue index 2a424951a..a4a84f67a 100644 --- a/ui/src/views/authentication/index.vue +++ b/ui/src/views/authentication/index.vue @@ -5,11 +5,11 @@