Commit cdebe64f by jack

动态根据域名更换logo

1 parent 840fc479
No preview for this file type
<template> <template>
<div class="home-logo-wrapper"> <div class="home-logo-wrapper">
<img class="home-logo-img" src="@/assets/images/company-logo-sub.png" alt="home-logo" > <!-- <img class="home-logo-img" src="@/assets/images/company-logo-sub.png" alt="home-logo" > -->
<img class="home-logo-img" :src="smallLogo" alt="home-logo" >
<!-- <img v-show="collapsed" class="home-logo-img home-thumbnail-logo" src="@/assets/images/logo-thumbnail.png" alt="home-logo" > --> <!-- <img v-show="collapsed" class="home-logo-img home-thumbnail-logo" src="@/assets/images/logo-thumbnail.png" alt="home-logo" > -->
</div> </div>
</template> </template>
...@@ -14,7 +15,8 @@ ...@@ -14,7 +15,8 @@
// collapsed: Boolean // collapsed: Boolean
// }, // },
setup () { setup () {
const smallLogo = localStorage.getItem('smallLogo');
return {smallLogo}
} }
} }
</script> </script>
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
.header { .header {
width: 100%; width: 100%;
height: 139px !important; height: auto !important;
padding: 45px 50px 0 50px; padding: 20px 50px 0 50px;
background-color: #fff; background-color: #fff;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="home-logo-wrapper"> <div class="home-logo-wrapper">
<img class="home-logo-img" src="@/assets/images/company-logo.png" alt="company-logo"> <!-- <img class="home-logo-img" src="@/assets/images/company-logo.png" alt="company-logo"> -->
<img class="home-logo-img" :src="logoPath" alt="company-logo">
<span class="home-logo-title">{{ homeTitle }}</span> <span class="home-logo-title">{{ homeTitle }}</span>
</div> </div>
</template> </template>
...@@ -12,8 +13,8 @@ ...@@ -12,8 +13,8 @@
name: 'Logo', name: 'Logo',
setup () { setup () {
const homeTitle = ref(''); const homeTitle = ref('');
const logoPath = localStorage.getItem('logo')
return { homeTitle }; return { homeTitle,logoPath };
} }
} }
</script> </script>
...@@ -24,7 +25,8 @@ ...@@ -24,7 +25,8 @@
font-size: 20px; font-size: 20px;
.home-logo-img { .home-logo-img {
width: 480px; //width: 480px;
height:67px;
margin-right: 10px; margin-right: 10px;
} }
......
...@@ -4,14 +4,33 @@ import router from './router' ...@@ -4,14 +4,33 @@ import router from './router'
import store from './store' import store from './store'
import elementUI from '@/utils/globalUI/element' import elementUI from '@/utils/globalUI/element'
import 'element-plus/lib/theme-chalk/index.css'
import 'element-plus/lib/theme-chalk/index.css';
// import './assets/css/resets.css' // import './assets/css/resets.css'
const app = createApp(App); const app = createApp(App)
const URL =
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/e-sheild-portal-config') => {
return new Promise((resolve) => {
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
let o = xhr.responseText ? JSON.parse(xhr.responseText) : {}
console.log(o.logo)
localStorage.setItem('logo', o.logo)
localStorage.setItem('title', o.title)
localStorage.setItem('smallLogo',o.smallLogo)
// window.localStorage.setItem(
// 'GLSX_COMMODITY_CENTER_CONFIG',
// xhr.responseText,
// )
}
}
xhr.open('GET', url)
xhr.send()
})
}
app.use(store) getConfig()
.use(router)
.use(elementUI)
.mount('#app');
\ No newline at end of file \ No newline at end of file
app.use(store).use(router).use(elementUI).mount('#app')
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!