king
2023-12-22 bcee29218364da52d9452803697b33a1067e7871
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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()