king
2021-01-04 c986f2f56bb153a9b6cebc74b4d9334c85ddfdda
src/index.js
@@ -1,7 +1,7 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Route from './router'
import {Provider} from 'react-redux'
import { Provider } from 'react-redux'
import store from '@/store'
import * as serviceWorker from './serviceWorker'
import options from '@/store/options.js'
@@ -43,9 +43,19 @@
  )
}
sessionStorage.removeItem('isEditState')
// fetch(`./${process.env.NODE_ENV === 'production' ? 'build/' : ''}options.json`)
if (sessionStorage.getItem('loginError')) {
  try {
    let res = JSON.parse(sessionStorage.getItem('loginError'))
    console.info(res.request)
    console.info(res.response)
  } catch {}
}
sessionStorage.removeItem('isEditState')
sessionStorage.removeItem('loginError')
sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '')
sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '')
fetch(`./options.json`)
  .then(response => response.json())
  .catch(() => {
@@ -58,6 +68,13 @@
    GLOB.appId = config.appId || ''
    GLOB.lineColor = config.lineColor || ''
    GLOB.filter = config.filter || ''
    if (config.externalDatabase !== false && config.externalDatabase !== 'false' && config.externalDatabase !== undefined) {
      GLOB.externalDatabase = config.externalDatabase ? `[${config.externalDatabase}]..` : ''
    } else {
      GLOB.externalDatabase = null
    }
    // 只有业务系统才可以设置为正式系统
    if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) {
@@ -107,7 +124,7 @@
        // 业务系统不允许连接云端,业务系统连接sso.mk9h.cn时,数据虚化处理
        if (systemApi && systemApi.indexOf('cloud.mk9h.cn') > -1) {
          systemApi = ''
        } else if (systemApi && systemApi.indexOf('sso.mk9h.cn') > -1) {
        } else if (systemApi && systemApi.indexOf('sso.mk9h.cn') > -1 && process.env.NODE_ENV === 'production') {
          GLOB.dataFormat = true
        }
      
@@ -134,6 +151,7 @@
        GLOB.doclogo = _systemMsg.doclogo
        GLOB.webSite = _systemMsg.webSite
        GLOB.style = _systemMsg.style
        GLOB.showline = _systemMsg.showline || ''
        if (GLOB.favicon) {
          let link = document.querySelector("link[rel*='icon']") || document.createElement('link')
@@ -141,6 +159,9 @@
          link.rel = 'shortcut icon'
          link.href = GLOB.favicon
          document.getElementsByTagName('head')[0].appendChild(link)
        }
        if (GLOB.style && options.styles[GLOB.style]) {
          document.body.className = options.styles[GLOB.style] + ' ' + (GLOB.showline === 'false' ? 'hidden-split-line' : '')
        }
      } catch {
        console.warn('Parse Failure')
@@ -166,7 +187,7 @@
      GLOB.service = _service ? _service + '/' : ''
    } else {
      GLOB.linkurl = ''
      GLOB.location = 'http://qingqiumarket.cn/'
      GLOB.location = 'http://qingqiumarket.cn'
      GLOB.service = 'mkwms/'
    }