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 | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index e03e548..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 @@ -136,6 +138,10 @@ let _href = window.location.href.split('#')[0] + if (localStorage.getItem(_href + 'lang')) { + sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) + } + let _systemMsg = localStorage.getItem(_href + 'system') if (_systemMsg) { @@ -154,6 +160,7 @@ GLOB.webSite = _systemMsg.webSite GLOB.style = _systemMsg.style GLOB.showline = _systemMsg.showline || '' + GLOB.navBar = _systemMsg.navBar || '' if (GLOB.favicon) { let link = document.querySelector("link[rel*='icon']") || document.createElement('link') @@ -181,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