diff --git a/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java b/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java index 7010a9bcd274c8bb0489a8356c7e71476d35eeb5..de0331cc00e73d034f96440870dbf418e047626c 100644 --- a/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java +++ b/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java @@ -75,7 +75,7 @@ public class AppConfiguration implements WebMvcConfigurer { //i18n registry.addInterceptor(localeChangeInterceptor()); - registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html"); + registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html", "/ui/**"); } @@ -87,6 +87,12 @@ public class AppConfiguration implements WebMvcConfigurer { registry.addResourceHandler("/ui/**").addResourceLocations("file:ui/"); } + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/ui/").setViewName("forward:/ui/index.html"); + registry.addViewController("/").setViewName("forward:/ui/index.html"); + } + @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping(PATH_PATTERN).allowedOrigins("*").allowedMethods("*"); diff --git a/escheduler-ui/build/config.js b/escheduler-ui/build/config.js index 72416712622ba38558626ae83c7ea9456608fdca..f0c555c7737c6d5a8e5fdb1a5d8e896bbb7a55c7 100644 --- a/escheduler-ui/build/config.js +++ b/escheduler-ui/build/config.js @@ -189,11 +189,15 @@ const baseConfig = { }, plugins: [ new webpack.ProvidePlugin({ vue: 'Vue', _: 'lodash' }), + new webpack.DefinePlugin({ + PUBLIC_PATH: JSON.stringify(process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '') + }), new HtmlWebpackExtPlugin({ cache: true, delimiter: '$', locals: { - NODE_ENV:isProduction + NODE_ENV:isProduction, + PUBLIC_PATH: process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '' } }), ...pages diff --git a/escheduler-ui/package.json b/escheduler-ui/package.json index a824c2c5d44d8ed7bc5d37a33fe782bf0b635246..acfa498a5403c72085a5a719f8e0ab82bd009481 100644 --- a/escheduler-ui/package.json +++ b/escheduler-ui/package.json @@ -11,7 +11,7 @@ "lint:fix": "standard \"**/*.{js,vue}\" --fix", "start": "npm run dev", "combo": "node ./build/combo.js", - "build:combined": "npm run clean && cross-env NODE_ENV=production webpack --config ./build/webpack.config.combined.js" + "build:combined": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/escheduler/ui webpack --config ./build/webpack.config.combined.js" }, "dependencies": { "autoprefixer": "^9.1.0", diff --git a/escheduler-ui/src/js/conf/home/store/user/actions.js b/escheduler-ui/src/js/conf/home/store/user/actions.js index 0bc12c33cd0d189a3dac5f293bf9f3cce94fb998..951d9a0814b402b724ab724bd22d37e0290ecce0 100644 --- a/escheduler-ui/src/js/conf/home/store/user/actions.js +++ b/escheduler-ui/src/js/conf/home/store/user/actions.js @@ -37,7 +37,7 @@ export default { signOut () { io.post(`signOut`, res => { setTimeout(() => { - window.location.href = '/view/login/index.html' + window.location.href = `${PUBLIC_PATH}/view/login/index.html` }, 100) }).catch(e => { console.log(e) diff --git a/escheduler-ui/src/js/conf/login/App.vue b/escheduler-ui/src/js/conf/login/App.vue index 66ba574eb53ebae56ecd5b190d76ebe66cfcdddd..bac32e404dd8c51e536ec6ae2368661e4532a271 100644 --- a/escheduler-ui/src/js/conf/login/App.vue +++ b/escheduler-ui/src/js/conf/login/App.vue @@ -69,9 +69,9 @@ setTimeout(() => { this.spinnerLoading = false if (this.userName === 'admin') { - window.location.href = '/#/security/tenant' + window.location.href = `${PUBLIC_PATH}/#/security/tenant` } else { - window.location.href = '/#/home' + window.location.href = `${PUBLIC_PATH}/#/home` } }, 1000) }).catch(e => { diff --git a/escheduler-ui/src/js/module/io/index.js b/escheduler-ui/src/js/module/io/index.js index 5e8a3b18eca64c1cf8b751982a346bd1b2402f06..f9d56f145861dc0a889dbcbd7d78a8222e2ed8e4 100644 --- a/escheduler-ui/src/js/module/io/index.js +++ b/escheduler-ui/src/js/module/io/index.js @@ -44,7 +44,7 @@ io.config.timeout = 0 io.config.maxContentLength = 200000 io.config.validateStatus = function (status) { if (status === 401 || status === 504) { - window.location.href = '/view/login/index.html' + window.location.href = `${PUBLIC_PATH}/view/login/index.html` return } return status diff --git a/escheduler-ui/src/view/common/meta.inc b/escheduler-ui/src/view/common/meta.inc index fc307dd487bc4a43b539101e23a662560cd38c8e..1f0f0afd633da216af91b84d309a7570a9814732 100644 --- a/escheduler-ui/src/view/common/meta.inc +++ b/escheduler-ui/src/view/common/meta.inc @@ -11,12 +11,12 @@ - - - + + + +