From e14f40e0ef23f2cbc1ef6540e6302c8cacba2227 Mon Sep 17 00:00:00 2001 From: iizmg Date: Thu, 30 Apr 2020 13:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/assets/js/glob.js | 6 +- .../itkk/udf/api/page/web/HomeController.java | 23 ++++-- .../src/main/resources/templates/common.html | 13 ++-- .../src/main/resources/templates/login.html | 72 +++++++++++++++++++ .../main/resources/templates/registered.html | 7 +- 5 files changed, 109 insertions(+), 12 deletions(-) create mode 100644 udf-api/udf-api-server/src/main/resources/templates/login.html diff --git a/admin/src/assets/js/glob.js b/admin/src/assets/js/glob.js index 008aa76..6441f48 100644 --- a/admin/src/assets/js/glob.js +++ b/admin/src/assets/js/glob.js @@ -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; } } }); diff --git a/udf-api/udf-api-page/src/main/java/org/itkk/udf/api/page/web/HomeController.java b/udf-api/udf-api-page/src/main/java/org/itkk/udf/api/page/web/HomeController.java index 8da27fd..5ff4a7f 100644 --- a/udf-api/udf-api-page/src/main/java/org/itkk/udf/api/page/web/HomeController.java +++ b/udf-api/udf-api-page/src/main/java/org/itkk/udf/api/page/web/HomeController.java @@ -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"; + } } diff --git a/udf-api/udf-api-server/src/main/resources/templates/common.html b/udf-api/udf-api-server/src/main/resources/templates/common.html index 7bbaba7..23aaa07 100644 --- a/udf-api/udf-api-server/src/main/resources/templates/common.html +++ b/udf-api/udf-api-server/src/main/resources/templates/common.html @@ -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请求默认选项 diff --git a/udf-api/udf-api-server/src/main/resources/templates/login.html b/udf-api/udf-api-server/src/main/resources/templates/login.html new file mode 100644 index 0000000..01a7c73 --- /dev/null +++ b/udf-api/udf-api-server/src/main/resources/templates/login.html @@ -0,0 +1,72 @@ + + +
+ + +
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/udf-api/udf-api-server/src/main/resources/templates/registered.html b/udf-api/udf-api-server/src/main/resources/templates/registered.html index 6b813f3..8e51dea 100644 --- a/udf-api/udf-api-server/src/main/resources/templates/registered.html +++ b/udf-api/udf-api-server/src/main/resources/templates/registered.html @@ -32,7 +32,7 @@
- +
@@ -44,6 +44,11 @@