From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/index.js |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/index.js b/src/index.js
index fcc809d..c5526ea 100644
--- a/src/index.js
+++ b/src/index.js
@@ -50,16 +50,16 @@
     let res = JSON.parse(sessionStorage.getItem('loginError'))
     console.info(res.request)
     console.info(res.response)
-  } catch {}
+  } catch (e) {}
 }
 sessionStorage.removeItem('isEditState')
 sessionStorage.removeItem('loginError')
 sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '')
 sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '')
 
-// 鏂扮郴缁熸枃浠剁疆浜巃dmin涓� ../options.json
+// 鏂扮郴缁熸枃浠剁疆浜巃dmin涓� ../options.json , { cache: 'no-cache'}
 
-fetch('./options.json')
+fetch('../options.json')
   .then(response => response.json())
   .catch(() => {
     document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒</div>'
@@ -70,6 +70,8 @@
     let GLOB = {}
     GLOB.appId = config.appId || ''
     GLOB.lineColor = config.lineColor || ''
+    GLOB.licenseKey = config.licenseKey || ''
+    GLOB.probation = false
 
     if (config.externalDatabase !== false && config.externalDatabase !== 'false' && config.externalDatabase !== undefined) {
       GLOB.externalDatabase = config.externalDatabase ? `[${config.externalDatabase}]..` : ''
@@ -80,6 +82,12 @@
     // 鍙湁涓氬姟绯荤粺鎵嶅彲浠ヨ缃负姝e紡绯荤粺
     if (options.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
+      }
+    } else if (options.sysType === 'local') {
+      GLOB.probation = true
+      GLOB.systemType = ''
     } else {
       GLOB.systemType = ''
     }
@@ -105,9 +113,15 @@
       if (config.mainSystemApi) {
         let systemApi = config.mainSystemApi
         // 涓氬姟绯荤粺涓嶅厑璁歌繛鎺ヤ簯绔紝涓氬姟绯荤粺杩炴帴sso.mk9h.cn鏃讹紝鏁版嵁铏氬寲澶勭悊
-        if (systemApi && systemApi.indexOf('cloud.mk9h.cn') > -1) {
+        if (systemApi.indexOf('cloud.mk9h.cn') > -1) {
           systemApi = ''
-        } else if (systemApi && systemApi.indexOf('sso.mk9h.cn') > -1 && process.env.NODE_ENV === 'production') {
+        } else if (/index.html/ig.test(systemApi)) {
+          systemApi = systemApi.replace(/index.html.*/ig, 'webapi/dostars')
+        } else if (!/webapi\/dostars$/ig.test(systemApi)) {
+          systemApi = systemApi.replace(/\/?$/, '/webapi/dostars')
+        }
+
+        if (systemApi.indexOf('sso.mk9h.cn') > -1 && process.env.NODE_ENV === 'production') {
           GLOB.dataFormat = true
         }
       
@@ -119,6 +133,8 @@
 
     if (localStorage.getItem(_href + 'lang')) {
       sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang'))
+    } else {
+      sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US')
     }
 
     let _systemMsg = localStorage.getItem(_href + 'system')
@@ -140,6 +156,7 @@
         GLOB.style = _systemMsg.style
         GLOB.showline = _systemMsg.showline || ''
         GLOB.navBar = _systemMsg.navBar || ''
+        GLOB.appVersion = _systemMsg.app_version || ''
 
         if (GLOB.favicon) {
           let link = document.querySelector("link[rel*='icon']") || document.createElement('link')
@@ -151,7 +168,7 @@
         if (GLOB.style && styles[GLOB.style]) {
           document.body.className = styles[GLOB.style] + ' ' + (GLOB.showline === 'false' ? 'hidden-split-line' : '')
         }
-      } catch {
+      } catch (e) {
         console.warn('Parse Failure')
       }
     }

--
Gitblit v1.8.0