From 08929dbc66fb157307921026974c459f762209e2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 25 二月 2021 15:31:24 +0800 Subject: [PATCH] 2021-02-25 --- src/index.js | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 9ae583b..388d2c3 100644 --- a/src/index.js +++ b/src/index.js @@ -45,7 +45,6 @@ ) } - if (sessionStorage.getItem('loginError')) { try { let res = JSON.parse(sessionStorage.getItem('loginError')) @@ -58,10 +57,12 @@ sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '') sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '') -fetch(`./options.json`) +// 娴嬭瘯绯荤粺鏂囦欢缃簬admin涓� + +fetch(process.env.NODE_ENV === 'production' && options.sysType === 'local' ? '../options.json' : './options.json') .then(response => response.json()) .catch(() => { - console.warn('绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒') + document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒</div>' }) .then(config => { if (!config) return @@ -186,7 +187,7 @@ } if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄� - let _service = window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '') + 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' -- Gitblit v1.8.0