king
2023-08-11 4adb8b8868aeed1f5f3b89ae269a7724c6b451ad
src/index.js
@@ -10,19 +10,6 @@
import '@/assets/css/action.scss'
import '@/assets/css/viewstyle.scss'
if (window.location.href.indexOf('#/design') > -1) { // 编辑页面刷新时,跳转至主页
  window.location.replace(window.location.href.replace(/design/ig, 'main'))
}
options.sysType = window.atob(options.sysType.replace('$mk', ''))
options.caId = window.atob(options.caId.replace('$mk', ''))
options.cakey = window.atob(options.cakey.replace('$mk', ''))
options.cdomain = window.atob(options.cdomain.replace('$mk', ''))
if (options.cdomain && options.sysType !== 'cloud') {
  options.cloudServiceApi = options.cdomain + '/webapi/dostars'
}
if (!localStorage.getItem('SessionUid')) {
  localStorage.setItem('SessionUid', (() => {
    let uuid = []
@@ -42,8 +29,6 @@
    document.getElementById('root')
  )
}
sessionStorage.removeItem('isEditState')
fetch('../options.json')
  .then(response => response.json())
@@ -74,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')}]..`
@@ -84,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
@@ -100,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 = ''
@@ -119,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
@@ -157,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) {
@@ -289,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
@@ -298,6 +296,8 @@
    window.GLOB.CacheVoucher = new Map() // 缓存凭证信息
    window.GLOB.UserCacheMap = new Map() // 缓存用户自定义设置
    window.GLOB.CacheData = new Map()    // 存储选中数据
    window.GLOB.SearchBox = new Map()    // 存储搜索条件
    window.GLOB.SyncData = new Map()     // 存储同步查询数据
    render(Route)
  })