分类管理🤗

This commit is contained in:
WuLiZeng 2021-02-14 12:03:18 +08:00
parent 3735bf61b1
commit 96d6041313
24 changed files with 1308 additions and 7188 deletions

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: jakarta.validation:jakarta.validation-api:2.0.2">
<CLASSES>
<root url="jar:///Library/maven-repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar:///Library/maven-repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar:///Library/maven-repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.hibernate.validator:hibernate-validator:6.1.7.Final">
<CLASSES>
<root url="jar:///Library/maven-repository/org/hibernate/validator/hibernate-validator/6.1.7.Final/hibernate-validator-6.1.7.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar:///Library/maven-repository/org/hibernate/validator/hibernate-validator/6.1.7.Final/hibernate-validator-6.1.7.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar:///Library/maven-repository/org/hibernate/validator/hibernate-validator/6.1.7.Final/hibernate-validator-6.1.7.Final-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter-validation:2.4.2">
<CLASSES>
<root url="jar:///Library/maven-repository/org/springframework/boot/spring-boot-starter-validation/2.4.2/spring-boot-starter-validation-2.4.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar:///Library/maven-repository/org/springframework/boot/spring-boot-starter-validation/2.4.2/spring-boot-starter-validation-2.4.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar:///Library/maven-repository/org/springframework/boot/spring-boot-starter-validation/2.4.2/spring-boot-starter-validation-2.4.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -96,7 +96,6 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.4.2" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.4.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.41" level="project" /> <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.41" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.41" level="project" /> <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.41" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.3" level="project" />
@ -137,5 +136,9 @@
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.3" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.4.2" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.1.7.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
</component> </component>
</module> </module>

File diff suppressed because it is too large Load Diff

View File

