From 2dea178fde7eccba2ce9555dd2b2d3dbdf8c567a Mon Sep 17 00:00:00 2001 From: mayiming <1627832236@qq.com> Date: Sat, 4 Oct 2025 20:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E7=AB=A0=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- management/src/App.vue | 4 + management/src/router/index.ts | 11 + management/src/views/news/NewsView.vue | 4 +- management/src/views/news/QuillEditor.vue | 268 ------ management/src/views/publish/PublishView.vue | 9 + management/src/views/publish/QuillEditor.vue | 884 +++++++++++++++++++ server/main.go | 4 + 7 files changed, 913 insertions(+), 271 deletions(-) delete mode 100644 management/src/views/news/QuillEditor.vue create mode 100644 management/src/views/publish/PublishView.vue create mode 100644 management/src/views/publish/QuillEditor.vue diff --git a/management/src/App.vue b/management/src/App.vue index a331eb60..1e508c97 100644 --- a/management/src/App.vue +++ b/management/src/App.vue @@ -47,6 +47,10 @@ 个人信息 + + + 发布文章 + diff --git a/management/src/router/index.ts b/management/src/router/index.ts index f10b6efc..e4efc1ea 100644 --- a/management/src/router/index.ts +++ b/management/src/router/index.ts @@ -6,6 +6,7 @@ import type { RouteRecordRaw } from 'vue-router' const HomeView = () => import('../views/HomeView.vue') const AboutView = () => import('../views/AboutView.vue') const NewsView = () => import('../views/news/NewsView.vue') +const PublishView = () => import('../views/publish/PublishView.vue') // 定义路由规则(现在 RouteRecordRaw 导入正确) const routes: RouteRecordRaw[] = [ @@ -53,6 +54,16 @@ const routes: RouteRecordRaw[] = [ title: '个人中心', requiresAuth: false } + } + , + { + path: '/publish', + name: 'Publish', + component: PublishView, + meta: { + title: '文章发布', + requiresAuth: false + } }, { path: '/about', diff --git a/management/src/views/news/NewsView.vue b/management/src/views/news/NewsView.vue index 530e0525..8e7893a4 100644 --- a/management/src/views/news/NewsView.vue +++ b/management/src/views/news/NewsView.vue @@ -1,10 +1,8 @@ - 使用 Quill 富文本编辑器 - + diff --git a/management/src/views/news/QuillEditor.vue b/management/src/views/news/QuillEditor.vue deleted file mode 100644 index 9ae50b7e..00000000 --- a/management/src/views/news/QuillEditor.vue +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - - 打印当前编辑器内容到控制台 - - - - - - - \ No newline at end of file diff --git a/management/src/views/publish/PublishView.vue b/management/src/views/publish/PublishView.vue new file mode 100644 index 00000000..e1e4c715 --- /dev/null +++ b/management/src/views/publish/PublishView.vue @@ -0,0 +1,9 @@ + + + + + + + diff --git a/management/src/views/publish/QuillEditor.vue b/management/src/views/publish/QuillEditor.vue new file mode 100644 index 00000000..26377499 --- /dev/null +++ b/management/src/views/publish/QuillEditor.vue @@ -0,0 +1,884 @@ + + + + + + + 发表新文章 + 创作优质内容,分享你的观点 + + + + + + + 文章标题 + + + + {{ titleHintText }} + + + + + + 文章封面 + 建议上传16:9比例图片,支持JPG/PNG/WEBP格式,大小不超过5MB + + + + + + + + + + + + + + + 点击或拖拽图片至此处上传 + 支持JPG/PNG/WEBP,最大5MB + + + + + + + + 文章内容 + 请使用编辑器创作文章,支持文字、图片、代码块等格式 + + + + + + + + + 字数:{{ wordCount }} + + {{ contentHintText }} + + + + + + + + + 保存草稿 + + + + + 发布文章 + + + + + + + + + diff --git a/server/main.go b/server/main.go index 2e319a25..017327b5 100644 --- a/server/main.go +++ b/server/main.go @@ -34,6 +34,10 @@ func main() { // 3. 图片上传接口 r.POST("/api/upload/image", uploadImageHandler) + r.POST("/api/upload/cover", func(c *gin.Context) { + // 直接复用已有的上传逻辑 + uploadImageHandler(c) + }) // 4. 启动服务 fmt.Println("后端服务启动成功,地址:http://localhost:8080")
创作优质内容,分享你的观点
+ {{ titleHintText }} +
建议上传16:9比例图片,支持JPG/PNG/WEBP格式,大小不超过5MB
点击或拖拽图片至此处上传
支持JPG/PNG/WEBP,最大5MB
请使用编辑器创作文章,支持文字、图片、代码块等格式
+ 字数:{{ wordCount }} + + {{ contentHintText }} + +