master
wangbing 5 years ago
parent 78adf337e5
commit c843dcdfe3

@ -213,15 +213,15 @@ public class SpringBootCallable implements Callable {
control.mkdirs();
File ajax = new File(root.getAbsolutePath(), "ajax");
ajax.mkdirs();
File auth = new File(root.getAbsolutePath(), "auth");
auth.mkdirs();
File system = new File(ajax.getAbsolutePath(), "system");
system.mkdirs();
File screen = new File(root.getAbsolutePath(), "screen");
screen.mkdirs();
freeMarkerManager.outputTemp(new File(control.getAbsolutePath(), "Footer.java"), option + "/java/action/control/Footer.java", ctx);
freeMarkerManager.outputTemp(new File(control.getAbsolutePath(), "Header.java"), option + "/java/action/control/Header.java", ctx);
freeMarkerManager.outputTemp(new File(ajax.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx);
freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx);
freeMarkerManager.outputTemp(new File(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx);

@ -1,13 +0,0 @@
package ${basePackage}.action.ajax.${moudle};
import ${basePackage}.frame.base.Ajax;
import ${basePackage}.frame.base.BaseResponse;
public class UserAjax extends Ajax {
public BaseResponse create(String param) {
BaseResponse baseResponse = new BaseResponse();
return baseResponse;
}
}

@ -0,0 +1,26 @@
package ${basePackage}.action.ajax.system;
import ${basePackage}.frame.base.Ajax;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.BaseResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AuthAjax extends Ajax {
public BaseResponse login(String param) {
BaseResponse baseResponse = new BaseResponse();
// todo 设置cookie
HttpServletRequest request = LocalData.getRequest();
HttpServletResponse response = LocalData.getResponse();
Cookie token = new Cookie("token", "");
token.setDomain(request.getServerName());
token.setPath("/");
response.addCookie(token);
return baseResponse;
}
}

@ -72,7 +72,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
//继承临时Token
token1.addResourceSet(LocalData.getTempToken());
//管理员特有资源(这边请用正则表达式)
token1.putResource(".*\\.htm");
token1.putResource(".*");
LocalData.setToken(token1);
}

@ -28,6 +28,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Value("${r'${web.welcome.page}'}")
private String homePage;
@Value("${r'${spring.mvc.static-path-pattern}'}")
private String[] staticPath;
/**
*
@ -38,6 +40,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new HandlerInterceptorAdapter() {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
return super.preHandle(request, response, handler);
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
super.postHandle(request, response, handler, modelAndView);
@ -61,7 +68,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
}
}
}).addPathPatterns("/**/*.htm").order(-1);
}).addPathPatterns("/**").excludePathPatterns(staticPath);
}
/**

@ -76,4 +76,4 @@ web.login.page=/login.htm
# 拦截验证
web.url.auth.included=/,/**/*.htm
# 直接放行
web.url.auth.excluded=/login.htm,/index.htm
web.url.auth.excluded=/login.htm,/index.htm,/home.htm

@ -70,7 +70,7 @@
<br>
<a onclick="history.back()">返回上页</a> <a id="login" href="${Uri.getUrl("/login.htm")}">登录</a>
<a onclick="history.back()">返回上页</a> <a id="login" href="${context}/login.htm"">登录</a>
</div>
<script>
window.onload = function () {
@ -82,7 +82,7 @@
e.innerHTML = "登录(" + count + " 秒后自动跳转)"
count--;
} else {
location.href = '${Uri.getUrl("/login.htm")}';
location.href = "${context}/login.htm";
}
}

@ -2,7 +2,7 @@
<html>
<head>
<title>首页</title>
<link rel="icon" href="${Uri.getUrl('/static/favicon.ico')}" type="image/x-icon"/>
<link rel="icon" href="${context}/static/favicon.ico" type="image/x-icon"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="${context}/static/dist/lib.min.js" type="text/javascript"></script>
<script src="${context}/static/dist/index.min.js" type="text/javascript"></script>

Loading…
Cancel
Save

Powered by TurnKey Linux.