ucenter前台页面修改为Thymeleaf模版格式

This commit is contained in:
xulonggang 2017-08-15 11:23:38 +08:00
parent cc6f118dcf
commit 0495aee4cb
5 changed files with 93 additions and 22 deletions

View File

@ -0,0 +1,57 @@
package com.zheng.ucenter.web.interceptor;
import com.zheng.common.util.PropertiesFileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 公共拦截器
* Created by shuzheng on 2017/3/25.
*/
public class UcenterWebInterceptor extends HandlerInterceptorAdapter {
private static Logger _log = LoggerFactory.getLogger(UcenterWebInterceptor.class);
// @Autowired
// private CmsMenuService cmsMenuService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 过滤ajax
if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) {
return true;
}
// zheng-ui静态资源配置信息
String appName = PropertiesFileUtil.getInstance().get("app.name");
String uiPath = PropertiesFileUtil.getInstance().get("zheng.ui.path");
request.setAttribute("appName", appName);
request.setAttribute("uiPath", uiPath);
// // 菜单
// CmsMenuExample cmsMenuExample = new CmsMenuExample();
// cmsMenuExample.setOrderByClause("orders asc");
// List<CmsMenu> menus = cmsMenuService.selectByExample(cmsMenuExample);
// request.setAttribute("menus", menus);
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
super.postHandle(request, response, handler, modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
super.afterCompletion(request, response, handler, ex);
}
@Override
public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
super.afterConcurrentHandlingStarted(request, response, handler);
}
}

View File

@ -11,6 +11,15 @@
<!-- 根目录'/'对应页面 -->
<mvc:view-controller path="/" view-name="/index.jsp"/>
<!-- 拦截器 -->
<mvc:interceptors>
<!-- 公共拦截器 -->
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.zheng.ucenter.web.interceptor.UcenterWebInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>
<context:property-placeholder location="classpath:config.properties"/>
<!-- thymeleaf视图 -->

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>用户中心</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/bootstrap.min.css'}">
<link rel="stylesheet" href="//at.alicdn.com/t/font_ay4w4j5c2tke29.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/style.css'}">
</head>
<body class="login-page">
<div class="login-box">
@ -21,7 +21,7 @@
<i class="iconfont icon-icon053"></i> <span>登录</span>
</div>
<div class="col-xs-6" style="text-align: right">
<a href="reg.html">注册</a>
<a href="signup">注册</a>
</div>
</div>
<!-- Nav tabs -->
@ -55,7 +55,7 @@
<div class="col-xs-6" style="text-align: right">
<div class="checkbox icheck">
<label>
<a href="password.html">忘记密码?</a>
<a href="password_reset">忘记密码?</a>
</label>
</div>
</div>
@ -132,7 +132,9 @@
</div>
<!-- /.login-box -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>var BASE_PATH = '[[${#httpServletRequest.getContextPath()}]]';</script>
<script>var BACK_URL = '[[${#httpServletRequest.getParameter("backurl")}]]';</script>
<script src="js/jquery.min.js" th:src="@{${uiPath} + ${appName} + '/js/jquery.min.js'}"></script>
<script src="js/bootstrap.min.js" th:src="@{${uiPath} + ${appName} + '/js/bootstrap.min.js'}"></script>
</body>
</html>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>用户中心</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/bootstrap.min.css'}">
<link rel="stylesheet" href="//at.alicdn.com/t/font_ay4w4j5c2tke29.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/style.css'}">
</head>
<body class="login-page">
<div class="login-box">
@ -21,7 +21,7 @@
<i class="iconfont icon-icon053"></i> <span>找回密码</span>
</div>
<div class="col-xs-6" style="text-align: right">
<a href="reg.html">注册</a>
<a href="signup">注册</a>
</div>
</div>
<form>
@ -36,7 +36,7 @@
<span class="glyphicon glyphicon-lock form-control-feedback" style="right: 15px;"></span>
</div>
<div class="col-xs-6" style="text-align: right">
<img src="img/captcha.png" alt="" style="border: 1px solid #ccc; height: 34px;">
<img src="@{${uiPath} + ${appName} + '/img/captcha.png'}" alt="" style="border: 1px solid #ccc; height: 34px;">
</div>
</div>
</div>
@ -62,7 +62,9 @@
</div>
<!-- /.login-box -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>var BASE_PATH = '[[${#httpServletRequest.getContextPath()}]]';</script>
<script>var BACK_URL = '[[${#httpServletRequest.getParameter("backurl")}]]';</script>
<script src="js/jquery.min.js" th:src="@{${uiPath} + ${appName} + '/js/jquery.min.js'}"></script>
<script src="js/bootstrap.min.js" th:src="@{${uiPath} + ${appName} + '/js/bootstrap.min.js'}"></script>
</body>
</html>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>用户中心</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/bootstrap.min.css'}">
<link rel="stylesheet" href="//at.alicdn.com/t/font_ay4w4j5c2tke29.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" th:href="@{${uiPath} + ${appName} + '/css/style.css'}">
</head>
<body class="register-page">
<div class="register-box">
@ -21,7 +21,7 @@
<i class="iconfont icon-icon053"></i> <span>注册</span>
</div>
<div class="col-xs-6" style="text-align: right">
<a href="login.html">已有账号? 登录</a>
<a href="signin">已有账号? 登录</a>
</div>
</div>
<!-- Nav tabs -->
@ -51,7 +51,7 @@
<span class="glyphicon glyphicon-lock form-control-feedback" style="right: 15px;"></span>
</div>
<div class="col-xs-6" style="text-align: right">
<img src="img/captcha.png" alt="" style="border: 1px solid #ccc; height: 34px;">
<img src="@{${uiPath} + ${appName} + '/img/captcha.png'}" alt="" style="border: 1px solid #ccc; height: 34px;">
</div>
</div>
</div>
@ -127,8 +127,9 @@
</div>
<!-- /.login-box -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>var BASE_PATH = '[[${#httpServletRequest.getContextPath()}]]';</script>
<script>var BACK_URL = '[[${#httpServletRequest.getParameter("backurl")}]]';</script>
<script src="js/jquery.min.js" th:src="@{${uiPath} + ${appName} + '/js/jquery.min.js'}"></script>
<script src="js/bootstrap.min.js" th:src="@{${uiPath} + ${appName} + '/js/bootstrap.min.js'}"></script>
</body>
</html>