king
2020-07-20 2dc12c551cd60f2e3c976ed608d260b1d78ce759
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
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux'
import Route from './router'
import store from '@/store'
import './index.css';
import * as serviceWorker from './serviceWorker';
 
const render  = Component => {
  ReactDOM.render(
    <Provider store={store}>
      <Component/>
    </Provider>,
    document.getElementById('root')
  )
}
 
fetch(`./${process.env.NODE_ENV === 'production' ? 'build/' : ''}options.json`)
  .then(response => response.json())
  .catch(() => {
    document.getElementById('root').innerHTML = '系统配置信息获取失败,请联系管理员!'
    document.getElementById('root').className = 'config-error'
  })
  .then(config => {
    if (!config) return
 
    window.GLOB = {}
    window.GLOB.appId = config.appId || ''
    window.GLOB.lineColor = config.lineColor || ''
    window.GLOB.filter = config.filter || ''
    window.GLOB.appkey = config.appkey
 
    render(Route)
  })
 
serviceWorker.unregister();