From f078c137d61270d243cd8e03077fa9cf000e276b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 14 八月 2023 14:02:40 +0800 Subject: [PATCH] 2023-08-14 --- src/index.js | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/index.js b/src/index.js index 866506c..1f80133 100644 --- a/src/index.js +++ b/src/index.js @@ -45,10 +45,6 @@ } } - if (options.cdomain && options.sysType !== 'cloud') { - options.cloudServiceApi = options.cdomain + '/webapi/dostars' - } - let GLOB = {} GLOB.appId = config.appId || '' GLOB.lineColor = config.lineColor || '' @@ -63,6 +59,12 @@ GLOB.WXNotice = config.WXNotice + '' === 'true' GLOB.accessToken = {} GLOB.mkHS = false + GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥 + + GLOB.sysType = options.sysType + if (GLOB.sysType !== 'cloud') { + GLOB.cloudServiceApi = options.cdomain + '/webapi/dostars' + } if (sessionStorage.getItem('externalDatabase')) { GLOB.externalDatabase = `[${sessionStorage.getItem('externalDatabase')}]..` @@ -73,7 +75,7 @@ } // 鍙湁涓氬姟绯荤粺鎵嶅彲浠ヨ缃负姝e紡绯荤粺 - if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) { + if (GLOB.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) { GLOB.systemType = 'production' if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) { GLOB.probation = true @@ -89,7 +91,7 @@ document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">姝e紡绯荤粺涓嶅彲浣跨敤 http://cloud.mk9h.cn 鍋氫负鍗曠偣鍦板潃锛岃鑱旂郴绠$悊鍛橈紒</div>' return } - } else if (options.sysType === 'local') { + } else if (GLOB.sysType === 'local') { GLOB.probation = true GLOB.systemType = '' @@ -108,25 +110,26 @@ GLOB.mainSystemApi = '' } - GLOB.debugger = options.sysType === 'local' && GLOB.systemType !== 'production' + GLOB.debugger = GLOB.sysType === 'local' && GLOB.systemType !== 'production' if (/#\/hs$/.test(window.location.href)) { // hs涓嬩笉鎵撳嵃鑴氭湰 GLOB.debugger = false } - if (options.sysType !== 'cloud') { + if (GLOB.sysType !== 'cloud') { if (config.appkey === options.cakey) { document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">涓嶅彲浣跨敤浜戠appkey锛岃鑱旂郴绠$悊鍛橈紒</div>' return } } - if (options.sysType === 'cloud') { // cloud涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧�,浜戠appkey涓虹郴缁熻缃� + if (GLOB.sysType === 'cloud') { // cloud涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧�,浜戠appkey涓虹郴缁熻缃� GLOB.appkey = options.cakey + GLOB.appId = options.caId GLOB.WXNotice = false - } else if (options.sysType === 'SSO') { // sso涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� + } else if (GLOB.sysType === 'SSO') { // sso涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� GLOB.appkey = config.appkey - } else if (options.sysType === 'local') { // 涓氬姟绯荤粺 + } else if (GLOB.sysType === 'local') { // 涓氬姟绯荤粺 GLOB.appkey = config.appkey if (GLOB.systemType === 'production') { let systemApi = config.mainSystemApi @@ -146,8 +149,6 @@ let _href = window.location.href.split('#')[0] let _systemMsg = localStorage.getItem(_href + 'system') - - GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥 let className = 'mk-blue-black' if (_systemMsg) { @@ -278,6 +279,14 @@ writable: false, value: GLOB.linkurl }) + Object.defineProperty(GLOB, 'sysType', { + writable: false, + value: GLOB.sysType + }) + Object.defineProperty(GLOB, 'cloudServiceApi', { + writable: false, + value: GLOB.cloudServiceApi || '' + }) Object.defineProperty(window, 'GLOB', { writable: false, value: GLOB -- Gitblit v1.8.0