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

View File

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

View File

@ -35,15 +35,18 @@ const actions = {
getPublicSettings({ commit, state }) { getPublicSettings({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getPublicSettings().then(response => { getPublicSettings().then(response => {
const link = document.querySelector("link[rel*='icon']") || document.createElement('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.type = 'image/x-icon'
link.rel = 'shortcut icon' link.rel = 'shortcut icon'
link.href = response.data.LOGO_URLS.favicon
document.getElementsByTagName('head')[0].appendChild(link) document.getElementsByTagName('head')[0].appendChild(link)
}
link.href = faviconURL
// 动态修改Title // 动态修改Title
if (response.data.LOGIN_TITLE) { document.title = response.data.LOGIN_TITLE } document.title = response.data.LOGIN_TITLE
commit('SET_PUBLIC_SETTINGS', response.data) commit('SET_PUBLIC_SETTINGS', response.data)
resolve(response) resolve(response)
}).catch(error => { }).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 store from '@/store'
import router from '@/router' import router from '@/router'
import { Message } from 'element-ui' import { Message } from 'element-ui'
@ -15,9 +15,9 @@ function reject(msg) {
return new Promise((resolve, reject) => reject(msg)) return new Promise((resolve, reject) => reject(msg))
} }
function setHeadTitle({ to, from, next }) { // function setHeadTitle({ to, from, next }) {
document.title = getPageTitle(to.meta.title) // document.title = getPageTitle(to.meta.title)
} // }
async function checkLogin({ to, from, next }) { async function checkLogin({ to, from, next }) {
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
@ -145,7 +145,7 @@ export async function startup({ to, from, next }) {
// set page title // set page title
await getPublicSetting({ to, from, next }) await getPublicSetting({ to, from, next })
await setHeadTitle({ to, from, next }) // await setHeadTitle({ to, from, next })
await checkLogin({ to, from, next }) await checkLogin({ to, from, next })
await changeCurrentOrgIfNeed({ to, from, next }) await changeCurrentOrgIfNeed({ to, from, next })
await changeCurrentRoleIfNeed({ 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 CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = /\.(js|css|json|txt|ico|svg)(\?.*)?$/i const productionGzipExtensions = /\.(js|css|json|txt|ico|svg)(\?.*)?$/i
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const name = defaultSettings.title || 'JumpServer' // page title const name = '' // page title
// If your port is set to 80, // If your port is set to 80,
// use administrator privileges to execute the command line. // use administrator privileges to execute the command line.