Skip to content

Commit

Permalink
perf: logo和文案
Browse files Browse the repository at this point in the history
perf: 去掉title
  • Loading branch information
ibuler authored and BaiJiangJie committed Jun 2, 2021
1 parent 6f65bcf commit e0b3f4e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 32 deletions.
Binary file removed public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Binary file removed src/assets/img/logo-text.png
Binary file not shown.
Binary file removed src/assets/img/logo.png
Binary file not shown.
21 changes: 6 additions & 15 deletions src/layout/components/NavBar/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -26,27 +23,21 @@ export default {
},
data() {
return {
title: 'JumpServer',
logoText: require('@/assets/img/logo-text.png'),
logo: require('@/assets/img/logo.png'),
xpackData: {}
}
},
computed: {
...mapGetters([
'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>
Expand Down
3 changes: 1 addition & 2 deletions src/settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {

title: 'JumpServer',
title: '.',

/**
* @type {boolean} true | false
Expand Down
17 changes: 10 additions & 7 deletions src/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
10 changes: 5 additions & 5 deletions src/utils/startup.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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) {
Expand Down Expand Up @@ -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 })
Expand Down
3 changes: 1 addition & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e0b3f4e

Please sign in to comment.