@ -68,6 +68,11 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -23,7 +23,7 @@ import java.util.Arrays;
public class LogAspect { public class LogAspect {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
//明切面 所有请求 //明切面 所有请求
@Pointcut("execution(* com.hailin.beizhai.web.*.*(..))") @Pointcut("execution(* com.hailin.beizhai.web.*.*(..))")
public void log() { public void log() {

View File

@ -4,4 +4,6 @@ import com.hailin.beizhai.po.Type;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
public interface TypeRepository extends JpaRepository<Type,Long> { public interface TypeRepository extends JpaRepository<Type,Long> {
Type findByName(String name);
} }

View File

@ -7,6 +7,7 @@ package com.hailin.beizhai.po;
@Description 分类 @Description 分类
*/ */
import org.hibernate.validator.constraints.NotBlank;
import javax.persistence.*; import javax.persistence.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -18,6 +19,7 @@ public class Type {
@Id @Id
@GeneratedValue @GeneratedValue
private Long id; private Long id;
@NotBlank(message="分类名称不能为空")//后端校验
private String name; private String name;
@OneToMany(mappedBy="type") @OneToMany(mappedBy="type")

View File

@ -10,6 +10,8 @@ public interface TypeService {
Type getType(Long id); Type getType(Long id);
Type getTypeByName(String name);
Page<Type> listType(Pageable pageable);//分页 Page<Type> listType(Pageable pageable);//分页
Type updateType(Long id,Type type); Type updateType(Long id,Type type);

View File

@ -35,6 +35,12 @@ public class TypeServiceImpl implements TypeService{
return typeRepository.findById(id).get(); return typeRepository.findById(id).get();
} }
@Override
public Type getTypeByName(String name) {
System.out.println("111"+typeRepository.findByName(name));
return typeRepository.findByName(name);
}
@Transactional @Transactional
@Override @Override
public Page<Type> listType(Pageable pageable) {//分页 public Page<Type> listType(Pageable pageable) {//分页

View File

@ -8,9 +8,15 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault; import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.jws.WebParam;
import javax.validation.Valid;
/* /*
@Name: TypeController @Name: TypeController
@ -34,20 +40,61 @@ public class TypeController {
} }
@GetMapping("/types/input") @GetMapping("/types/input")
public String input(){ public String input(Model model) {
model.addAttribute("type", new Type());
return "admin/types-input"; return "admin/types-input";
} }
@PostMapping("/types") @GetMapping("/types/{id}/input")
public String post(Type type){ public String editInput(@PathVariable Long id, Model model) {
System.out.println("post"); System.out.println("editinput ");
Type t=typeService.saveType(type); model.addAttribute("type", typeService.getType(id));
if (t==null){ return "admin/types-input";
// }
}else{
//
}
//编辑
@PostMapping("/types/{id}")
public String editPost(@PathVariable Long id, RedirectAttributes attributes, @Valid Type type, BindingResult result) {//type binding 相邻
Type type1 = typeService.getTypeByName(type.getName());
if (type1 != null) {//重复校验
result.rejectValue("name", "nameError", "该分类已经存在");
}
if (result.hasErrors()) {
return "admin/types-input";
}
Type t = typeService.updateType(id, type);
if (t == null) {
attributes.addFlashAttribute("message", "更新失败");
} else {
attributes.addFlashAttribute("message", "更新成功");
}
return "redirect:/admin/types";
}
//新增
@PostMapping("/types")
public String post(RedirectAttributes attributes, @Valid Type type, BindingResult result) {
Type type1 = typeService.getTypeByName(type.getName());
if (type1 != null) {//重复校验
result.rejectValue("name", "nameError", "该分类已经存在");
}
if (result.hasErrors()) {
return "admin/types-input";
}
Type t = typeService.saveType(type);
if (t == null) {
attributes.addFlashAttribute("message", "新增失败");
} else {
attributes.addFlashAttribute("message", "新增成功");
}
return "redirect:/admin/types";
}
//删除
@GetMapping("/types/{id}/delete")
public String delete(@PathVariable Long id, RedirectAttributes attributes) {
typeService.deleteType(id);
attributes.addFlashAttribute("message", "删除成功");
return "redirect:/admin/types"; return "redirect:/admin/types";
} }
} }

View File

@ -5,11 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title th:replace="${title}">博客详情</title> <title th:replace="${title}">博客详情</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../static/css/typo.css" th:href="@{css/typo.css}"> <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css" th:href="@{/lib/editormd/css/editormd.min.css}">
<link rel="stylesheet" href="../static/css/animate.css" th:href="@{css/animate.css}"> <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
<link rel="stylesheet" href="../static/lib/prism/prism.css" th:href="@{lib/prism.css}">
<link rel="stylesheet" href="../static/lib/tocbot/tocbot.css" th:href="@{lib/typo.css}">
<link rel="stylesheet" href="../static/css/me.css" th:href="@{css/me.css}">
</head> </head>
<body> <body>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>博客管理</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}"> <link rel="stylesheet" href="../../static/css/me.css">
</head> </head>
<body> <body>

View File

@ -3,15 +3,14 @@
<head th:replace="admin/_fragments :: head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分类新增</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css"> <link rel="stylesheet" href="../../static/css/me.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head> </head>
<body> <body>
<!--导航--> <!--导航-->
<nav class="ui inverted attached segment m-padded-tb-mini m-shadow-small" > <nav th:replace="admin/_fragments :: menu(1)"class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
<div class="ui container"> <div class="ui container">
<div class="ui inverted secondary stackable menu"> <div class="ui inverted secondary stackable menu">
<h2 class="ui teal header item">管理后台</h2> <h2 class="ui teal header item">管理后台</h2>
@ -39,8 +38,8 @@
<div class="ui attached pointing menu"> <div class="ui attached pointing menu">
<div class="ui container"> <div class="ui container">
<div class="right menu"> <div class="right menu">
<a href="#" class="teal active item">发布</a> <a href="#" th:href="@{/admin/types/input}" class="active item">新增</a>
<a href="#" class="item">列表</a> <a href="#" th:href="@{/admin/types}" class="teal item">列表</a>
</div> </div>
</div> </div>
</div> </div>
@ -48,15 +47,23 @@
<!--中间内容--> <!--中间内容-->
<div class="m-container-small m-padded-tb-big"> <div class="m-container-small m-padded-tb-big">
<div class="ui container"> <div class="ui container">
<form action="#" method="post" th:action="@{/admin/types}" class="ui form"> <form action="#" method="post" th:object="${type}" th:action="*{id}==null ? @{/admin/types} : @{/admin/types/{id}(id=*{id})}" class="ui form">
<div class="field"> <input type="hidden" name="id" th:value="*{id}">
<div class="required field">
<div class="ui left labeled input"> <div class="ui left labeled input">
<label class="ui teal basic label">名称</label> <label class="ui teal basic label">名称</label>
<input type="text" name="name" placeholder="分类名称"> <input type="text" name="name" placeholder="分类名称" th:value="*{name}">
</div> </div>
</div> </div>
<div class="ui error message"></div> <div class="ui error message"></div>
<!--/*/
<div class="ui negative message" th:if="${#fields.hasErrors('name')}" >
<i class="close icon"></i>
<div class="header">验证失败</div>
<p th:errors="*{name}">提交信息不符合规则</p>
</div>
/*/-->
<div class="ui right aligned container"> <div class="ui right aligned container">
<button type="button" class="ui button" onclick="window.history.go(-1)">返回</button> <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
<button class="ui teal submit button">提交</button> <button class="ui teal submit button">提交</button>
@ -97,8 +104,8 @@
<div class="three wide column"> <div class="three wide column">
<h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4> <h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4>
<div class="ui inverted link list"> <div class="ui inverted link list">
<a href="#" class="item m-text-thin">Emaillirenmi@163.com</a> <a href="#" class="item m-text-thin"></a>
<a href="#" class="item m-text-thin">QQ865729312</a> <a href="#" class="item m-text-thin"></a>
</div> </div>
</div> </div>
<div class="seven wide column"> <div class="seven wide column">

View File

@ -1,11 +1,11 @@
<!DOCTYPE html > <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments ::head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分类</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}"> <link rel="stylesheet" href="../../static/css/me.css">
</head> </head>
<body> <body>
@ -16,7 +16,11 @@
<!--中间内容--> <!--中间内容-->
<div class="m-container-small m-padded-tb-big"> <div class="m-container-small m-padded-tb-big">
<div class="ui container"> <div class="ui container">
<div class="ui success message" th:unless="${#strings.isEmpty(message)}">
<i class="close icon"></i>
<div class="header">提示:</div>
<p th:text="${message}">恭喜,操作成功!</p>
</div>
<table class="ui celled table"> <table class="ui celled table">
<thead> <thead>
<tr> <tr>
@ -31,7 +35,7 @@
<td th:text="${type.name}">刻意练习清单</td> <td th:text="${type.name}">刻意练习清单</td>
<td> <td>
<a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini teal basic button">编辑</a> <a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini teal basic button">编辑</a>
<a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini red basic button">删除</a> <a href="#" th:href="@{/admin/types/{id}/delete(id=${type.id})}" class="ui mini red basic button">删除</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -65,5 +69,23 @@
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script> <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
<!--/*/</th:block>/*/--> <!--/*/</th:block>/*/-->
<script>
$('.menu.toggle').click(function () {
$('.m-item').toggleClass('m-mobile-hide');
});
$('.ui.dropdown').dropdown({
on : 'hover'
});
//消息隐藏
$('.message .close')
.on("click",function (){
$(this)
.closest('.message')
.transition('fade');
})
</script>
</body> </body>
</html> </html>

View File

@ -5,11 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title th:replace="${title}">博客详情</title> <title th:replace="${title}">博客详情</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../static/css/typo.css" th:href="@{css/typo.css}"> <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css" th:href="@{/lib/editormd/css/editormd.min.css}">
<link rel="stylesheet" href="../static/css/animate.css" th:href="@{css/animate.css}"> <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
<link rel="stylesheet" href="../static/lib/prism/prism.css" th:href="@{lib/prism.css}">
<link rel="stylesheet" href="../static/lib/tocbot/tocbot.css" th:href="@{lib/typo.css}">
<link rel="stylesheet" href="../static/css/me.css" th:href="@{css/me.css}">
</head> </head>
<body> <body>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>博客管理</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}"> <link rel="stylesheet" href="../../static/css/me.css">
</head> </head>
<body> <body>

View File

@ -3,15 +3,14 @@
<head th:replace="admin/_fragments :: head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分类新增</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css"> <link rel="stylesheet" href="../../static/css/me.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head> </head>
<body> <body>
<!--导航--> <!--导航-->
<nav class="ui inverted attached segment m-padded-tb-mini m-shadow-small" > <nav th:replace="admin/_fragments :: menu(1)"class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
<div class="ui container"> <div class="ui container">
<div class="ui inverted secondary stackable menu"> <div class="ui inverted secondary stackable menu">
<h2 class="ui teal header item">管理后台</h2> <h2 class="ui teal header item">管理后台</h2>
@ -39,8 +38,8 @@
<div class="ui attached pointing menu"> <div class="ui attached pointing menu">
<div class="ui container"> <div class="ui container">
<div class="right menu"> <div class="right menu">
<a href="#" class="teal active item">发布</a> <a href="#" th:href="@{/admin/types/input}" class="active item">新增</a>
<a href="#" class="item">列表</a> <a href="#" th:href="@{/admin/types}" class="teal item">列表</a>
</div> </div>
</div> </div>
</div> </div>
@ -48,15 +47,23 @@
<!--中间内容--> <!--中间内容-->
<div class="m-container-small m-padded-tb-big"> <div class="m-container-small m-padded-tb-big">
<div class="ui container"> <div class="ui container">
<form action="#" method="post" th:action="@{/admin/types}" class="ui form"> <form action="#" method="post" th:object="${type}" th:action="*{id}==null ? @{/admin/types} : @{/admin/types/{id}(id=*{id})}" class="ui form">
<div class="field"> <input type="hidden" name="id" th:value="*{id}">
<div class="required field">
<div class="ui left labeled input"> <div class="ui left labeled input">
<label class="ui teal basic label">名称</label> <label class="ui teal basic label">名称</label>
<input type="text" name="name" placeholder="分类名称"> <input type="text" name="name" placeholder="分类名称" th:value="*{name}">
</div> </div>
</div> </div>
<div class="ui error message"></div> <div class="ui error message"></div>
<!--/*/
<div class="ui negative message" th:if="${#fields.hasErrors('name')}" >
<i class="close icon"></i>
<div class="header">验证失败</div>
<p th:errors="*{name}">提交信息不符合规则</p>
</div>
/*/-->
<div class="ui right aligned container"> <div class="ui right aligned container">
<button type="button" class="ui button" onclick="window.history.go(-1)">返回</button> <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
<button class="ui teal submit button">提交</button> <button class="ui teal submit button">提交</button>
@ -97,8 +104,8 @@
<div class="three wide column"> <div class="three wide column">
<h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4> <h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4>
<div class="ui inverted link list"> <div class="ui inverted link list">
<a href="#" class="item m-text-thin">Emaillirenmi@163.com</a> <a href="#" class="item m-text-thin"></a>
<a href="#" class="item m-text-thin">QQ865729312</a> <a href="#" class="item m-text-thin"></a>
</div> </div>
</div> </div>
<div class="seven wide column"> <div class="seven wide column">

View File

@ -1,11 +1,11 @@
<!DOCTYPE html > <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments ::head(~{::title})"> <head th:replace="admin/_fragments :: head(~{::title})">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>分类</title> <title>博客管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}"> <link rel="stylesheet" href="../../static/css/me.css">
</head> </head>
<body> <body>
@ -16,7 +16,11 @@
<!--中间内容--> <!--中间内容-->
<div class="m-container-small m-padded-tb-big"> <div class="m-container-small m-padded-tb-big">
<div class="ui container"> <div class="ui container">
<div class="ui success message" th:unless="${#strings.isEmpty(message)}">
<i class="close icon"></i>
<div class="header">提示:</div>
<p th:text="${message}">恭喜,操作成功!</p>
</div>
<table class="ui celled table"> <table class="ui celled table">
<thead> <thead>
<tr> <tr>
@ -31,7 +35,7 @@
<td th:text="${type.name}">刻意练习清单</td> <td th:text="${type.name}">刻意练习清单</td>
<td> <td>
<a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini teal basic button">编辑</a> <a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini teal basic button">编辑</a>
<a href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" class="ui mini red basic button">删除</a> <a href="#" th:href="@{/admin/types/{id}/delete(id=${type.id})}" class="ui mini red basic button">删除</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -65,5 +69,23 @@
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script> <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
<!--/*/</th:block>/*/--> <!--/*/</th:block>/*/-->
<script>
$('.menu.toggle').click(function () {
$('.m-item').toggleClass('m-mobile-hide');
});
$('.ui.dropdown').dropdown({
on : 'hover'
});
//消息隐藏
$('.message .close')
.on("click",function (){
$(this)
.closest('.message')
.transition('fade');
})
</script>
</body> </body>
</html> </html>