| | |
| | | ) |
| | | } |
| | | |
| | | window.GLOB = window.GLOB || {} |
| | | sessionStorage.removeItem('isEditState') |
| | | |
| | | fetch(`./${process.env.NODE_ENV === 'production' ? 'build/' : ''}options.json`) |
| | | .then(response => response.json()) |
| | | .catch(() => { |
| | | console.warn('系统配置信息获取失败,请联系管理员!') |
| | | }) |
| | | .then(config => { |
| | | if (!config) return |
| | | |
| | | window.GLOB = {} |
| | | window.GLOB.appId = config.appId || '' |
| | | window.GLOB.lineColor = config.lineColor || '' |
| | | window.GLOB.filter = config.filter || '' |
| | | |
| | | // 只有业务系统才可以设置为正式系统 |
| | | if (options.sysType === 'local' && (window.GLOB.systemType === 'official' || window.GLOB.systemType === 'production')) { |
| | | if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) { |
| | | window.GLOB.systemType = 'production' |
| | | } else { |
| | | window.GLOB.systemType = '' |
| | |
| | | window.GLOB.mainSystemApi = '' |
| | | } else if (options.sysType === 'SSO') { // sso不可设置单点服务器地址 |
| | | window.GLOB.mainSystemApi = '' |
| | | if (window.GLOB.appkey === options.cakey) { |
| | | if (config.appkey === options.cakey) { |
| | | window.GLOB.appkey = '' |
| | | console.warn('单点系统appkey不可与云端相同') |
| | | } |
| | | } else if (options.sysType === 'local') { // 业务系统 |
| | | if (window.GLOB.appkey === options.cakey) { |
| | | if (config.appkey === options.cakey) { |
| | | window.GLOB.appkey = '' |
| | | console.warn('业务系统appkey不可与云端相同') |
| | | } else { |
| | | window.GLOB.appkey = config.appkey |
| | | } |
| | | if (window.GLOB.mainSystemApi) { |
| | | let systemApi = window.GLOB.mainSystemApi |
| | | if (config.mainSystemApi) { |
| | | let systemApi = config.mainSystemApi |
| | | |
| | | if (/^(http|https):\/\//ig.test(systemApi)) { |
| | | let _systemApi = /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(systemApi) |
| | |
| | | document.getElementById('root').className = option[window.GLOB.style] |
| | | } |
| | | |
| | | sessionStorage.removeItem('isEditState') |
| | | |
| | | render(Route) |
| | | }) |
| | | |
| | | serviceWorker.unregister() |