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.runApplication
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@SpringBootApplication
|
||||
class FruitableApplication
|
||||
|
@ -33,7 +33,7 @@ class Account(private val repository: AccountRepository) {
|
||||
redirectAttributes: RedirectAttributes,
|
||||
title: String,
|
||||
message: String,
|
||||
redirect: String = "redirect:/"
|
||||
redirect: String = "/"
|
||||
): String {
|
||||
redirectAttributes.addFlashAttribute("title", title)
|
||||
redirectAttributes.addFlashAttribute("message", message)
|
||||
@ -87,4 +87,4 @@ class Account(private val repository: AccountRepository) {
|
||||
redirect?.let { return it }
|
||||
return "redirect:/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import team8.fruitable.datebase.entity.User
|
||||
import team8.fruitable.datebase.repository.ItemRepository
|
||||
import team8.fruitable.datebase.repository.AccountRepository
|
||||
import team8.fruitable.datebase.repository.ItemRepository
|
||||
import team8.fruitable.util.ResultBuilderJson
|
||||
|
||||
@RestController
|
||||
|
@ -15,18 +15,14 @@ class Error(private val repository: AccountRepository) : ErrorController {
|
||||
fun error(
|
||||
model: Model,
|
||||
@CookieValue("TOKEN", required = false) token: String?,
|
||||
@ModelAttribute("title") title: String?,
|
||||
@ModelAttribute("message") message: String?,
|
||||
@ModelAttribute("redirect") redirect: String?
|
||||
): Model {
|
||||
@ModelAttribute("title") title: String,
|
||||
@ModelAttribute("message") message: String,
|
||||
@ModelAttribute("redirect") redirect: String
|
||||
): String {
|
||||
token?.let(repository::findByToken)?.let { model["user"] = it }
|
||||
|
||||
model["error"] = mapOf(
|
||||
"title" to title,
|
||||
"message" to message,
|
||||
"redirect" to redirect
|
||||
)
|
||||
|
||||
return model
|
||||
model["title"] = title.ifEmpty { "页面" }
|
||||
model["message"] = message.ifEmpty { "未知的页面" }
|
||||
model["redirect"] = redirect.ifEmpty { "/" }
|
||||
return "error"
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ import org.springframework.ui.Model
|
||||
import org.springframework.ui.set
|
||||
import org.springframework.web.bind.annotation.CookieValue
|
||||
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.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 }}
|
||||
|
||||
<!-- 页面内容 -->
|
||||
@ -16,4 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{> footer }}
|
||||
{{> footer }}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>主页 - 在线果蔬商城</title>
|
||||
<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>
|
||||
@ -28,7 +28,7 @@
|
||||
{{> header }}
|
||||
|
||||
<div class="ErrorInfo">
|
||||
<div class="ErrorTitle">{{ title }} 失败</div>
|
||||
<div class="ErrorTitle">{{ title }}失败</div>
|
||||
<div class="ErrorMessage">原因: {{ message }}</div>
|
||||
{{# redirect }}
|
||||
<div class="ErrorRedirectMessage">将在三秒后跳转至页面: {{ redirect }}</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!-- 头部内容 -->
|
||||
<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}}>
|
||||
<span class="Text">首页</span>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>主页 - 在线果蔬商城</title>
|
||||
<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>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>主页 - 在线果蔬商城</title>
|
||||
<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>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>主页 - 在线果蔬商城</title>
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user