import React from 'react'
|
import ReactDOM from 'react-dom'
|
import Route from './router'
|
import * as serviceWorker from './serviceWorker'
|
import '@/assets/css/main.scss'
|
import '@/assets/css/viewstyle.scss'
|
|
if (!localStorage.getItem('SessionUid')) {
|
localStorage.setItem('SessionUid', (() => {
|
let uuid = []
|
let _options = '0123456789abcdefghigklmnopqrstuv'
|
for (let i = 0; i < 32; i++) {
|
uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
|
}
|
return uuid.join('')
|
})())
|
}
|
|
const render = Component => {
|
ReactDOM.render(
|
<Component/>,
|
document.getElementById('root')
|
)
|
}
|
|
fetch('../options.json')
|
.then(response => response.json())
|
.catch(() => {
|
document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统配置信息获取失败,请联系管理员!</div>'
|
})
|
.then(config => {
|
if (!config) return
|
|
let GLOB = {}
|
GLOB.appId = config.appId || ''
|
GLOB.appkey = config.appkey
|
|
GLOB.mainSystemApi = 'https://sso.mk9h.cn/cloud/webapi/dostars'
|
|
document.body.className = 'mk-blue-black'
|
document.title = 'MinkeSoft'
|
|
GLOB.location = config.host
|
GLOB.service = config.service
|
GLOB.baseurl = GLOB.location + '/' + GLOB.service
|
|
sessionStorage.setItem('lang', 'zh-CN')
|
|
Object.defineProperty(window, 'GLOB', {
|
writable: false,
|
value: GLOB
|
})
|
|
render(Route)
|
})
|
|
serviceWorker.unregister()
|