From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 十月 2022 14:41:06 +0800 Subject: [PATCH] 2022-10-12 --- src/index.js | 56 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/index.js b/src/index.js index 65b760a..ee1ef18 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ import ReactDOM from 'react-dom' import Route from './router' import { Provider } from 'react-redux' +import md5 from 'md5' import store from '@/store' import * as serviceWorker from './serviceWorker' import options, { styles } from '@/store/options.js' @@ -69,10 +70,16 @@ GLOB.lineColor = config.lineColor || '' GLOB.licenseKey = config.licenseKey || '' GLOB.probation = false - GLOB.watermark = config.watermark !== false - GLOB.keepKey = config.keepPassword !== 'false' + GLOB.watermark = config.watermark + '' !== 'false' + GLOB.transfer = config.transfer + '' === 'true' + GLOB.keepKey = config.keepPassword + '' !== 'false' + GLOB.nginx = config.nginx + '' === 'true' + GLOB.WXAppID = config.WXAppID || '' + GLOB.WXminiAppID = config.WXminiAppID || '' + GLOB.accessToken = {} + GLOB.mkHS = false - if (config.externalDatabase !== false && config.externalDatabase !== 'false' && config.externalDatabase !== undefined) { + if (config.externalDatabase + '' !== 'false' && config.externalDatabase !== undefined) { GLOB.externalDatabase = config.externalDatabase ? `[${config.externalDatabase}]..` : '' } else { GLOB.externalDatabase = null @@ -101,7 +108,7 @@ // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' - GLOB.mainSystemApi = 'http://sso.mk9h.cn/cloud/webapi/dostars' + GLOB.mainSystemApi = 'https://sso.mk9h.cn/cloud/webapi/dostars' if (GLOB.watermark) { GLOB.dataFormat = true @@ -112,6 +119,10 @@ } GLOB.debugger = options.sysType === 'local' && GLOB.systemType !== 'production' + + if (/#\/hs$/.test(window.location.href)) { // hs涓嬩笉鎵撳嵃鑴氭湰 + GLOB.debugger = false + } if (options.sysType !== 'cloud') { if (config.appkey === options.cakey) { @@ -194,18 +205,17 @@ } if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄� - let _service = window.location.href.replace(/(\/admin)?\/index.html(.*)|(\/admin)?\/#(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '') - GLOB.linkurl = _href - if (!/index.html/ig.test(GLOB.linkurl)) { - GLOB.linkurl = GLOB.linkurl + 'index.html' - } + 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.linkurl = '' 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 } let mark = sessionStorage.getItem('system_mark') @@ -219,6 +229,29 @@ sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) } else { sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') + } + + let _level = 10 + let _Mlevel = sessionStorage.getItem('Member_Level') + + if (_Mlevel) { + if (_Mlevel === md5('mksoft' + GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + 10)) { + _level = 10 + } else if (_Mlevel === md5('mksoft' + GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + 20)) { + _level = 20 + } else if (_Mlevel === md5('mksoft' + GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + 30)) { + _level = 30 + } + } + GLOB.memberLevel = _level + GLOB.mkThdMenus = [] // 涓夌骇鑿滃崟 + GLOB.mkActions = {} // 鎸夐挳鏉冮檺闆� + + if (sessionStorage.getItem('breakpoint')) { + window.debugger = true + GLOB.breakpoint = sessionStorage.getItem('breakpoint') + } else { + GLOB.breakpoint = false } Object.defineProperty(GLOB, 'appId', { @@ -245,10 +278,6 @@ writable: false, value: GLOB.linkurl }) - Object.defineProperty(GLOB, 'dataFormat', { - writable: false, - value: GLOB.dataFormat - }) Object.defineProperty(window, 'GLOB', { writable: false, value: GLOB @@ -256,6 +285,7 @@ window.GLOB.CacheMap = new Map() // 缂撳瓨閰嶇疆淇℃伅 window.GLOB.UserCacheMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夎缃� + window.GLOB.CacheData = new Map() // 瀛樺偍閫変腑鏁版嵁 render(Route) }) -- Gitblit v1.8.0