From 6c56a138c17dc9aff9d175d20645eb176d2e024b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 03 三月 2021 19:03:18 +0800 Subject: [PATCH] 2021-03-03 --- src/index.js | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 9ae583b..f53f790 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,13 @@ 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.json' : './options.json') +fetch('../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 @@ -158,7 +160,7 @@ GLOB.webSite = _systemMsg.webSite GLOB.style = _systemMsg.style GLOB.showline = _systemMsg.showline || '' - GLOB.navBar = _systemMsg.navBar || 'sidemenu' + GLOB.navBar = _systemMsg.navBar || '' if (GLOB.favicon) { let link = document.querySelector("link[rel*='icon']") || document.createElement('link') @@ -186,7 +188,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