From da305b2c5f325504b17e64f4cd4faf4f1427470e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 10 三月 2022 23:42:58 +0800 Subject: [PATCH] 2022-03-10 --- src/index.js | 54 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/index.js b/src/index.js index 033544f..6b7fa3e 100644 --- a/src/index.js +++ b/src/index.js @@ -83,44 +83,52 @@ if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) { GLOB.probation = true } + + if (!config.mainSystemApi) { + document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">绯荤粺鏈缃崟鐐瑰湴鍧�锛岃鑱旂郴绠$悊鍛橈紒</div>' + return + } else if (/http(s?):\/\/sso.mk9h.cn\/cloud/ig.test(config.mainSystemApi)) { + document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">姝e紡绯荤粺涓嶅彲浣跨敤 http://sso.mk9h.cn/cloud 鍋氫负鍗曠偣鍦板潃锛岃鑱旂郴绠$悊鍛橈紒</div>' + return + } else if (/http(s?):\/\/cloud.mk9h.cn/ig.test(config.mainSystemApi)) { + 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') { GLOB.probation = true GLOB.systemType = '' + + // GLOB.mainSystemApi = 'https://cloud.positecgroup.com/webapi/dostars' + + GLOB.mainSystemApi = 'http://sso.mk9h.cn/cloud/webapi/dostars' + + if (GLOB.watermark) { + GLOB.dataFormat = true + } } else { GLOB.systemType = '' + GLOB.mainSystemApi = '' + } + + if (options.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涓虹郴缁熻缃� GLOB.appkey = options.cakey - GLOB.mainSystemApi = '' } else if (options.sysType === 'SSO') { // sso涓嶅彲璁剧疆鍗曠偣鏈嶅姟鍣ㄥ湴鍧� - GLOB.mainSystemApi = '' - if (config.appkey === options.cakey) { - GLOB.appkey = '' - console.warn('鍗曠偣绯荤粺appkey涓嶅彲涓庝簯绔浉鍚�') - } else { - GLOB.appkey = config.appkey - } + GLOB.appkey = config.appkey } else if (options.sysType === 'local') { // 涓氬姟绯荤粺 - if (config.appkey === options.cakey) { - GLOB.appkey = '' - console.warn('涓氬姟绯荤粺appkey涓嶅彲涓庝簯绔浉鍚�') - } else { - GLOB.appkey = config.appkey - } - if (config.mainSystemApi) { + GLOB.appkey = config.appkey + if (GLOB.systemType === 'production') { let systemApi = config.mainSystemApi - // 涓氬姟绯荤粺涓嶅厑璁歌繛鎺ヤ簯绔紝涓氬姟绯荤粺杩炴帴sso.mk9h.cn鏃讹紝鏁版嵁铏氬寲澶勭悊 - if (systemApi.indexOf('cloud.mk9h.cn') > -1) { - systemApi = '' - } else if (/index.html/ig.test(systemApi)) { + if (/index.html/ig.test(systemApi)) { systemApi = systemApi.replace(/index.html.*/ig, 'webapi/dostars') } else if (!/webapi\/dostars$/ig.test(systemApi)) { systemApi = systemApi.replace(/\/?$/, '/webapi/dostars') - } - - if (systemApi.indexOf('sso.mk9h.cn') > -1 && GLOB.watermark) { - GLOB.dataFormat = true } GLOB.mainSystemApi = systemApi -- Gitblit v1.8.0