From 16894fde8eb7ad31bb52f1c5a1f0741c290bb297 Mon Sep 17 00:00:00 2001 From: JIAL <2287346125@qq.com> Date: Mon, 25 Dec 2023 09:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 ++- .../JIAL/FMSystem/config/WebMvcConfig.java | 3 +- .../FMSystem/controller/HomeController.java | 28 +++++++++++++++ .../FMSystem/filter/LoginCheckFilter.java | 7 ++-- .../{index => static}/image/avatar.jpg | Bin .../{index => static}/image/favicon.png | Bin .../{index => static}/image/leetcode.png | Bin .../{index => static}/image/leetcode1.png | Bin .../css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 | Bin .../{index => static}/style/css/main.css | 0 .../{index => static}/style/js/index.js | 0 .../{index => static}/style/js/main.js | 0 .../resources/{index => templates}/index.html | 12 +++---- target/classes/backend/favicon.ico | Bin 4286 -> 0 bytes .../JIAL/FMSystem/config/WebMvcConfig.class | Bin 2489 -> 2567 bytes .../FMSystem/controller/HomeController.class | Bin 0 -> 591 bytes .../FMSystem/filter/LoginCheckFilter.class | Bin 3623 -> 3561 bytes .../{index => static}/image/avatar.jpg | Bin .../classes/static/image/favicon.png | Bin target/classes/static/image/leetcode.png | Bin 0 -> 8210 bytes target/classes/static/image/leetcode1.png | Bin 0 -> 6491 bytes .../css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 | Bin .../{index => static}/style/css/main.css | 7 ++-- .../{index => static}/style/js/index.js | 0 .../{index => static}/style/js/main.js | 0 .../classes/{index => templates}/index.html | 34 +++++++++--------- 26 files changed, 63 insertions(+), 33 deletions(-) create mode 100644 src/main/java/com/JIAL/FMSystem/controller/HomeController.java rename src/main/resources/{index => static}/image/avatar.jpg (100%) rename src/main/resources/{index => static}/image/favicon.png (100%) rename src/main/resources/{index => static}/image/leetcode.png (100%) rename src/main/resources/{index => static}/image/leetcode1.png (100%) rename src/main/resources/{index => static}/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 (100%) rename src/main/resources/{index => static}/style/css/main.css (100%) rename src/main/resources/{index => static}/style/js/index.js (100%) rename src/main/resources/{index => static}/style/js/main.js (100%) rename src/main/resources/{index => templates}/index.html (98%) delete mode 100644 target/classes/backend/favicon.ico create mode 100644 target/classes/com/JIAL/FMSystem/controller/HomeController.class rename target/classes/{index => static}/image/avatar.jpg (100%) rename src/main/resources/index/favicon/日出江花红.png => target/classes/static/image/favicon.png (100%) create mode 100644 target/classes/static/image/leetcode.png create mode 100644 target/classes/static/image/leetcode1.png rename target/classes/{index => static}/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 (100%) rename target/classes/{index => static}/style/css/main.css (99%) rename target/classes/{index => static}/style/js/index.js (100%) rename target/classes/{index => static}/style/js/main.js (100%) rename target/classes/{index => templates}/index.html (86%) diff --git a/pom.xml b/pom.xml index ae9b3ea..89a5efc 100644 --- a/pom.xml +++ b/pom.xml @@ -124,7 +124,10 @@ junit 4.10 - + + org.springframework.boot + spring-boot-starter-thymeleaf + diff --git a/src/main/java/com/JIAL/FMSystem/config/WebMvcConfig.java b/src/main/java/com/JIAL/FMSystem/config/WebMvcConfig.java index d8b132e..98e488f 100644 --- a/src/main/java/com/JIAL/FMSystem/config/WebMvcConfig.java +++ b/src/main/java/com/JIAL/FMSystem/config/WebMvcConfig.java @@ -23,8 +23,9 @@ public class WebMvcConfig extends WebMvcConfigurationSupport { log.info("开始进行静态资源映射..."); //第一个参数是路径,显示在浏览器的,第二个参数是映射路径,我们文件夹的路径 registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/"); - registry.addResourceHandler("/index/**").addResourceLocations("classpath:/index/"); + registry.addResourceHandler("/templates/**").addResourceLocations("classpath:/templates/"); registry.addResourceHandler("/plugins/**").addResourceLocations("classpath:/plugins/"); + registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); } /** diff --git a/src/main/java/com/JIAL/FMSystem/controller/HomeController.java b/src/main/java/com/JIAL/FMSystem/controller/HomeController.java new file mode 100644 index 0000000..14a35e3 --- /dev/null +++ b/src/main/java/com/JIAL/FMSystem/controller/HomeController.java @@ -0,0 +1,28 @@ +package com.JIAL.FMSystem.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * @ClassName HomeController + * @Description TODO + * @Author JIAL + * @Date 2023/12/25 8:18 + * @Version 1.0 + */ +@Controller +public class HomeController { + + /** + * @title index + * @description 检测请求为/,即只有域名,不加路径的请求,返回主页 + * @author JIAL + * @updateTime 2023/12/25 8:18 + * @return: java.lang.String + */ + @GetMapping("/") + public String index() { + // 返回 index.html 页面的逻辑视图名 + return "index"; + } +} \ No newline at end of file diff --git a/src/main/java/com/JIAL/FMSystem/filter/LoginCheckFilter.java b/src/main/java/com/JIAL/FMSystem/filter/LoginCheckFilter.java index 642f8e0..99ac85c 100644 --- a/src/main/java/com/JIAL/FMSystem/filter/LoginCheckFilter.java +++ b/src/main/java/com/JIAL/FMSystem/filter/LoginCheckFilter.java @@ -31,22 +31,19 @@ public class LoginCheckFilter implements Filter{ log.info("拦截到请求:{}",requestURI); - //定义不需要处理的请求路径 + //定义需要处理的请求路径 String[] urls = new String[]{ "/user/login", "/user/logout", "/backend/**", "/user/sendMsg", - "/index/**", - "/plugins/**", - "/api/**" }; //2、判断本次请求是否需要处理 boolean check = check(urls, requestURI); //3、如果不需要处理,则直接放行 - if(check){ + if(!check){ log.info("本次请求{}不需要处理",requestURI); filterChain.doFilter(request,response); return; diff --git a/src/main/resources/index/image/avatar.jpg b/src/main/resources/static/image/avatar.jpg similarity index 100% rename from src/main/resources/index/image/avatar.jpg rename to src/main/resources/static/image/avatar.jpg diff --git a/src/main/resources/index/image/favicon.png b/src/main/resources/static/image/favicon.png similarity index 100% rename from src/main/resources/index/image/favicon.png rename to src/main/resources/static/image/favicon.png diff --git a/src/main/resources/index/image/leetcode.png b/src/main/resources/static/image/leetcode.png similarity index 100% rename from src/main/resources/index/image/leetcode.png rename to src/main/resources/static/image/leetcode.png diff --git a/src/main/resources/index/image/leetcode1.png b/src/main/resources/static/image/leetcode1.png similarity index 100% rename from src/main/resources/index/image/leetcode1.png rename to src/main/resources/static/image/leetcode1.png diff --git a/src/main/resources/index/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 b/src/main/resources/static/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 similarity index 100% rename from src/main/resources/index/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 rename to src/main/resources/static/style/css/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2 diff --git a/src/main/resources/index/style/css/main.css b/src/main/resources/static/style/css/main.css similarity index 100% rename from src/main/resources/index/style/css/main.css rename to src/main/resources/static/style/css/main.css diff --git a/src/main/resources/index/style/js/index.js b/src/main/resources/static/style/js/index.js similarity index 100% rename from src/main/resources/index/style/js/index.js rename to src/main/resources/static/style/js/index.js diff --git a/src/main/resources/index/style/js/main.js b/src/main/resources/static/style/js/main.js similarity index 100% rename from src/main/resources/index/style/js/main.js rename to src/main/resources/static/style/js/main.js diff --git a/src/main/resources/index/index.html b/src/main/resources/templates/index.html similarity index 98% rename from src/main/resources/index/index.html rename to src/main/resources/templates/index.html index ada3633..b67868e 100644 --- a/src/main/resources/index/index.html +++ b/src/main/resources/templates/index.html @@ -7,8 +7,8 @@ - - + + @@ -52,7 +52,7 @@
- +
J
@@ -112,7 +112,7 @@
  • - +
  • @@ -136,7 +136,7 @@
  • - + @@ -144,7 +144,7 @@ - + + @@ -142,7 +144,7 @@ - +