From 047dbd742341e268ca772eda8d2ff0b6ba09cb44 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 05 六月 2025 16:57:36 +0800
Subject: [PATCH] 2025-06-05

---
 src/index.js |  185 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 131 insertions(+), 54 deletions(-)

diff --git a/src/index.js b/src/index.js
index 4e4ecfd..6322aed 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,29 +1,34 @@
 import React from 'react'
 import ReactDOM from 'react-dom'
+import { ConfigProvider } from 'antd'
+import zhCN from 'antd/es/locale/zh_CN'
+
 import Route from './router'
 import md5 from 'md5'
 import * as serviceWorker from './serviceWorker'
-import options, { styles } from '@/store/options.js'
+import options, { styles, langs } from '@/store/options.js'
 import '@/assets/css/main.scss'
 import '@/assets/css/action.scss'
 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('')
-  })())
-}
+  })()
 
-const render = Component => {
-  ReactDOM.render(
-    <Component/>,
-    document.getElementById('root')
-  )
+  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)
+
 }
 
 fetch('../options.json')
@@ -41,6 +46,8 @@
       }
     }
 
+    config.keepPwd = config.keepPwd || config.keepPassword
+
     let GLOB = {}
     GLOB.appId = config.appId || ''
     GLOB.lineColor = config.lineColor || ''
@@ -48,20 +55,32 @@
     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.accessToken = {}
     GLOB.mkHS = false
     GLOB.debugger = false
     GLOB.dataFormat = false
     GLOB.upStatus = false
     GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥
     GLOB.style = 'bg_black_style_blue'
-    GLOB.defLang = config.defaultLang
+    GLOB.defLang = ''
+
+    if (config.WXApps) {
+      config.WXApps = config.WXApps.filter(app => app.appId && app.appName && ['public', 'miniProgram', 'merchant'].includes(app.appType))
+      if (config.WXApps.length) {
+        GLOB.WXApps = config.WXApps
+      }
+    }
+
+    if (langs[config.defaultLang]) {
+      GLOB.defLang = config.defaultLang
+    }
 
     GLOB.sysType = options.sysType
     if (GLOB.sysType !== 'cloud') {
@@ -76,10 +95,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
     }
 
@@ -102,6 +121,10 @@
       GLOB.debugger = true
       GLOB.systemType = ''
       GLOB.upStatus = config.updateStatus + '' !== 'false'
+
+      if (config.style_appkey) {
+        GLOB.style_appkey = config.style_appkey
+      }
 
       // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars'
 
@@ -147,6 +170,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涓嬩笉鎵撳嵃鑴氭湰
@@ -159,10 +186,47 @@
       if (GLOB.cloudServiceApi) {
         GLOB.mainSystemApi = GLOB.cloudServiceApi
       }
+
+      if (config.systemRun === 'backend') {
+        config.systemRun = '' // hs 涓嶄娇鐢ㄥ悗绔浛鎹�
+        GLOB.backend = true
+      }
     }
 
-    let _href = window.location.href.split('#')[0]
-    let _systemMsg = localStorage.getItem(_href + 'system')
+    if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄�
+      let _service = window.location.href.replace(/\/admin(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '')
+      GLOB.service = _service ? _service + '/' : ''
+      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
+      GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '')
+      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)
+
+    if (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) {
+      GLOB.localkey = GLOB.appkey
+      GLOB.appkey = config.mainkey
+    }
+
+    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 + '/'
+
+    let _systemMsg = localStorage.getItem(GLOB.sysSign + 'system')
     let className = 'mk-blue-black'
 
     if (_systemMsg) {
@@ -179,10 +243,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]
@@ -221,42 +289,16 @@
 
     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
     }
 
-    if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄�
-      let _service = window.location.href.replace(/\/admin(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '')
-      GLOB.service = _service ? _service + '/' : ''
-      GLOB.host = window.location.host + (_service ? '_' + _service : '')
-      GLOB.baseurl = document.location.origin + '/' + GLOB.service
-      GLOB.linkurl = GLOB.baseurl + 'index.html'
-    } else {
-      GLOB.location = config.host
-      GLOB.service = config.service
-      GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '')
-      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)
+    if (lang !== 'zh-CN') {
+      GLOB.WXNotice = false
     }
 
-    if (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) {
-      GLOB.localkey = GLOB.appkey
-      GLOB.appkey = config.mainkey
-    }
-
-    let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US')
-    sessionStorage.setItem('lang', lang)
-
-    if (localStorage.getItem(_href + 'files') === md5(_href + 'files')) {
-      let d = localStorage.getItem(_href + 'filesDate')
+    if (localStorage.getItem(GLOB.sysSign + 'files') === md5(GLOB.sysSign + 'files')) {
+      let d = localStorage.getItem(GLOB.sysSign + 'filesDate')
 
       GLOB.storeFiles = true
       GLOB.storeDate = Math.ceil((new Date(d).getTime() - new Date().getTime()) / 86400000)
@@ -282,8 +324,8 @@
 
     GLOB.dict = {}
 
-    if (localStorage.getItem(_href + 'js_trans')) {
-      let js_trans = JSON.parse(localStorage.getItem(_href + 'js_trans'))
+    if (localStorage.getItem(GLOB.sysSign + 'js_trans')) {
+      let js_trans = JSON.parse(localStorage.getItem(GLOB.sysSign + 'js_trans'))
 
       js_trans.forEach(item => {
         if (lang !== item.lang) return
@@ -331,13 +373,36 @@
       GLOB.memberLevel = 0
     }
 
-    if (GLOB.sysType === 'cloud') {
+    if (config.systemRun === 'backend') {
+      if (sessionStorage.getItem('systemRun') === 'front') {
+        GLOB.debugger = true
+      } else {
+        GLOB.debugger = false
+        Object.defineProperty(window, 'backend', {
+          writable: false,
+          value: true
+        })
+      }
+    }
+    if (config.debugger === 'forbid') {
+      sessionStorage.removeItem('breakpoint')
+      GLOB.debugger = false
+
       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
@@ -360,7 +425,19 @@
     window.GLOB.SyncData = new Map()     // 瀛樺偍鍚屾鏌ヨ鏁版嵁
     window.GLOB.mkThdMenus = new Map()   // 涓夌骇鑿滃崟
 
-    render(Route)
+    if (lang === 'zh-CN' || !/#\/(login|main|billprint|docprint|tab\/|iframe|view|ssologin)/.test(window.location.href)) { // 寮�鍙戜娇鐢ㄤ腑鏂�
+      ReactDOM.render(
+        <ConfigProvider locale={zhCN}>
+          <Route/>
+        </ConfigProvider>,
+        document.getElementById('root')
+      )
+    } else {
+      ReactDOM.render(
+        <Route/>,
+        document.getElementById('root')
+      )
+    }
   })
 
 serviceWorker.unregister()

--
Gitblit v1.8.0