From 1a176e4bdba485301385caac1a29102e598d25cc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 13 五月 2025 11:32:02 +0800
Subject: [PATCH] 2025-05-13

---
 src/index.js |  135 ++++++++++++++++++++++++++++----------------
 1 files changed, 86 insertions(+), 49 deletions(-)

diff --git a/src/index.js b/src/index.js
index ff118aa..d5e094b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -12,15 +12,37 @@
 import '@/assets/css/viewstyle.scss'
 
 if (!localStorage.getItem('SessionUid')) {
-  localStorage.setItem('SessionUid', (() => {
+  let sid = (() => {
     let uuid = []
     let _options = '0123456789abcdefghigklmnopqrstuv'
     for (let i = 0; i < 32; i++) {
       uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
     }
     return uuid.join('')
-  })())
+  })()
+
+  if (/_mk_sid=[0-9a-z]{32}/.test(document.cookie)) {
+    sid = document.cookie.match(/_mk_sid=[0-9a-z]{32}/)[0].split('=')[1]
+  } else {
+    document.cookie = '_mk_sid=' + sid
+  }
+
+  localStorage.setItem('SessionUid', sid)
+
 }
+
+sessionStorage.setItem('UserID', localStorage.getItem('UserID') || '')
+sessionStorage.setItem('LoginUID', localStorage.getItem('LoginUID') || '')
+sessionStorage.setItem('User_Name', localStorage.getItem('User_Name') || '')
+sessionStorage.setItem('Full_Name', localStorage.getItem('Full_Name') || '')
+sessionStorage.setItem('avatar', localStorage.getItem('avatar') || '')
+sessionStorage.setItem('dataM', localStorage.getItem('dataM') || '')
+sessionStorage.setItem('localDataM', localStorage.getItem('localDataM') || '')
+sessionStorage.setItem('debug', localStorage.getItem('debug') || '')
+sessionStorage.setItem('role_id', localStorage.getItem('role_id') || '')
+sessionStorage.setItem('departmentcode', localStorage.getItem('departmentcode') || '')
+sessionStorage.setItem('organization', localStorage.getItem('organization') || '')
+sessionStorage.setItem('mk_user_type', localStorage.getItem('mk_user_type') || '')
 
 fetch('../options.json')
   .then(response => response.json())
@@ -37,6 +59,8 @@
       }
     }
 
+    config.keepPwd = config.keepPwd || config.keepPassword
+
     let GLOB = {}
     GLOB.appId = config.appId || ''
     GLOB.lineColor = config.lineColor || ''
@@ -44,12 +68,13 @@
     GLOB.probation = false
     GLOB.watermark = config.watermark + '' !== 'false'
     GLOB.transfer = config.transfer + '' === 'true'
-    GLOB.keepKey = config.keepPassword + '' !== 'false'
-    GLOB.nginx = config.nginx + '' === 'true'
+    GLOB.keepKey = config.keepPwd + '' !== 'false'
+    GLOB.vispwd = config.keepPwd + '' !== 'invisible'
     GLOB.WXAppID = config.WXAppID || ''
     GLOB.WXminiAppID = config.WXminiAppID || ''
     GLOB.WXMerchID = config.WXMerchID || ''
     GLOB.WXNotice = config.WXNotice + '' === 'true'
+    GLOB.SysNotice = config.SysNotice + '' === 'true'
     GLOB.execType = config.execType === 'x' ? 'x' : ''
     GLOB.mkHS = false
     GLOB.debugger = false
@@ -83,10 +108,10 @@
       GLOB.externalDatabase = null
     }
 
