main.js
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Vue, { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import elementUI from '@/utils/globalUI/element'
import 'element-plus/lib/theme-chalk/index.css'
import { Common } from "@/utils/common/common";
// import './assets/css/resets.css'
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)
localStorage.setItem('logo', o.logo)
localStorage.setItem('title', o.title)
localStorage.setItem('smallLogo', o.smallLogo)
localStorage.setItem('hiddenMenu', JSON.stringify(Common.hiddenMenu))
store.commit('app/SET_LOGIN_LOGO', o.logo)
store.commit('app/SET_LOGIN_TITLE', o.title)
store.commit('app/SET_MENU_LOGO', o.smallLogo)
// window.localStorage.setItem(
// 'GLSX_COMMODITY_CENTER_CONFIG',
// xhr.responseText,
// )
}
}
xhr.open('GET', url)
xhr.send()
})
}
//localStorage.removeItem('title')
localStorage.removeItem('BASE_URL')
getConfig()
app.use(store).use(router).use(elementUI).mount('#app')