From 555aaf68f3ee9c8903020ec3856a56bde58c2143 Mon Sep 17 00:00:00 2001 From: xxy <1179705413@qq.com> Date: Sun, 29 Dec 2019 08:27:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E5=A5=97=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../books/web/IndexController.java | 6 +- .../src/main/resources/application.yml | 3 +- .../books/{index.html => index_v1.html} | 0 .../resources/templates/books/index_v2.html | 330 ++++++++++++++++++ .../main/resources/templates/common/css.html | 21 ++ 5 files changed, 358 insertions(+), 2 deletions(-) rename novel-front/src/main/resources/templates/books/{index.html => index_v1.html} (100%) create mode 100644 novel-front/src/main/resources/templates/books/index_v2.html diff --git a/novel-front/src/main/java/xyz/zinglizingli/books/web/IndexController.java b/novel-front/src/main/java/xyz/zinglizingli/books/web/IndexController.java index bade547..ae65341 100644 --- a/novel-front/src/main/java/xyz/zinglizingli/books/web/IndexController.java +++ b/novel-front/src/main/java/xyz/zinglizingli/books/web/IndexController.java @@ -3,6 +3,7 @@ package xyz.zinglizingli.books.web; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,6 +28,9 @@ import java.util.Map; @Slf4j public class IndexController { + @Value("${index.template}") + private String indexTemplate; + private final BookService bookService; @@ -66,6 +70,6 @@ public class IndexController { modelMap.put("hotBooks", hotBooks); modelMap.put("newBooks", newBooks); - return "books/index"; + return "books/index_"+indexTemplate; } } diff --git a/novel-front/src/main/resources/application.yml b/novel-front/src/main/resources/application.yml index f8e9137..4a9c4e1 100644 --- a/novel-front/src/main/resources/application.yml +++ b/novel-front/src/main/resources/application.yml @@ -5,7 +5,7 @@ spring: datasource: url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root - password: test123456 + password: # url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai # username: root # password: test123456 @@ -54,6 +54,7 @@ mybatis: #首页本站推荐小说配置 index: + template: v2 recBooks: - {bookName: 惊悚乐园,bookAuthor: 三天两觉} - {bookName: 最强装逼打脸系统,bookAuthor: 太上布衣} diff --git a/novel-front/src/main/resources/templates/books/index.html b/novel-front/src/main/resources/templates/books/index_v1.html similarity index 100% rename from novel-front/src/main/resources/templates/books/index.html rename to novel-front/src/main/resources/templates/books/index_v1.html diff --git a/novel-front/src/main/resources/templates/books/index_v2.html b/novel-front/src/main/resources/templates/books/index_v2.html new file mode 100644 index 0000000..a4b0dfa --- /dev/null +++ b/novel-front/src/main/resources/templates/books/index_v2.html @@ -0,0 +1,330 @@ + + +
+ + + + +