From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/index.js | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index b75a85e..fd5d16d 100644 --- a/src/index.js +++ b/src/index.js @@ -10,9 +10,7 @@ import '@/assets/css/minkeicon.css' import '@/assets/css/viewstyle.scss' -if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { - window.location.replace(window.location.href.split(/(index.html)+/ig)[0] + 'mob/index.html') -} else if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤� +if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤� window.location.replace(window.location.href.replace(/design/ig, 'main')) } @@ -36,7 +34,7 @@ })()) } -const render = Component => { +const render = Component => { ReactDOM.render( <Provider store={store}> <Component/> @@ -81,6 +79,13 @@ }) .then(config => { if (!config) return + + if (config.defaultApp) { + if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { + window.location.replace(window.location.href.split(/(index.html)+/ig)[0].replace('admin/', '') + 'mob/index.html#/index') + return + } + } let GLOB = {} GLOB.appId = config.appId || '' @@ -146,12 +151,6 @@ let _href = window.location.href.split('#')[0] - if (localStorage.getItem(_href + 'lang')) { - sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) - } else { - sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') - } - let _systemMsg = localStorage.getItem(_href + 'system') if (_systemMsg) { @@ -211,6 +210,19 @@ GLOB.service = config.service } + let mark = sessionStorage.getItem('system_mark') + let _mark = `sys_${GLOB.service.replace('/', '') || 'service'}` + if (mark && mark !== _mark) { + sessionStorage.clear() + } + sessionStorage.setItem('system_mark', _mark) + + if (localStorage.getItem(_href + 'lang')) { + sessionStorage.setItem('lang', localStorage.getItem(_href + 'lang')) + } else { + sessionStorage.setItem('lang', config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') + } + Object.defineProperty(GLOB, 'appId', { writable: false, value: GLOB.appId -- Gitblit v1.8.0