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 @@ - +