From 49be1f9b0ed04514934f66d9421ae3682d11711b Mon Sep 17 00:00:00 2001 From: ailoooong Date: Wed, 11 Jun 2025 10:26:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BD=AF=E4=BB=B6=E4=B8=AD=E5=BF=83titl?= =?UTF-8?q?e=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/software/software-zh.ts | 3 +- src/router/index.ts | 74 +++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/i18n/software/software-zh.ts b/src/i18n/software/software-zh.ts index a38fc2a..e4184af 100644 --- a/src/i18n/software/software-zh.ts +++ b/src/i18n/software/software-zh.ts @@ -10,7 +10,7 @@ export default { epkg: 'EPKG', oepkg: 'OEPKG', conda: 'CONDA', - appversion: '上游兼容应用全景', + appversion: '软件版本支持', filterAll: '全部', filterName: '按名称', filterSummary: '按概要', @@ -18,6 +18,7 @@ export default { searchPlaceholder: '输入内容进行搜索,多个关键字请用逗号隔开', searchPlaceholder1: '搜索', searchFilterTips: '为您找到符合条件的筛选{0}个', + searcResult: '搜索结果', viewAll: '显示全部', upList: '收起', diff --git a/src/router/index.ts b/src/router/index.ts index 1cd80a3..340c78e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,42 +6,72 @@ import { tryLogin } from '@/shared/login'; import { useLoginStore, useUserInfoStore } from '@/stores/user'; import { getCollaborationPermissions } from '@/api/api-collaboration'; import { COLLABORATIONPERMISSION } from '@/data/query'; +import i18n from '@/i18n'; + +const { t } = i18n.global; + +const TITLE = 'openEuler 软件中心'; const routes = [ { path: '/', redirect: '/zh', }, - { path: '/zh', name: 'home', component: () => import('@/views/home/TheHome.vue') }, + { + path: '/zh', + name: 'home', + component: () => import('@/views/home/TheHome.vue'), + meta: { + title: TITLE, + }, + }, { path: '/zh/field', name: 'field', component: () => import('@/views/field/TheField.vue'), + meta: { + title: `${t('software.all')} | ${TITLE}`, + }, }, { path: '/zh/field/detail', name: 'field-detail', component: () => import('@/views/field/TheFieldDetail.vue'), + meta: { + title: `${t('software.all')} | ${TITLE}`, + }, }, { path: '/zh/rpm', name: 'rpm', component: () => import('@/views/package/TheRpm.vue'), + meta: { + title: `${t('software.rpm')} | ${TITLE}`, + }, }, { path: '/zh/upstream', name: 'upstream', component: () => import('@/views/upstream/TheUpstream.vue'), + meta: { + title: `${t('software.appversion')} | ${TITLE}`, + }, }, { path: '/zh/search', name: 'search', component: () => import('@/views/search/TheSearch.vue'), + meta: { + title: `${t('software.searcResult')} | ${TITLE}`, + }, }, { path: '/zh/image', name: 'image', component: () => import('@/views/image/TheImage.vue'), + meta: { + title: `${t('software.image')} | ${TITLE}`, + }, }, // { // path: '/zh/epkg', @@ -57,61 +87,97 @@ const routes = [ path: '/zh/oepkg', name: 'oepkg', component: () => import('@/views/oepkg/TheOEpkg.vue'), + meta: { + title: `${t('software.oepkg')} | ${TITLE}`, + }, }, { path: '/zh/oepkg/detail', name: 'oepkg-detail', component: () => import('@/views/oepkg/TheOEpkgDetail.vue'), + meta: { + title: `${t('software.oepkg')} | ${TITLE}`, + }, }, { path: '/zh/rpm/detail', name: 'rpm-detail', component: () => import('@/views/package/TheRpmDetail.vue'), + meta: { + title: `${t('software.rpm')} | ${TITLE}`, + }, }, { path: '/zh/image/detail', name: 'image-detail', component: () => import('@/views/image/TheImageDetail.vue'), + meta: { + title: `${t('software.image')} | ${TITLE}`, + }, }, { path: '/zh/conda', name: 'conda', component: () => import('@/views/conda/TheConda.vue'), + meta: { + title: `${t('software.conda')} | ${TITLE}`, + }, }, { path: '/zh/conda/detail', name: 'conda-detail', component: () => import('@/views/conda/TheCondaDetail.vue'), + meta: { + title: `${t('software.conda')} | ${TITLE}`, + }, }, { path: '/zh/solution/openhpc', name: 'openhpc', component: () => import('@/views/solution/TheOpenHPC.vue'), + meta: { + title: `OpenHPC | ${TITLE}`, + }, }, { path: '/zh/solution/openstack', name: 'openstack', component: () => import('@/views/solution/TheOpenStack.vue'), + meta: { + title: `OpenStack | ${TITLE}`, + }, }, { path: '/zh/collaboration', name: 'collaboration', component: () => import('@/views/collaboration/TheCollaboration.vue'), + meta: { + title: `软件维护详情 | ${TITLE}`, + }, }, { path: '/zh/collaboration-permission', name: 'collaboration-permission', component: () => import('@/views/collaboration/CollaborationPermission.vue'), + meta: { + title: `软件维护详情 | ${TITLE}`, + }, }, { path: '/zh/todo/:type', name: 'todo', component: () => import('@/views/todo/TheTodo.vue'), + meta: { + title: `待办中心 | ${TITLE}`, + }, }, { path: '/zh/todo/:type/:id', name: 'todo-detail', component: () => import('@/views/todo/TheTodoDetail.vue'), + meta: { + title: `待办中心 | ${TITLE}`, + }, }, // 默认路由 { @@ -120,7 +186,7 @@ const routes = [ component: () => { return import('@/components/ResultNotFound.vue'); }, - meta: { title: '404' }, + meta: { title: `404 | ${TITLE}` }, }, ]; @@ -138,6 +204,10 @@ router.beforeEach(async (to) => { document.documentElement.scrollTop = 0; // to.name + if (to.meta.title) { + document.title = to.meta.title || TITLE; + } + // 设置语言 const langStore = useLangStore(); const lang = to.path.startsWith('/en') ? 'en' : 'zh'; -- Gitee