不同域名显示不同logo

This commit is contained in:
老叶
2022-10-21 15:45:12 +08:00
parent 700ea462af
commit 314e796ffd
6 changed files with 40 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

+23 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
<title><%= process.env.VUE_APP_NAME %></title>
<style>
.ele-admin-loading {
@@ -50,6 +50,28 @@
position: fixed;
}
</style>
<script>
window.onload = function(){
var hostname=window.location.hostname;
if(hostname=='bo.liche.cn'){
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'https://bo.liche.cn/favicon_liche.ico';
document.getElementsByTagName('head')[0].appendChild(link);
}else if(hostname=='dongfeng.haodian.cn'){
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'https://dongfeng.haodian.cn/favicon_df.ico';
}else{
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'http://' + hostname + '/favicon_liche.ico';
}
}
</script>
</head>
<body>
<noscript>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

+17 -2
View File
@@ -49,7 +49,8 @@
<router-layout />
<!-- logo 图标 -->
<template v-slot:logo>
<img src="@/assets/logo.png" alt="logo" />
<!-- <img src="@/assets/logo.png" alt="logo" /> -->
<img :src="logo" alt="logo" />
</template>
<!-- 顶栏右侧区域 -->
<template v-slot:right>
@@ -127,9 +128,23 @@
LAYOUT_PATH,
REDIRECT_PATH,
// 是否全屏
fullscreen: false
fullscreen: false,
logo: ''
};
},
created() {
let hostname = window.location.hostname;
if (hostname == 'bo.liche.cn') {
this.logo =
'https://qs.haodian.cn/web/images/project/Admin-ShiYu/logo_liche.png';
} else if (hostname == 'dongfeng.haodian.cn') {
this.logo =
'https://qs.haodian.cn/web/images/project/Admin-ShiYu/logo_df.png';
} else {
this.logo =
'https://qs.haodian.cn/web/images/project/Admin-ShiYu/logo_liche.png';
}
},
computed: {
// 当前语言
locale() {