main.js 1.3 KB
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 './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)
        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')