From 5bbecb15898be5774e3791e11c26be54fa097bc1 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 15 Apr 2024 18:18:32 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=8A=A8=E6=80=81=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/controller/IndexController.java | 3 +++ core/frontend/.env.production | 4 ++-- core/frontend/src/permission.js | 6 +++--- core/mobile/.env.production | 2 +- core/mobile/src/manifest.json | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/controller/IndexController.java b/core/backend/src/main/java/io/dataease/controller/IndexController.java index 98d16127a8..73ed1d8858 100644 --- a/core/backend/src/main/java/io/dataease/controller/IndexController.java +++ b/core/backend/src/main/java/io/dataease/controller/IndexController.java @@ -85,6 +85,9 @@ public class IndexController { @GetMapping("/tempMobileLink/{id}/{token}") public void tempMobileLink(@PathVariable("id") String id, @PathVariable("token") String token) { String url = "/#preview/" + id; + if (StringUtils.isNotBlank(contextPath)) { + url = contextPath + url; + } HttpServletResponse response = ServletUtils.response(); Cookie cookie = new Cookie("Authorization", token); cookie.setPath("/"); diff --git a/core/frontend/.env.production b/core/frontend/.env.production index ad684689e8..f984c1d55c 100644 --- a/core/frontend/.env.production +++ b/core/frontend/.env.production @@ -3,7 +3,7 @@ ENV = 'production' # base api # VUE_APP_BASE_API = 'http://localhost:8081/' -VUE_APP_BASE_API = '/' +VUE_APP_BASE_API = './' -VUE_CONTEXT_PATH = '/' +VUE_CONTEXT_PATH = './' diff --git a/core/frontend/src/permission.js b/core/frontend/src/permission.js index 88a68c7431..b424fc57ed 100644 --- a/core/frontend/src/permission.js +++ b/core/frontend/src/permission.js @@ -65,14 +65,14 @@ router.beforeEach(async(to, from, next) => routeBefore(() => { const hasToken = getToken() if (isMobile() && !to.path.includes(mobilePreview) && mobileIgnores.indexOf(to.path) === -1) { - let urlSuffix = '/app.html' + let urlSuffix = 'app.html' if (hasToken) { urlSuffix += ('?detoken=' + hasToken) } localStorage.removeItem('user-info') localStorage.removeItem('userId') localStorage.removeItem('Authorization') - window.location.href = window.origin + urlSuffix + window.location.href = window.origin + window.location.pathname + urlSuffix NProgress.done() } @@ -102,7 +102,7 @@ router.beforeEach(async(to, from, next) => routeBefore(() => { route = store.getters.permission_routes.find(item => item.path === '/') } store.commit('permission/SET_CURRENT_ROUTES', route) - if (['system'].includes(route.name)) { + if (route?.name && ['system'].includes(route.name)) { store.dispatch('app/toggleSideBarHide', false) } } else { diff --git a/core/mobile/.env.production b/core/mobile/.env.production index d24a4671c1..17a966ec97 100644 --- a/core/mobile/.env.production +++ b/core/mobile/.env.production @@ -3,5 +3,5 @@ ENV = 'production' # base api # VUE_APP_BASE_API = 'http://localhost:8081/' -VUE_APP_BASE_API = '/' +VUE_APP_BASE_API = './' diff --git a/core/mobile/src/manifest.json b/core/mobile/src/manifest.json index 9c5d491986..15ab4fc50e 100644 --- a/core/mobile/src/manifest.json +++ b/core/mobile/src/manifest.json @@ -74,7 +74,7 @@ }, "h5": { "router": { - "base": "/de-app/" + "base": "./de-app/" }, "devServer": { "proxy": {