From 8a48f5ee3a212801c32c5eab45934e9f28834ab8 Mon Sep 17 00:00:00 2001
From: MiniDay <372403923@qq.com>
Date: Sat, 8 Apr 2023 12:32:02 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E5=8F=91=E4=B8=AD...?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../blog/controller/BlogController.java | 4 +-
.../application/blog/entity/AttachEntity.java | 2 +-
.../blog/entity/BlogAttachEntity.java | 2 +-
.../application/blog/entity/BlogEntity.java | 2 +-
.../blog/entity/SettingEntity.java | 2 +-
.../application/blog/entity/UserEntity.java | 2 +-
.../blog/service/IBlogService.java | 2 +-
.../blog/service/impl/BlogService.java | 6 +-
.../src/components/BlogCardComponent.vue | 2 +-
.../manage/AttachManageComponent.vue | 33 +++++++++-
.../components/manage/BlogManageComponent.vue | 2 +-
.../components/manage/SiteManageComponent.vue | 60 +++++++++--------
blog-frontend/src/views/BlogEditView.vue | 2 +-
blog-frontend/src/views/BlogReadView.vue | 65 ++++++++++++++-----
blog-frontend/src/views/ManagePaneView.vue | 22 +++++--
15 files changed, 142 insertions(+), 66 deletions(-)
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/BlogController.java b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/BlogController.java
index 0698adf..abafaee 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/BlogController.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/BlogController.java
@@ -50,7 +50,7 @@ public class BlogController {
@DeleteMapping("/{blogID}/")
@Operation(summary = "删除博文")
- public ResponseVO removeBlog(@PathVariable Long blogID) {
- return blogService.removeBlog(blogID);
+ public ResponseVO deleteBlog(@PathVariable Long blogID) {
+ return blogService.deleteBlog(blogID);
}
}
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java
index 5b521cc..85cdeee 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java
@@ -50,7 +50,7 @@ public class AttachEntity {
@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "create_time", nullable = false)
+ @Column(name = "create_time", nullable = false, updatable = false)
private Date createTime;
@LastModifiedDate
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java
index 748b5f3..e696274 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java
@@ -54,7 +54,7 @@ public class BlogAttachEntity {
@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "create_time", nullable = false)
+ @Column(name = "create_time", nullable = false, updatable = false)
private Date createTime;
@LastModifiedDate
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogEntity.java
index b4f83b0..6a088d9 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogEntity.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogEntity.java
@@ -74,7 +74,7 @@ public class BlogEntity {
@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "create_time", nullable = false)
+ @Column(name = "create_time", nullable = false, updatable = false)
private Date createTime;
@LastModifiedDate
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/SettingEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/SettingEntity.java
index 45b587c..f21ab09 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/SettingEntity.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/SettingEntity.java
@@ -33,7 +33,7 @@ public class SettingEntity {
@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "create_time", nullable = false)
+ @Column(name = "create_time", nullable = false, updatable = false)
private Date createTime;
@LastModifiedDate
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/UserEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/UserEntity.java
index 08907ea..4e3acf2 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/UserEntity.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/UserEntity.java
@@ -63,7 +63,7 @@ public class UserEntity {
@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
- @Column(name = "create_time", nullable = false)
+ @Column(name = "create_time", nullable = false, updatable = false)
private Date createTime;
@LastModifiedDate
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/IBlogService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/IBlogService.java
index f54d443..e7405d5 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/IBlogService.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/IBlogService.java
@@ -16,5 +16,5 @@ public interface IBlogService {
@NotNull ResponseVO updateBlog(@NotNull Long blogID, @NotNull BlogUpdateRequireVO requireVO);
- @NotNull ResponseVO removeBlog(@NotNull Long blogID);
+ @NotNull ResponseVO deleteBlog(@NotNull Long blogID);
}
diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/BlogService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/BlogService.java
index 24d7d70..060223c 100644
--- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/BlogService.java
+++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/BlogService.java
@@ -30,7 +30,6 @@ public class BlogService implements IBlogService {
if (checked != null) {
return checked;
}
- log.info("create blog vo: {}", requireVO);
BlogEntity entity = blogMapper.voToEntity(requireVO);
entity = blogRepo.save(entity);
return ResponseVO.success(entity.getId());
@@ -54,7 +53,7 @@ public class BlogService implements IBlogService {
if (user == null) {
return ResponseVO.unauthorized();
}
- log.info("update blog vo: {}", requireVO);
+ log.info("update blog vo: {}", blogID);
BlogEntity blogEntity = blogRepo.findByIdWithCreator(blogID);
if (blogEntity == null) {
return ResponseVO.failed("该博文不存在!");
@@ -78,11 +77,12 @@ public class BlogService implements IBlogService {
blogEntity.setPublish(requireVO.getPublish());
blogEntity.setTags(requireVO.getTags());
blogRepo.save(blogEntity);
+
return ResponseVO.success();
}
@Override
- public @NotNull ResponseVO removeBlog(@NotNull Long blogID) {
+ public @NotNull ResponseVO deleteBlog(@NotNull Long blogID) {
BlogUser user = BlogUtils.getCurrentUser().orElse(null);
if (user == null) {
return ResponseVO.unauthorized();
diff --git a/blog-frontend/src/components/BlogCardComponent.vue b/blog-frontend/src/components/BlogCardComponent.vue
index 14fc55f..949d3aa 100644
--- a/blog-frontend/src/components/BlogCardComponent.vue
+++ b/blog-frontend/src/components/BlogCardComponent.vue
@@ -40,7 +40,7 @@ function showUpdater() {
{{ blog.creator.nickname }}
- {{ " 首次发表于:" + blog.updateTime.toLocaleString() }}
+ {{ " 首次发表于:" + blog.createTime.toLocaleString() }}
diff --git a/blog-frontend/src/components/manage/AttachManageComponent.vue b/blog-frontend/src/components/manage/AttachManageComponent.vue
index 57b62a4..4e3ea0e 100644
--- a/blog-frontend/src/components/manage/AttachManageComponent.vue
+++ b/blog-frontend/src/components/manage/AttachManageComponent.vue
@@ -1,12 +1,43 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/blog-frontend/src/components/manage/BlogManageComponent.vue b/blog-frontend/src/components/manage/BlogManageComponent.vue
index 4df7918..06db6b2 100644
--- a/blog-frontend/src/components/manage/BlogManageComponent.vue
+++ b/blog-frontend/src/components/manage/BlogManageComponent.vue
@@ -102,7 +102,7 @@ function loadPage(newPage: number) {
{{ blog.creator.nickname }}
- {{ " 首次发表于:" + blog.updateTime.toLocaleString() }}
+ {{ " 首次发表于:" + blog.createTime.toLocaleString() }}
diff --git a/blog-frontend/src/components/manage/SiteManageComponent.vue b/blog-frontend/src/components/manage/SiteManageComponent.vue
index 1b96ecc..f2b763f 100644
--- a/blog-frontend/src/components/manage/SiteManageComponent.vue
+++ b/blog-frontend/src/components/manage/SiteManageComponent.vue
@@ -34,33 +34,39 @@ function changeCustomCSS(cssText: string) {
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/blog-frontend/src/views/BlogEditView.vue b/blog-frontend/src/views/BlogEditView.vue
index 90b1685..2ec3743 100644
--- a/blog-frontend/src/views/BlogEditView.vue
+++ b/blog-frontend/src/views/BlogEditView.vue
@@ -143,7 +143,7 @@ function handleCreated(editor: IDomEditor) {
-import "@wangeditor/editor/dist/css/style.css";
import { ref } from "vue";
import { useRoute } from "vue-router";
@@ -108,28 +107,58 @@ function deleteBlog() {
.blog-content {
width: 95%;
margin: 0 auto;
- overflow-x: hidden;
-}
-.blog-content > h1,
-h2,
-h3,
-h4,
-h5 {
- line-height: 64px;
}
-.blog-content > p {
- line-height: 24px;
+.blog-content > p,
+img {
+ width: 100%;
}
-.blog-content > * {
- font-family: system-ui;
- font-size: normal;
+.blog-content p,
+.blog-content li {
+ white-space: pre-wrap; /* 保留空格 */
}
-.blog-content > pre {
- margin: 12px 0 12px 0;
- padding: 12px 12px 12px 12px;
- background-color: #ccc;
+.blog-content blockquote {
+ border-left: 8px solid #d0e5f2;
+ padding: 10px 10px;
+ margin: 10px 0;
+ background-color: #f1f1f1;
+}
+
+.blog-content code {
+ font-family: monospace;
+ background-color: #eee;
+ padding: 3px;
+ border-radius: 3px;
+}
+
+.blog-content pre > code {
+ display: block;
+ padding: 10px;
+}
+
+.blog-content table {
+ border-collapse: collapse;
+}
+
+.blog-content td,
+.blog-content th {
+ border: 1px solid #ccc;
+ min-width: 50px;
+ height: 20px;
+}
+
+.blog-content th {
+ background-color: #f1f1f1;
+}
+
+.blog-content ul,
+.blog-content ol {
+ padding-left: 20px;
+}
+
+.blog-content input[type="checkbox"] {
+ margin-right: 5px;
}
diff --git a/blog-frontend/src/views/ManagePaneView.vue b/blog-frontend/src/views/ManagePaneView.vue
index e089251..eab09b2 100644
--- a/blog-frontend/src/views/ManagePaneView.vue
+++ b/blog-frontend/src/views/ManagePaneView.vue
@@ -23,20 +23,30 @@ onMounted(() => {
-
-
+
+
-
+
-
+
-
+
-
+