mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-28 10:13:42 +00:00
更新
This commit is contained in:
@@ -34,11 +34,11 @@ const glob = {
|
||||
type: 'info',
|
||||
message: '认证过期,请重新登陆,正在跳转',
|
||||
onClose: () => {
|
||||
//TODO 没有TOKEN,需要跳转到登陆页(登陆页还未做,先跳转到首页)(考虑实现"重定向特性")
|
||||
const redirectUrl = escape(window.location.href);
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
window.location = '/';
|
||||
window.location = '/registered.html?redirectUrl=' + redirectUrl;
|
||||
} else {
|
||||
window.location.href = 'http://127.0.0.1:9000';
|
||||
window.location.href = 'http://127.0.0.1:9000/registered.html?redirectUrl=' + redirectUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.itkk.udf.api.page.web;
|
||||
|
||||
import org.itkk.udf.api.common.CommonConstant;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -26,9 +26,24 @@ public class HomeController {
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping("/registered.html")
|
||||
public String registered(@RequestParam("redirectUrl") String redirectUrl, Model map) {
|
||||
map.addAttribute("redirectUrl", redirectUrl);
|
||||
map.addAttribute("tokenName", CommonConstant.PARAMETER_NAME_TOKEN);
|
||||
public String registered(@RequestParam(required = false) String redirectUrl, Model map) {
|
||||
if (StringUtils.isNotBlank(redirectUrl)) {
|
||||
map.addAttribute("redirectUrl", redirectUrl);
|
||||
}
|
||||
return "registered";
|
||||
}
|
||||
|
||||
/**
|
||||
* 登陆页
|
||||
*
|
||||
* @param map map
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping("/login.html")
|
||||
public String login(@RequestParam(required = false) String redirectUrl, Model map) {
|
||||
if (StringUtils.isNotBlank(redirectUrl)) {
|
||||
map.addAttribute("redirectUrl", redirectUrl);
|
||||
}
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,12 +435,17 @@
|
||||
});
|
||||
//注册按钮点击事件
|
||||
$('.header-right-bar-registered-div button').on('click', function () {
|
||||
//跳转到注册页面
|
||||
//打开loading
|
||||
openLoading();
|
||||
//跳转注册界面
|
||||
window.location.href = '/registered.html';
|
||||
});
|
||||
//登陆按钮点击事件
|
||||
$('.header-right-bar-login-div button').on('click', function () {
|
||||
//打开loading
|
||||
openLoading();
|
||||
//获得重定向地址
|
||||
var redirectUrl = escape(window.location.href);
|
||||
//跳转登陆界面
|
||||
window.location.href = '/registered.html?redirectUrl=' + redirectUrl;
|
||||
window.location.href = '/login.html';
|
||||
});
|
||||
});
|
||||
//设置(全局)的AJAX请求默认选项
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<header th:replace="common::head(title='ITKK登陆')"></header>
|
||||
<style lang="css">
|
||||
.registered-card {
|
||||
min-width: 300px;
|
||||
max-width: 400px;
|
||||
margin: auto !important;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div th:include="common::top"></div>
|
||||
<div class="main pre-scrollable">
|
||||
<div class="card registered-card">
|
||||
<div class="card-body">
|
||||
<form class="registered-form">
|
||||
<div class="form-group">
|
||||
<label for="userId">用户名</label>
|
||||
<input type="text" class="form-control form-control-lg" id="userId">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pswd">密码</label>
|
||||
<input type="password" class="form-control form-control-lg" id="pswd">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-success login-btn float-left">登陆</button>
|
||||
<button type="button" class="btn btn-link registered-btn float-right">还没有账号? 点这里注册</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="common::bottom"></div>
|
||||
<div th:include="common::footer"></div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
//页面加载完成
|
||||
$(document).ready(function () {
|
||||
//注册按钮点击事件
|
||||
$('.registered-btn').on('click', function () {
|
||||
//跳转到注册
|
||||
window.location.href = '/registered.html';
|
||||
});
|
||||
//注册按钮点击事件
|
||||
$('.login-btn').on('click', function () {
|
||||
//构造参数
|
||||
var param = {
|
||||
userId: $('#userId').val(),
|
||||
pswd: $('#pswd').val()
|
||||
};
|
||||
//请求
|
||||
$.ajax({
|
||||
url: '/api/udf/web/public/rbac/user/login',
|
||||
type: 'POST',
|
||||
async: true,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(param),
|
||||
success: function (data) {
|
||||
if (data.result) {
|
||||
if ('[(${redirectUrl})]') {
|
||||
window.location.href = '[(${redirectUrl})]';
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-success registered-btn float-left">注册</button>
|
||||
<button type="button" class="btn btn-link login-btn float-right">已有账号? 请直接登陆</button>
|
||||
<button type="button" class="btn btn-link login-btn float-right">已有账号? 点这里登陆</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -44,6 +44,11 @@
|
||||
<script type="text/javascript">
|
||||
//页面加载完成
|
||||
$(document).ready(function () {
|
||||
//登陆按钮点击事件
|
||||
$('.login-btn').on('click', function () {
|
||||
//跳转到登陆
|
||||
window.location.href = '/login.html';
|
||||
});
|
||||
//注册按钮点击事件
|
||||
$('.registered-btn').on('click', function () {
|
||||
//构造参数
|
||||
|
||||
Reference in New Issue
Block a user