king
2024-09-25 c46e208fc65742bf02d43235a28143abbf3eb7ea
src/index.js
@@ -168,6 +168,11 @@
      if (GLOB.cloudServiceApi) {
        GLOB.mainSystemApi = GLOB.cloudServiceApi
      }
      if (config.systemRun === 'backend') {
        config.systemRun = '' // hs 不使用后端替换
        GLOB.backend = true
      }
    }
    if (process.env.NODE_ENV === 'production') { // 用于校验是否存在开发权限
@@ -183,14 +188,14 @@
      GLOB.baseurl = GLOB.location + '/' + GLOB.service
      GLOB.linkurl = GLOB.baseurl + 'index.html'
      GLOB.dataFormat = false
      let mark = sessionStorage.getItem('system_mark')
      let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}`
      if (mark && mark !== _mark) {
        sessionStorage.clear()
      }
      sessionStorage.setItem('system_mark', _mark)
    }
    let mark = sessionStorage.getItem('system_mark')
    let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}`
    if (mark && mark !== _mark) {
      sessionStorage.clear()
    }
    sessionStorage.setItem('system_mark', _mark)
    if (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) {
      GLOB.localkey = GLOB.appkey
@@ -345,36 +350,22 @@
      GLOB.memberLevel = 0
    }
    if (config.devTools === false) {
    if (config.systemRun === 'backend') {
      GLOB.debugger = false
      Object.defineProperty(window, 'backend', {
        writable: false,
        value: true
      })
    }
    if (config.debugger === 'forbid') {
      sessionStorage.removeItem('breakpoint')
      GLOB.debugger = false
      let getVal = () => {
        let _i = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
        let _h = window.outerHeight - _i - 200
        let _w = window.outerWidth - window.innerWidth - 100
        return Math.max(_h, _w)
      }
      if (getVal() > 0) {
        document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">本系统禁止使用控制台,请关闭控制台重新刷新!</div>'
        return
      } else {
        let timer = null
        window.addEventListener('resize', () => {
          timer && clearTimeout(timer)
          if (getVal() > 0) {
            timer = setTimeout(() => {
              document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">本系统禁止使用控制台,请关闭控制台重新刷新!</div>'
            }, 100)
          }
        })
      }
    }
    if (GLOB.sysType === 'cloud') {
      Object.defineProperty(GLOB, 'debugger', {
        writable: false,
        value: GLOB.debugger
      })
    } else if (GLOB.sysType === 'cloud') {
      Object.defineProperty(GLOB, 'debugger', {
        writable: false,
        value: GLOB.debugger