From 9ff5920c0a58771219b134a7b46b7d0c1e1542ad Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 19 六月 2024 23:50:13 +0800 Subject: [PATCH] 2024-06-19 --- src/index.js | 73 +++++++++++++++++++----------------- 1 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/index.js b/src/index.js index 6645ba6..3fd7db9 100644 --- a/src/index.js +++ b/src/index.js @@ -165,8 +165,39 @@ } } - let _href = window.location.href.split('#')[0] - let _systemMsg = localStorage.getItem(_href + 'system') + if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄� + let _service = window.location.href.replace(/\/admin(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '') + GLOB.service = _service ? _service + '/' : '' + GLOB.host = window.location.host + (_service ? '_' + _service : '') + GLOB.baseurl = document.location.origin + '/' + GLOB.service + GLOB.linkurl = GLOB.baseurl + 'index.html' + } else { + GLOB.location = config.host + GLOB.service = config.service + GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') + GLOB.baseurl = GLOB.location + '/' + GLOB.service + GLOB.linkurl = GLOB.baseurl + 'index.html' + GLOB.dataFormat = false + + 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 (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) { + GLOB.localkey = GLOB.appkey + GLOB.appkey = config.mainkey + } + + let lang = localStorage.getItem(window.location.href.split('#')[0] + 'lang') || GLOB.defLang || 'zh-CN' + sessionStorage.setItem('lang', lang) + + GLOB.sysSign = GLOB.service + 'admin/' + lang + '/' + + let _systemMsg = localStorage.getItem(GLOB.sysSign + 'system') let className = 'mk-blue-black' if (_systemMsg) { @@ -229,38 +260,12 @@ GLOB.filter = true } - if (process.env.NODE_ENV === 'production') { // 鐢ㄤ簬鏍¢獙鏄惁瀛樺湪寮�鍙戞潈闄� - let _service = window.location.href.replace(/\/admin(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '') - GLOB.service = _service ? _service + '/' : '' - GLOB.host = window.location.host + (_service ? '_' + _service : '') - GLOB.baseurl = document.location.origin + '/' + GLOB.service - GLOB.linkurl = GLOB.baseurl + 'index.html' - } else { - GLOB.location = config.host - GLOB.service = config.service - GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '') - GLOB.baseurl = GLOB.location + '/' + GLOB.service - GLOB.linkurl = GLOB.baseurl + 'index.html' - GLOB.dataFormat = false - - 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 (lang !== 'zh-CN') { + GLOB.WXNotice = false } - if (config.mainkey && GLOB.sysType !== 'cloud' && config.mainkey !== options.cakey) { - GLOB.localkey = GLOB.appkey - GLOB.appkey = config.mainkey - } - - let lang = localStorage.getItem(_href + 'lang') || GLOB.defLang || 'zh-CN' - sessionStorage.setItem('lang', lang) - - if (localStorage.getItem(_href + 'files') === md5(_href + 'files')) { - let d = localStorage.getItem(_href + 'filesDate') + if (localStorage.getItem(GLOB.sysSign + 'files') === md5(GLOB.sysSign + 'files')) { + let d = localStorage.getItem(GLOB.sysSign + 'filesDate') GLOB.storeFiles = true GLOB.storeDate = Math.ceil((new Date(d).getTime() - new Date().getTime()) / 86400000) @@ -286,8 +291,8 @@ GLOB.dict = {} - if (localStorage.getItem(_href + 'js_trans')) { - let js_trans = JSON.parse(localStorage.getItem(_href + 'js_trans')) + if (localStorage.getItem(GLOB.sysSign + 'js_trans')) { + let js_trans = JSON.parse(localStorage.getItem(GLOB.sysSign + 'js_trans')) js_trans.forEach(item => { if (lang !== item.lang) return -- Gitblit v1.8.0