From 9cf5fc474d2159aad973e3208fbef670f325307f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 十一月 2020 17:57:41 +0800
Subject: [PATCH] 2020-11-25

---
 src/index.js |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/index.js b/src/index.js
index ad4f31a..4ca1c39 100644
--- a/src/index.js
+++ b/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,18 @@
   )
 }
 
-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')
+
+fetch(`./options.json`)
   .then(response => response.json())
   .catch(() => {
     console.warn('绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒')
@@ -57,6 +66,12 @@
     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 || ''
+    } else {
+      GLOB.externalDatabase = null
+    }
 
     // 鍙湁涓氬姟绯荤粺鎵嶅彲浠ヨ缃负姝e紡绯荤粺
     if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) {
@@ -106,7 +121,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
         }
       
@@ -114,7 +129,9 @@
       }
     }
 
-    let _systemMsg = localStorage.getItem(window.location.href.split('#')[0] + 'system')
+    let _href = window.location.href.split('#')[0]
+
+    let _systemMsg = localStorage.getItem(_href + 'system')
 
     if (_systemMsg) {
       try {
@@ -156,7 +173,7 @@
 
     if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄�
       let _service = window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '')
-      GLOB.linkurl = window.location.href.split('#')[0]
+      GLOB.linkurl = _href
       if (!/index.html/ig.test(GLOB.linkurl)) {
         GLOB.linkurl = GLOB.linkurl + 'index.html'
       }
@@ -167,12 +184,8 @@
       GLOB.service = 'mkwms/'
     }
 
-    const option = {
-      white: 'mk-white'
-    }
-
-    if (GLOB.style && option[GLOB.style]) {
-      document.getElementById('root').className = option[GLOB.style]
+    if (GLOB.style && options.styles[GLOB.style]) {
+      document.getElementById('root').className = options.styles[GLOB.style]
     }
 
     Object.defineProperty(GLOB, 'appId', {

--
Gitblit v1.8.0