1、Properties

Former-commit-id: 41ebbf4aff299c696356787e94528c058e02e918
master
wangbing 5 years ago
parent 7b4ac951c3
commit c9cc06dbab

@ -65,6 +65,8 @@ import java.util.regex.Pattern;
@ControllerAdvice @ControllerAdvice
public class GlobalController implements ErrorController { public class GlobalController implements ErrorController {
@Value("${r'${server.servlet.context-path}'}")
private String context;
@Value("${r'${web.home.page}'}") @Value("${r'${web.home.page}'}")
private String homePage; private String homePage;
@Value("${r'${web.login.page}'}") @Value("${r'${web.login.page}'}")
@ -115,9 +117,10 @@ public class GlobalController implements ErrorController {
return "404"; return "404";
case 403: case 403:
String errorUrl = RequestUtil.getErrorUrl(request); String errorUrl = RequestUtil.getErrorUrl(request);
errorUrl = errorUrl.replaceFirst(context, "");
if ((errorUrl.equals(homePage) || errorUrl.equals("/")) && LocalData.getToken() == null) { if ((errorUrl.equals(homePage) || errorUrl.equals("/")) && LocalData.getToken() == null) {
try { try {
response.sendRedirect("/login.htm"); response.sendRedirect(context + loginPage);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -34,8 +34,8 @@ public class UrlUtil {
// 端口 // 端口
int serverPort = request.getServerPort(); int serverPort = request.getServerPort();
// 上下文路径 // 上下文路径
String contextPath = request.getContextPath(); String context = request.getContextPath();
return String.format(Locale.CHINA, "%s://%s:%d%s%s", scheme, serverName, serverPort, contextPath, url); return String.format(Locale.CHINA, "%s://%s:%d%s%s", scheme, serverName, serverPort, context, url);
} }
} }

@ -2,8 +2,7 @@
window.nav = new Vue({ window.nav = new Vue({
data: { data: {
activeIndex: 'home', activeIndex: 'home',
contextPath: '${contextPath?default("")}', context: '${context?default("")}',
homePath: '${homePath?default("")}',
tip: { tip: {
show: function (msg) { show: function (msg) {
if(msg) { if(msg) {

@ -238,7 +238,6 @@
data: { data: {
activeIndex: 'home', activeIndex: 'home',
context: '${context?default("")}', context: '${context?default("")}',
homePath: '${home?default("")}',
isSubmit: false, isSubmit: false,
result: [], result: [],
select: [] select: []
@ -422,7 +421,6 @@
loadingTip: '', loadingTip: '',
loadingBar: '', loadingBar: '',
context: '${context?default("")}', context: '${context?default("")}',
homePath: '${home?default("")}'
}, },
methods: { methods: {
tipShow: function (msg) { tipShow: function (msg) {

@ -312,7 +312,7 @@
this.addTab({ this.addTab({
title: '首页', title: '首页',
name: 'home', name: 'home',
url: '${r"${contextPath}"}/home.htm' url: '${r"${context}"}/home.htm'
}) })
}, },
barStart: function () { barStart: function () {

Loading…
Cancel
Save

Powered by TurnKey Linux.