king
2023-08-14 f078c137d61270d243cd8e03077fa9cf000e276b
src/index.js
@@ -45,10 +45,6 @@
      }
    }
    if (options.cdomain && options.sysType !== 'cloud') {
      options.cloudServiceApi = options.cdomain + '/webapi/dostars'
    }
    let GLOB = {}
    GLOB.appId = config.appId || ''
    GLOB.lineColor = config.lineColor || ''
@@ -63,6 +59,12 @@
    GLOB.WXNotice = config.WXNotice + '' === 'true'
    GLOB.accessToken = {}
    GLOB.mkHS = false
    GLOB.navBar = 'shutter' // 默认为百叶窗
    GLOB.sysType = options.sysType
    if (GLOB.sysType !== 'cloud') {
      GLOB.cloudServiceApi = options.cdomain + '/webapi/dostars'
    }
    if (sessionStorage.getItem('externalDatabase')) {
      GLOB.externalDatabase = `[${sessionStorage.getItem('externalDatabase')}]..`
@@ -73,7 +75,7 @@
    }
    // 只有业务系统才可以设置为正式系统
    if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) {
    if (GLOB.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) {
      GLOB.systemType = 'production'
      if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) {
        GLOB.probation = true
@@ -89,7 +91,7 @@
        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') {
    } else if (GLOB.sysType === 'local') {
      GLOB.probation = true
      GLOB.systemType = ''
@@ -108,25 +110,26 @@
      GLOB.mainSystemApi = ''
    }
    GLOB.debugger = options.sysType === 'local' && GLOB.systemType !== 'production'
    GLOB.debugger = GLOB.sysType === 'local' && GLOB.systemType !== 'production'
    if (/#\/hs$/.test(window.location.href)) { // hs下不打印脚本
      GLOB.debugger = false
    }
    if (options.sysType !== 'cloud') {
    if (GLOB.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为系统设置
    if (GLOB.sysType === 'cloud') { // cloud不可设置单点服务器地址,云端appkey为系统设置
      GLOB.appkey = options.cakey
      GLOB.appId = options.caId
      GLOB.WXNotice = false
    } else if (options.sysType === 'SSO') { // sso不可设置单点服务器地址
    } else if (GLOB.sysType === 'SSO') { // sso不可设置单点服务器地址
      GLOB.appkey = config.appkey
    } else if (options.sysType === 'local') { // 业务系统
    } else if (GLOB.sysType === 'local') { // 业务系统
      GLOB.appkey = config.appkey
      if (GLOB.systemType === 'production') {
        let systemApi = config.mainSystemApi
@@ -146,8 +149,6 @@
    let _href = window.location.href.split('#')[0]
    let _systemMsg = localStorage.getItem(_href + 'system')
    GLOB.navBar = 'shutter' // 默认为百叶窗
    let className = 'mk-blue-black'
    if (_systemMsg) {
@@ -278,6 +279,14 @@
      writable: false,
      value: GLOB.linkurl
    })
    Object.defineProperty(GLOB, 'sysType', {
      writable: false,
      value: GLOB.sysType
    })
    Object.defineProperty(GLOB, 'cloudServiceApi', {
      writable: false,
      value: GLOB.cloudServiceApi || ''
    })
    Object.defineProperty(window, 'GLOB', {
      writable: false,
      value: GLOB