Merge pull request #9109 from dataease/pr@dev@perf_dynamic_context_path

perf: 动态访问前缀配置
This commit is contained in:
fit2cloud-chenyw 2024-04-15 18:20:30 +08:00 committed by GitHub
commit 35122fa870
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 7 deletions

View File

@ -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("/");

View File

@ -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 = './'

View File

@ -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 {

View File

@ -3,5 +3,5 @@ ENV = 'production'
# base api
# VUE_APP_BASE_API = 'http://localhost:8081/'
VUE_APP_BASE_API = '/'
VUE_APP_BASE_API = './'

View File

@ -74,7 +74,7 @@
},
"h5": {
"router": {
"base": "/de-app/"
"base": "./de-app/"
},
"devServer": {
"proxy": {