-    if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) {
+    if (config.probation && /^[1-9]\d{3}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) {
       GLOB.probation = true
     }
-    if (config.forcedUpdate && /^20\d{2}-\d{2}-\d{2}$/.test(config.forcedUpdate) && new Date(config.forcedUpdate).getTime() > new Date().getTime()) {
+    if (config.forcedUpdate && /^[1-9]\d{3}-\d{2}-\d{2}$/.test(config.forcedUpdate) && new Date(config.forcedUpdate).getTime() > new Date().getTime()) {
       GLOB.forcedUpdate = true
     }
 
@@ -106,16 +131,20 @@
       GLOB.systemType = 'production'
     } else if (GLOB.sysType === 'local') {
       GLOB.probation = true
-      GLOB.debugger = true
+      // GLOB.debugger = true
       GLOB.systemType = ''
       GLOB.upStatus = config.updateStatus + '' !== 'false'
 
-      // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars'
+      GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars'
 
-      GLOB.mainSystemApi = 'https://sso.mk9h.cn/cloud/webapi/dostars'
-      if (!/^https/.test(window.location.protocol)) { // https杞崲
-        GLOB.mainSystemApi = 'http://sso.mk9h.cn/cloud/webapi/dostars'
+      if (config.style_appkey) {
+        GLOB.style_appkey = config.style_appkey
       }
+      
+      // GLOB.mainSystemApi = 'https://sso.mk9h.cn/cloud/webapi/dostars'
+      // if (!/^https/.test(window.location.protocol)) { // https杞崲
+      //   GLOB.mainSystemApi = 'http://sso.mk9h.cn/cloud/webapi/dostars'
+      // }
 
       if (GLOB.watermark) {
         GLOB.dataFormat = true
@@ -154,6 +183,10 @@
       
         GLOB.mainSystemApi = systemApi
       }
+
+      if (config.errorLog === 'true' && /#\/(login|main|billprint|docprint|tab|iframe|view|ssologin)/.test(window.location.href)) {
+        GLOB.errorLog = true
+      }
     }
 
     if (/#\/hs$/.test(window.location.href)) { // hs涓嬩笉鎵撳嵃鑴氭湰
@@ -166,6 +199,11 @@
       if (GLOB.cloudServiceApi) {
         GLOB.mainSystemApi = GLOB.cloudServiceApi
       }
+
+      if (config.systemRun === 'backend') {
+        config.systemRun = '' // hs 涓嶄娇鐢ㄥ悗绔浛鎹�
+        GLOB.backend = true
+      }
     }
 
     if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄�
@@ -174,6 +212,7 @@
       GLOB.host = window.location.host + (_service ? '_' + _service : '')
       GLOB.baseurl = document.location.origin + '/' + GLOB.service
       GLOB.linkurl = GLOB.baseurl + 'index.html'
+      GLOB.location = document.location.origin
     } else {
       GLOB.location = config.host
       GLOB.service = config.service
@@ -181,21 +220,21 @@
       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
       GLOB.appkey = config.mainkey
     }
 
-    let lang = localStorage.getItem(window.location.href.split('#')[0] + 'lang') || GLOB.defLang || 'zh-CN'
+    let lang = sessionStorage.getItem('lang') || localStorage.getItem(window.location.href.split('#')[0] + 'lang') || GLOB.defLang || 'zh-CN'
     sessionStorage.setItem('lang', lang)
 
     GLOB.sysSign = GLOB.service + 'admin/' + lang + '/'
@@ -217,10 +256,14 @@
         GLOB.mainlogo = _systemMsg.mainlogo
         GLOB.doclogo = _systemMsg.doclogo
         GLOB.webSite = _systemMsg.webSite
+        GLOB.prolType = _systemMsg.prolType || ''
+        GLOB.prolCont = _systemMsg.prolCont || ''
         GLOB.style = _systemMsg.style || 'bg_black_style_blue'
         GLOB.showline = _systemMsg.showline || ''
         GLOB.navBar = _systemMsg.navBar || 'shutter'
         GLOB.appVersion = _systemMsg.app_version || ''
+        GLOB.loginOtop = _systemMsg.loginOtop || ''
+        GLOB.loginOleft = _systemMsg.loginOleft || ''
         sessionStorage.setItem('appname', _systemMsg.appname || '')
 
         let levels = [30, 10, 20, 40, 50, 60, 70, 80, 90, 100]
@@ -250,7 +293,7 @@
 
     document.body.className = className
 
-    if (/^https/.test(window.location.protocol)) { // https杞崲
+    if (/^https/.test(window.location.protocol) || (process.env.NODE_ENV !== 'production' && /^https/.test(config.host))) { // https杞崲
       let meta = document.createElement('meta')
       meta.content = 'upgrade-insecure-requests'
       meta.httpEquiv = 'Content-Security-Policy'
@@ -259,7 +302,7 @@
 
     document.title = GLOB.platTitle || ''
 
-    if (config.filter === 'true' || (/^20\d{2}-\d{2}-\d{2}$/.test(config.filter) && new Date(config.filter).getTime() + 86400000 >= new Date().getTime())) {
+    if (config.filter === 'true' || (/^[1-9]\d{3}-\d{2}-\d{2}$/.test(config.filter) && new Date(config.filter).getTime() + 86400000 >= new Date().getTime())) {
       GLOB.filter = true
     }
 
@@ -343,42 +386,36 @@
       GLOB.memberLevel = 0
     }
 
-    if (config.devTools === false) {
-      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
+    if (config.systemRun === 'backend') {
+      if (sessionStorage.getItem('systemRun') === 'front') {
+        GLOB.debugger = true
       } 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)
-          }
+        GLOB.debugger = false
+        Object.defineProperty(window, 'backend', {
+          writable: false,
+          value: true
         })
       }
     }
+    if (config.debugger === 'forbid') {
+      sessionStorage.removeItem('breakpoint')
+      GLOB.debugger = false
 
-    if (GLOB.sysType === 'cloud') {
       Object.defineProperty(GLOB, 'debugger', {
         writable: false,
         value: GLOB.debugger
       })
-
-      GLOB.breakpoint = false
+    } else if (GLOB.sysType === 'cloud') {
+      if (sessionStorage.getItem('cloudRun') === 'debug') {
+        GLOB.debugger = true
+      } else {
+        Object.defineProperty(GLOB, 'debugger', {
+          writable: false,
+          value: GLOB.debugger
+        })
+  
+        GLOB.breakpoint = false
+      }
     } else {
       if (sessionStorage.getItem('breakpoint')) {
         GLOB.debugger = true
@@ -401,7 +438,7 @@
     window.GLOB.SyncData = new Map()     // 瀛樺偍鍚屾鏌ヨ鏁版嵁
     window.GLOB.mkThdMenus = new Map()   // 涓夌骇鑿滃崟
 
-    if (lang === 'zh-CN' || !/#\/(login|main|billprint|docprint|tab|iframe|view|ssologin)/.test(window.location.href)) { // 寮�鍙戜娇鐢ㄤ腑鏂�
+    if (lang === 'zh-CN' || !/#\/(login|main|billprint|docprint|tab\/|iframe|view|ssologin)/.test(window.location.href)) { // 寮�鍙戜娇鐢ㄤ腑鏂�
       ReactDOM.render(
         <ConfigProvider locale={zhCN}>
           <Route/>

--
Gitblit v1.8.0