From 2e7feae2677d93a7e1ac2bedb4c9e5de35b6c054 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 03 四月 2025 09:34:58 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/index.js | 86 ++++++++++++++++++++++++++++++------------- 1 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/index.js b/src/index.js index 36ff7ed..6d53a51 100644 --- a/src/index.js +++ b/src/index.js @@ -12,14 +12,23 @@ 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) + } fetch('../options.json') @@ -52,6 +61,7 @@ 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 @@ -108,16 +118,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 @@ -156,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涓嬩笉鎵撳嵃鑴氭湰 @@ -168,6 +186,11 @@ if (GLOB.cloudServiceApi) { GLOB.mainSystemApi = GLOB.cloudServiceApi } + + if (config.systemRun === 'backend') { + config.systemRun = '' // hs 涓嶄娇鐢ㄥ悗绔浛鎹� + GLOB.backend = true + } } if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄� @@ -176,6 +199,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 @@ -183,14 +207,14 @@ 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 @@ -223,6 +247,8 @@ 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] @@ -252,7 +278,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' @@ -346,11 +372,15 @@ } if (config.systemRun === 'backend') { - GLOB.debugger = false - Object.defineProperty(window, 'backend', { - writable: false, - value: true - }) + 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') @@ -361,12 +391,16 @@ value: GLOB.debugger }) } else if (GLOB.sysType === 'cloud') { - Object.defineProperty(GLOB, 'debugger', { - writable: false, - value: GLOB.debugger - }) - - GLOB.breakpoint = false + 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 -- Gitblit v1.8.0