perf: logo和文案

perf: 去掉title
This commit is contained in:
ibuler 2021-06-02 17:29:32 +08:00 committed by Jiangjie.Bai
parent 73d4ec0fa5
commit cc994b8ecd
9 changed files with 23 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -8,7 +8,6 @@
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
</head>
<body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -2,13 +2,10 @@
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 v-else class="sidebar-title">{{ title }}</h1>
<img :src="logoSrc" class="sidebar-logo">
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img :src="logoSrc" class="sidebar-logo-text">
<!-- <img v-else-if="logoText" :src="logoText" class="sidebar-logo-text">-->
<!-- <h1 class="sidebar-title">{{ title }}</h1>-->
<img :src="logoTextSrc" class="sidebar-logo-text">
</router-link>
</transition>
</div>
@ -26,10 +23,6 @@ export default {
},
data() {
return {
title: 'JumpServer',
logoText: require('@/assets/img/logo-text.png'),
logo: require('@/assets/img/logo.png'),
xpackData: {}
}
},
computed: {
@ -37,16 +30,14 @@ export default {
'publicSettings'
]),
// eslint-disable-next-line vue/return-in-computed-property
logoTextSrc() {
return this.publicSettings.LOGO_URLS.logo_index
},
logoSrc() {
if (this.publicSettings.LOGO_URLS.logo_index !== '/static/img/logo_text.png') {
return this.publicSettings.LOGO_URLS.logo_index
} else {
return this.logoText
}
return this.publicSettings.LOGO_URLS.logo_logout
}
},
created() {
}
}
</script>

View File

@ -1,6 +1,5 @@
module.exports = {
title: 'JumpServer',
title: '.',
/**
* @type {boolean} true | false

View File

@ -35,15 +35,18 @@ const actions = {
getPublicSettings({ commit, state }) {
return new Promise((resolve, reject) => {
getPublicSettings().then(response => {
const link = document.querySelector("link[rel*='icon']") || document.createElement('link')
link.type = 'image/x-icon'
link.rel = 'shortcut icon'
link.href = response.data.LOGO_URLS.favicon
document.getElementsByTagName('head')[0].appendChild(link)
const faviconURL = response.data.LOGO_URLS.favicon
let link = document.querySelector("link[rel*='icon']")
if (!link) {
link = document.createElement('link')
link.type = 'image/x-icon'
link.rel = 'shortcut icon'
document.getElementsByTagName('head')[0].appendChild(link)
}
link.href = faviconURL
// 动态修改Title
if (response.data.LOGIN_TITLE) { document.title = response.data.LOGIN_TITLE }
document.title = response.data.LOGIN_TITLE
commit('SET_PUBLIC_SETTINGS', response.data)
resolve(response)
}).catch(error => {

View File

@ -1,4 +1,4 @@
import getPageTitle from '@/utils/get-page-title'
// import getPageTitle from '@/utils/get-page-title'
import store from '@/store'
import router from '@/router'
import { Message } from 'element-ui'
@ -15,9 +15,9 @@ function reject(msg) {
return new Promise((resolve, reject) => reject(msg))
}
function setHeadTitle({ to, from, next }) {
document.title = getPageTitle(to.meta.title)
}
// function setHeadTitle({ to, from, next }) {
// document.title = getPageTitle(to.meta.title)
// }
async function checkLogin({ to, from, next }) {
if (whiteList.indexOf(to.path) !== -1) {
@ -145,7 +145,7 @@ export async function startup({ to, from, next }) {
// set page title
await getPublicSetting({ to, from, next })
await setHeadTitle({ to, from, next })
// await setHeadTitle({ to, from, next })
await checkLogin({ to, from, next })
await changeCurrentOrgIfNeed({ to, from, next })
await changeCurrentRoleIfNeed({ to, from, next })

View File

@ -4,12 +4,11 @@ const defaultSettings = require('./src/settings.js')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = /\.(js|css|json|txt|ico|svg)(\?.*)?$/i
function resolve(dir) {
return path.join(__dirname, dir)
}
const name = defaultSettings.title || 'JumpServer' // page title
const name = '' // page title
// If your port is set to 80,
// use administrator privileges to execute the command line.