fix an error in error page and some title wrong
Signed-off-by: Puqns67 <me@puqns67.icu>
This commit is contained in:
parent
e34ea37964
commit
2ddb2d2602
@ -2,8 +2,6 @@ package team8.fruitable
|
|||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
import org.springframework.boot.runApplication
|
import org.springframework.boot.runApplication
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class FruitableApplication
|
class FruitableApplication
|
||||||
|
@ -33,7 +33,7 @@ class Account(private val repository: AccountRepository) {
|
|||||||
redirectAttributes: RedirectAttributes,
|
redirectAttributes: RedirectAttributes,
|
||||||
title: String,
|
title: String,
|
||||||
message: String,
|
message: String,
|
||||||
redirect: String = "redirect:/"
|
redirect: String = "/"
|
||||||
): String {
|
): String {
|
||||||
redirectAttributes.addFlashAttribute("title", title)
|
redirectAttributes.addFlashAttribute("title", title)
|
||||||
redirectAttributes.addFlashAttribute("message", message)
|
redirectAttributes.addFlashAttribute("message", message)
|
||||||
|
@ -4,8 +4,8 @@ import org.springframework.web.bind.annotation.GetMapping
|
|||||||
import org.springframework.web.bind.annotation.PathVariable
|
import org.springframework.web.bind.annotation.PathVariable
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
import team8.fruitable.datebase.entity.User
|
import team8.fruitable.datebase.entity.User
|
||||||
import team8.fruitable.datebase.repository.ItemRepository
|
|
||||||
import team8.fruitable.datebase.repository.AccountRepository
|
import team8.fruitable.datebase.repository.AccountRepository
|
||||||
|
import team8.fruitable.datebase.repository.ItemRepository
|
||||||
import team8.fruitable.util.ResultBuilderJson
|
import team8.fruitable.util.ResultBuilderJson
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -15,18 +15,14 @@ class Error(private val repository: AccountRepository) : ErrorController {
|
|||||||
fun error(
|
fun error(
|
||||||
model: Model,
|
model: Model,
|
||||||
@CookieValue("TOKEN", required = false) token: String?,
|
@CookieValue("TOKEN", required = false) token: String?,
|
||||||
@ModelAttribute("title") title: String?,
|
@ModelAttribute("title") title: String,
|
||||||
@ModelAttribute("message") message: String?,
|
@ModelAttribute("message") message: String,
|
||||||
@ModelAttribute("redirect") redirect: String?
|
@ModelAttribute("redirect") redirect: String
|
||||||
): Model {
|
): String {
|
||||||
token?.let(repository::findByToken)?.let { model["user"] = it }
|
token?.let(repository::findByToken)?.let { model["user"] = it }
|
||||||
|
model["title"] = title.ifEmpty { "页面" }
|
||||||
model["error"] = mapOf(
|
model["message"] = message.ifEmpty { "未知的页面" }
|
||||||
"title" to title,
|
model["redirect"] = redirect.ifEmpty { "/" }
|
||||||
"message" to message,
|
return "error"
|
||||||
"redirect" to redirect
|
|
||||||
)
|
|
||||||
|
|
||||||
return model
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import org.springframework.ui.Model
|
|||||||
import org.springframework.ui.set
|
import org.springframework.ui.set
|
||||||
import org.springframework.web.bind.annotation.CookieValue
|
import org.springframework.web.bind.annotation.CookieValue
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
|
||||||
import org.springframework.web.servlet.ModelAndView
|
|
||||||
import team8.fruitable.datebase.entity.User
|
import team8.fruitable.datebase.entity.User
|
||||||
import team8.fruitable.datebase.repository.AccountRepository
|
import team8.fruitable.datebase.repository.AccountRepository
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-Hans">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>编辑 - 在线果蔬商城</title>
|
||||||
|
<script type="text/javascript" src="scripts/header.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/clock.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/top.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/footer.js"></script>
|
||||||
|
<script type="text/javascript" src="scripts/edit.js"></script>
|
||||||
|
<link type="image/x-icon" rel="icon" href="images/favicon.ico">
|
||||||
|
<!-- 页面公共的样式表 -->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/header.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/clock.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/top.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/footer.css">
|
||||||
|
<!-- 页面特定的样式表 -->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/edit.css">
|
||||||
|
<!-- 外部小组件 -->
|
||||||
|
<script src="scripts/lib/anime.min.js"></script>
|
||||||
|
<script async src="scripts/lib/explosion.min.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
{{> header }}
|
{{> header }}
|
||||||
|
|
||||||
<!-- 页面内容 -->
|
<!-- 页面内容 -->
|
||||||
@ -17,3 +42,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{> footer }}
|
{{> footer }}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>主页 - 在线果蔬商城</title>
|
<title>错误 - 在线果蔬商城</title>
|
||||||
<script type="text/javascript" src="scripts/header.js"></script>
|
<script type="text/javascript" src="scripts/header.js"></script>
|
||||||
<script type="text/javascript" src="scripts/clock.js"></script>
|
<script type="text/javascript" src="scripts/clock.js"></script>
|
||||||
<script type="text/javascript" src="scripts/top.js"></script>
|
<script type="text/javascript" src="scripts/top.js"></script>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
{{> header }}
|
{{> header }}
|
||||||
|
|
||||||
<div class="ErrorInfo">
|
<div class="ErrorInfo">
|
||||||
<div class="ErrorTitle">{{ title }} 失败</div>
|
<div class="ErrorTitle">{{ title }}失败</div>
|
||||||
<div class="ErrorMessage">原因: {{ message }}</div>
|
<div class="ErrorMessage">原因: {{ message }}</div>
|
||||||
{{# redirect }}
|
{{# redirect }}
|
||||||
<div class="ErrorRedirectMessage">将在三秒后跳转至页面: {{ redirect }}</div>
|
<div class="ErrorRedirectMessage">将在三秒后跳转至页面: {{ redirect }}</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!-- 头部内容 -->
|
<!-- 头部内容 -->
|
||||||
<div id="Header">
|
<div id="Header">
|
||||||
<div class="List Special Title">67购物网站</div>
|
<div class="List Special Title">在线果蔬商城</div>
|
||||||
<div class="List Link" {{#isIndex}}this{{/isIndex}}{{^isIndex}}href="/"{{/isIndex}}>
|
<div class="List Link" {{#isIndex}}this{{/isIndex}}{{^isIndex}}href="/"{{/isIndex}}>
|
||||||
<span class="Text">首页</span>
|
<span class="Text">首页</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>主页 - 在线果蔬商城</title>
|
<title>商品 - 在线果蔬商城</title>
|
||||||
<script type="text/javascript" src="scripts/header.js"></script>
|
<script type="text/javascript" src="scripts/header.js"></script>
|
||||||
<script type="text/javascript" src="scripts/clock.js"></script>
|
<script type="text/javascript" src="scripts/clock.js"></script>
|
||||||
<script type="text/javascript" src="scripts/top.js"></script>
|
<script type="text/javascript" src="scripts/top.js"></script>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>主页 - 在线果蔬商城</title>
|
<title>登录 - 在线果蔬商城</title>
|
||||||
<script type="text/javascript" src="scripts/header.js"></script>
|
<script type="text/javascript" src="scripts/header.js"></script>
|
||||||
<script type="text/javascript" src="scripts/clock.js"></script>
|
<script type="text/javascript" src="scripts/clock.js"></script>
|
||||||
<script type="text/javascript" src="scripts/top.js"></script>
|
<script type="text/javascript" src="scripts/top.js"></script>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>主页 - 在线果蔬商城</title>
|
<title>注册 - 在线果蔬商城</title>
|
||||||
<script type="text/javascript" src="scripts/header.js"></script>
|
<script type="text/javascript" src="scripts/header.js"></script>
|
||||||
<script type="text/javascript" src="scripts/clock.js"></script>
|
<script type="text/javascript" src="scripts/clock.js"></script>
|
||||||
<script type="text/javascript" src="scripts/top.js"></script>
|
<script type="text/javascript" src="scripts/top.js"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user