Skip to content

Commit

Permalink
feat: 全局配置title/footer/logo/favicon/产品名称 TencentBlueKing#10678
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 14553
  • Loading branch information
vhwweng committed Aug 8, 2024
1 parent 055d1fe commit fe46b03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/frontend/devops-nav/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const createRouter = (store: any, dynamicLoadModule: any, i18n: any) => {
const serviceAlias = getServiceAliasByPath(to.path)
const currentPage = window.serviceObject.serviceMap[serviceAlias]
if (to.name !== from.name) {
console.log(platformInfo, '----from store platformInfo')
document.title = currentPage
? `${currentPage.name} | ${platformInfo.i18n.name || platformInfo.name} | ${platformInfo.i18n.brandName || platformInfo.brandName}`
: `${platformInfo.i18n.name || platformInfo.name} | ${platformInfo.i18n.brandName || platformInfo.brandName}`
Expand Down
9 changes: 6 additions & 3 deletions src/frontend/devops-nav/src/store/modules/platform-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const messages = i18n.messages[locale]
const state = () => ({
platformInfo: {
name: (messages && messages.bkci) || '蓝盾',
nameEn: 'BLUEKING CI',
nameEn: 'BK-CI',
brandName: (messages && messages.tencentBlueKing) || '蓝鲸智云',
brandNameEn: 'BlueKing',
brandNameEn: 'Tencent BlueKing',
favicon: `${window.PUBLIC_URL_PREFIX}/static/favicon.ico`,
version: window.BK_CI_VERSION,
i18n: {}
Expand All @@ -35,7 +35,10 @@ const actions = {
resp = await getPlatformConfig(config)
}
const { i18n, name, brandName } = resp
document.title = `${i18n.name || name} | ${i18n.brandName || brandName}`
const currentPage = window.currentPage
document.title = currentPage
? `${currentPage.name} | ${i18n.name || name} | ${i18n.brandName || brandName}`
: `${i18n.name || name} | ${i18n.brandName || brandName}`
setShortcutIcon(resp.favicon)
commit('setPlatformInfo', resp)
return resp
Expand Down

0 comments on commit fe46b03

Please sign in to comment.