From c32e27b025b17895c1b0bfd0b957cdc8709f6c17 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Sun, 24 Mar 2024 17:10:32 +0800 Subject: [PATCH] [Page] [Layout] Support navigation external link --- src/data/Navigation.ts | 33 ++++++++++--------- src/i18n/langs/en/Common.ts | 5 ++- src/i18n/langs/zhCn/Common.ts | 7 ++-- src/model/Navigation.ts | 3 +- .../components/LanguageSwitcher.vue | 4 +-- .../components/NavigationClosed.vue | 8 +++-- .../components/components/NavigationItem.vue | 8 +++-- .../components/NavigationOpened.vue | 7 ++-- .../components/NavigationRouterLink.vue | 24 ++++++++++++++ 9 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 src/views/layouts/base/components/components/NavigationRouterLink.vue diff --git a/src/data/Navigation.ts b/src/data/Navigation.ts index 0486a607..086d618e 100644 --- a/src/data/Navigation.ts +++ b/src/data/Navigation.ts @@ -1,7 +1,6 @@ import { NavigationModel, NavigationPosition } from '@/model/Navigation' import NavigationService from '@/services/Navigation' import { Home, LogIn, LogOut } from 'lucide-vue-next' -import { cloneDeep } from 'lodash' const createNavigation = (): void => { NavigationService.addNavigation(createNavigationItem('common.common.home', undefined, '/home', Home, NavigationPosition.LEFT_TOP)) @@ -17,24 +16,27 @@ const createNavigation = (): void => { [], 'common.common.home', undefined)) - const newSignIn = cloneDeep(signIn) - newSignIn.position = NavigationPosition.TOP - newSignIn.description = 'user.tip.signIn' - const newSignUp = cloneDeep(signUp) - newSignUp.position = NavigationPosition.TOP - newSignUp.description = 'user.tip.signUp' - const children = [newSignIn, newSignUp] - NavigationService.addNavigation(createNavigationItem('common.common.home', + + const datacap = createNavigationItem('common.common.datacap', undefined, - '/home', + 'https://datacap.edurt.io', undefined, NavigationPosition.TOP, - children, - 'common.common.home', - undefined)) + undefined + , undefined, + 'common.tip.datacap', + true) + const openProject = createNavigationItem('common.common.openProject', + undefined, + '/open-project', + undefined, + NavigationPosition.TOP, + [datacap], + 'common.common.openProject') + NavigationService.addNavigation(openProject) } -const createNavigationItem = (title?: string, label?: string, href?: string, icon?: any, position?: NavigationPosition, children?: NavigationModel[], group?: string, description?: string): NavigationModel => { +const createNavigationItem = (title?: string, label?: string, href?: string, icon?: any, position?: NavigationPosition, children?: NavigationModel[], group?: string, description?: string, blank?: boolean): NavigationModel => { return { title: title, label: label, @@ -43,7 +45,8 @@ const createNavigationItem = (title?: string, label?: string, href?: string, ico position: position, group: group, description: description, - children: children + children: children, + external: blank } } diff --git a/src/i18n/langs/en/Common.ts b/src/i18n/langs/en/Common.ts index 5a0e9687..9d244a18 100644 --- a/src/i18n/langs/en/Common.ts +++ b/src/i18n/langs/en/Common.ts @@ -11,6 +11,8 @@ export default { sendEmail: 'Send Email', logout: 'Logout', codeMirror: 'Code Mirror', + openProject: 'Open Project', + datacap: 'DataCap' }, tip: { signInInfo: 'Enter your information to sign in to your account.', @@ -19,6 +21,7 @@ export default { signUpInfo: 'Enter your information to create an account.', signUpHasAccount: 'Already have an account?', forgotPasswordInfo: 'Enter your registered email and we will send you a link to reset your password.', - inputAnyInfo: 'Enter your username and password at will' + inputAnyInfo: 'Enter your username and password at will', + datacap: 'DataCap is integrated software for data transformation, integration, and visualization. Support a variety of data sources, file types, big data related database, relational database, NoSQL database, etc. Through the software can realize the management of multiple data sources, the data under the source of various operations conversion, making data charts, monitoring data sources and other functions.' } } \ No newline at end of file diff --git a/src/i18n/langs/zhCn/Common.ts b/src/i18n/langs/zhCn/Common.ts index 72d53b8f..52c23293 100644 --- a/src/i18n/langs/zhCn/Common.ts +++ b/src/i18n/langs/zhCn/Common.ts @@ -10,7 +10,9 @@ export default { forgotPassword: '忘记密码', sendEmail: '发送邮件', logout: '退出', - codeMirror: '代码仓库' + codeMirror: '代码仓库', + openProject: '开源项目', + datacap: 'DataCap' }, tip: { signInInfo: '输入您的信息以登录您的帐户。', @@ -19,6 +21,7 @@ export default { signUpInfo: '输入您的信息以创建账号。', signUpHasAccount: '已有账号?', forgotPasswordInfo: '输入您注册的邮箱以获取重置密码的链接。', - inputAnyInfo: '输入任何信息即可' + inputAnyInfo: '输入任何信息即可', + datacap: 'DataCap 是数据转换、集成和可视化的集成软件。支持多种数据源,文件类型,大数据相关数据库,关系型数据库,NoSQL 数据库等。通过软件可以实现管理多种数据源,对该源下的数据进行各种操作转换,制作数据图表,监控数据源等各种功能。' } } \ No newline at end of file diff --git a/src/model/Navigation.ts b/src/model/Navigation.ts index a14ed08b..e7659b81 100644 --- a/src/model/Navigation.ts +++ b/src/model/Navigation.ts @@ -5,7 +5,8 @@ export interface NavigationModel href?: string icon?: any group?: string - description?: string + description?: string, + external?: boolean position?: NavigationPosition children?: NavigationModel[] } diff --git a/src/views/layouts/base/components/components/LanguageSwitcher.vue b/src/views/layouts/base/components/components/LanguageSwitcher.vue index 2234b155..3fe9b6f6 100644 --- a/src/views/layouts/base/components/components/LanguageSwitcher.vue +++ b/src/views/layouts/base/components/components/LanguageSwitcher.vue @@ -6,9 +6,9 @@ {{ $t('region.common.asia.default') }} - {{ $t('region.common.asia.chineseSimple') }} + {{ $t('region.common.asia.chineseSimple') }} {{ $t('region.common.northAmerica.default') }} - {{ $t('region.common.northAmerica.english') }} + {{ $t('region.common.northAmerica.english') }} diff --git a/src/views/layouts/base/components/components/NavigationClosed.vue b/src/views/layouts/base/components/components/NavigationClosed.vue index 93d1d65f..a9fae7d1 100644 --- a/src/views/layouts/base/components/components/NavigationClosed.vue +++ b/src/views/layouts/base/components/components/NavigationClosed.vue @@ -1,13 +1,14 @@ @@ -15,6 +16,7 @@ import { defineComponent } from 'vue' import { Button } from '@/components/ui/button' import { NavigationModel, NavigationPosition } from '@/model/Navigation' +import NavigationRouterLink from '@/views/layouts/base/components/components/NavigationRouterLink.vue' export default defineComponent({ name: 'NavigationClosed', @@ -24,7 +26,7 @@ export default defineComponent({ return NavigationPosition } }, - components: {Button}, + components: {NavigationRouterLink, Button}, props: { navigator: { type: Object as () => NavigationModel diff --git a/src/views/layouts/base/components/components/NavigationItem.vue b/src/views/layouts/base/components/components/NavigationItem.vue index 02406acd..b72d0690 100644 --- a/src/views/layouts/base/components/components/NavigationItem.vue +++ b/src/views/layouts/base/components/components/NavigationItem.vue @@ -1,15 +1,15 @@ @@ -20,10 +20,12 @@ import { cn } from '@/lib/utils' import { NavigationModel, NavigationPosition } from '@/model/Navigation' import { Button } from '@/components/ui/button' import { NavigationMenuLink } from '@/components/ui/navigation-menu' +import NavigationRouterLink from '@/views/layouts/base/components/components/NavigationRouterLink.vue' export default defineComponent({ name: 'NavigationItem', components: { + NavigationRouterLink, NavigationMenuLink, Button }, diff --git a/src/views/layouts/base/components/components/NavigationOpened.vue b/src/views/layouts/base/components/components/NavigationOpened.vue index 1930757e..6fbdf17e 100644 --- a/src/views/layouts/base/components/components/NavigationOpened.vue +++ b/src/views/layouts/base/components/components/NavigationOpened.vue @@ -1,6 +1,7 @@ @@ -24,6 +25,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/comp import { Button } from '@/components/ui/button' import { NavigationModel, NavigationPosition } from '@/model/Navigation' import { ChevronsLeft } from 'lucide-vue-next' +import NavigationRouterLink from '@/views/layouts/base/components/components/NavigationRouterLink.vue' export default defineComponent({ name: 'NavigationOpened', @@ -34,6 +36,7 @@ export default defineComponent({ } }, components: { + NavigationRouterLink, ChevronsLeft, Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger diff --git a/src/views/layouts/base/components/components/NavigationRouterLink.vue b/src/views/layouts/base/components/components/NavigationRouterLink.vue new file mode 100644 index 00000000..3098149d --- /dev/null +++ b/src/views/layouts/base/components/components/NavigationRouterLink.vue @@ -0,0 +1,24 @@ + + + \ No newline at end of file