| | |
| | | } catch (e) {} |
| | | } |
| | | sessionStorage.removeItem('isEditState') |
| | | sessionStorage.removeItem('loginError') |
| | | sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '') |
| | | sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '') |
| | | |
| | |
| | | GLOB.lineColor = config.lineColor || '' |
| | | GLOB.licenseKey = config.licenseKey || '' |
| | | GLOB.probation = false |
| | | GLOB.watermark = config.watermark !== false |
| | | GLOB.keepKey = config.keepPassword !== 'false' |
| | | |
| | | if (config.externalDatabase !== false && config.externalDatabase !== 'false' && config.externalDatabase !== undefined) { |
| | | GLOB.externalDatabase = config.externalDatabase ? `[${config.externalDatabase}]..` : '' |
| | |
| | | if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) { |
| | | GLOB.probation = true |
| | | } |
| | | |
| | | if (!config.mainSystemApi) { |
| | | document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统未设置单点地址,请联系管理员!</div>' |
| | | return |
| | | } else if (/http(s?):\/\/sso.mk9h.cn\/cloud/ig.test(config.mainSystemApi)) { |
| | | document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">正式系统不可使用 http://sso.mk9h.cn/cloud 做为单点地址,请联系管理员!</div>' |
| | | return |
| | | } else if (/http(s?):\/\/cloud.mk9h.cn/ig.test(config.mainSystemApi)) { |
| | | document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">正式系统不可使用 http://cloud.mk9h.cn 做为单点地址,请联系管理员!</div>' |
| | | return |
| | | } |
| | | } else if (options.sysType === 'local') { |
| | | GLOB.probation = true |
| | | GLOB.systemType = '' |
| | | |
| | | GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' |
| | | |
| | | // GLOB.mainSystemApi = 'http://sso.mk9h.cn/cloud/webapi/dostars' |
| | | |
| | | if (GLOB.watermark) { |
| | | GLOB.dataFormat = true |
| | | } |
| | | } else { |
| | | GLOB.systemType = '' |
| | | GLOB.mainSystemApi = '' |
| | | } |
| | | |
| | | GLOB.debugger = options.sysType === 'local' && GLOB.systemType !== 'production' |
| | | |
| | | if (options.sysType !== 'cloud') { |
| | | if (config.appkey === options.cakey) { |
| | | document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">不可使用云端appkey,请联系管理员!</div>' |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (options.sysType === 'cloud') { // cloud不可设置单点服务器地址,云端appkey为系统设置 |
| | | GLOB.appkey = options.cakey |
| | | GLOB.mainSystemApi = '' |
| | | } else if (options.sysType === 'SSO') { // sso不可设置单点服务器地址 |
| | | GLOB.mainSystemApi = '' |
| | | if (config.appkey === options.cakey) { |
| | | GLOB.appkey = '' |
| | | console.warn('单点系统appkey不可与云端相同') |
| | | } else { |
| | | GLOB.appkey = config.appkey |
| | | } |
| | | GLOB.appkey = config.appkey |
| | | } else if (options.sysType === 'local') { // 业务系统 |
| | | if (config.appkey === options.cakey) { |
| | | GLOB.appkey = '' |
| | | console.warn('业务系统appkey不可与云端相同') |
| | | } else { |
| | | GLOB.appkey = config.appkey |
| | | } |
| | | if (config.mainSystemApi) { |
| | | GLOB.appkey = config.appkey |
| | | if (GLOB.systemType === 'production') { |
| | | let systemApi = config.mainSystemApi |
| | | // 业务系统不允许连接云端,业务系统连接sso.mk9h.cn时,数据虚化处理 |
| | | if (systemApi.indexOf('cloud.mk9h.cn') > -1) { |
| | | systemApi = '' |
| | | } else if (/index.html/ig.test(systemApi)) { |
| | | if (/index.html/ig.test(systemApi)) { |
| | | systemApi = systemApi.replace(/index.html.*/ig, 'webapi/dostars') |
| | | } else if (!/webapi\/dostars$/ig.test(systemApi)) { |
| | | systemApi = systemApi.replace(/\/?$/, '/webapi/dostars') |
| | | } |
| | | |
| | | if (systemApi.indexOf('sso.mk9h.cn') > -1 && process.env.NODE_ENV === 'production') { |
| | | GLOB.dataFormat = true |
| | | } |
| | | |
| | | GLOB.mainSystemApi = systemApi |
| | |
| | | } |
| | | } |
| | | |
| | | if (/^https/.test(window.location.protocol)) { // https转换 |
| | | let meta = document.createElement('meta') |
| | | meta.content = 'upgrade-insecure-requests' |
| | | meta.httpEquiv = 'Content-Security-Policy' |
| | | document.getElementsByTagName('head')[0].appendChild(meta) |
| | | } |
| | | |
| | | document.title = GLOB.platTitle || '' |
| | | |
| | | if (config.filter === 'true') { |
| | | if (config.filter === 'true' || (/^20\d{2}-\d{2}-\d{2}$/.test(config.filter) && new Date(config.filter).getTime() + 86400000 >= new Date().getTime())) { |
| | | let html = document.getElementsByTagName('html')[0] |
| | | |
| | | if (html) { |
| | |
| | | GLOB.linkurl = GLOB.linkurl + 'index.html' |
| | | } |
| | | GLOB.service = _service ? _service + '/' : '' |
| | | GLOB.host = window.location.host + (_service ? '_' + _service : '') |
| | | } else { |
| | | GLOB.linkurl = '' |
| | | GLOB.location = config.host |
| | | GLOB.service = config.service |
| | | GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') |
| | | } |
| | | |
| | | let mark = sessionStorage.getItem('system_mark') |
| | |
| | | writable: false, |
| | | value: GLOB.systemType |
| | | }) |
| | | Object.defineProperty(GLOB, 'debugger', { |
| | | writable: false, |
| | | value: GLOB.debugger |
| | | }) |
| | | Object.defineProperty(GLOB, 'mainSystemApi', { |
| | | writable: false, |
| | | value: GLOB.mainSystemApi |
| | |
| | | Object.defineProperty(GLOB, 'linkurl', { |
| | | writable: false, |
| | | value: GLOB.linkurl |
| | | }) |
| | | Object.defineProperty(GLOB, 'dataFormat', { |
| | | writable: false, |
| | | value: GLOB.dataFormat |
| | | }) |
| | | Object.defineProperty(window, 'GLOB', { |
| | | writable: false, |