From d59f518f466274b2caeb2e01c10c92deafe7c93b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 二月 2022 11:48:29 +0800
Subject: [PATCH] 2022-02-09

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

diff --git a/src/index.js b/src/index.js
index 13aafa7..02692e1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -10,9 +10,7 @@
 import '@/assets/css/minkeicon.css'
 import '@/assets/css/viewstyle.scss'
 
-if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
-  window.location.replace(window.location.href.split(/(index.html)+/ig)[0] + 'mob/index.html')
-} else if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤�
+if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤�
   window.location.replace(window.location.href.replace(/design/ig, 'main'))
 }
 
@@ -36,7 +34,7 @@
   })())
 }
 
-const render  = Component => {
+const render = Component => {
   ReactDOM.render(
     <Provider store={store}>
       <Component/>
@@ -67,6 +65,13 @@
   .then(config => {
     if (!config) return
 
+    if (config.defaultApp) {
+      if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
+        window.location.replace(window.location.href.split(/(index.html)+/ig)[0].replace('admin/', '') + 'mob/index.html#/index')
+        return
+      }
+    }
+
     let GLOB = {}
     GLOB.appId = config.appId || ''
     GLOB.lineColor = config.lineColor || ''
@@ -85,6 +90,9 @@
       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 = ''
     }
@@ -127,12 +135,6 @@
     }
 
     let _href = window.location.href.split('#')[0]
-
-    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')
 
@@ -193,6 +195,19 @@
       GLOB.service = config.service
     }
 
+    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 (localStorage.getItem(_href + 'lang')) {
+      sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang'))
+    } else {
+      sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US')
+    }
+
     Object.defineProperty(GLOB, 'appId', {
       writable: false,
       value: GLOB.appId

--
Gitblit v1.8.0