From bf772e586c29b4858366dbad143b1eaeca3c46ed Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 四月 2020 10:18:09 +0800 Subject: [PATCH] 2020-04-17 --- src/index.js | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/index.js b/src/index.js index 972a1c4..927c10d 100644 --- a/src/index.js +++ b/src/index.js @@ -25,8 +25,31 @@ window.GLOB = window.GLOB || {} -if (!(options.systemType === 'local' && window.GLOB.systemType === 'official')) { +if (!(options.systemType === 'local' && window.GLOB.systemType === 'official')) { // 鍙湁涓氬姟绯荤粺鎵嶅彲浠ヨ缃负姝e紡绯荤粺 window.GLOB.systemType = 'test' +} +if (options.systemType !== 'local') { // sso,cloud涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� + window.GLOB.mainSystemApi = '' +} else if (options.systemType === 'local' && window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺 + let systemApi = window.GLOB.mainSystemApi + + if (/^(http|https):\/\//ig.test(systemApi)) { + let _systemApi = /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(systemApi) + + systemApi = _systemApi ? _systemApi[0] : '' + } else { + systemApi = '' + } + + if (systemApi && systemApi === /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(options.cloudServiceApi)[0]) { + window.GLOB.dataFormat = true + } + + if (systemApi) { + systemApi = systemApi + '/webapi/dostars' + } + + window.GLOB.mainSystemApi = systemApi } let _systemMsg = localStorage.getItem(window.location.href.split('#')[0] + 'system') @@ -76,14 +99,6 @@ if (window.GLOB.style && option[window.GLOB.style]) { document.getElementById('root').className = option[window.GLOB.style] } - -if (process.env.NODE_ENV === 'production') { - let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' - window.GLOB.subSystemApi = document.location.origin + '/' + service + 'webapi/dostars' -} else { - window.GLOB.subSystemApi = 'http://qingqiumarket.cn/mkwms/webapi/dostars' -} - sessionStorage.removeItem('isEditState') -- Gitblit v1.8.0