diff --git a/src/apis/blog.ts b/src/apis/blog.ts index 40a7546..474ca24 100644 --- a/src/apis/blog.ts +++ b/src/apis/blog.ts @@ -1,5 +1,5 @@ import { cloudService } from './index' -import { IBlog, IBlogCategory, IBlogComment, IBlogSearch, IBlogStats, IQueryBlog } from '@/types/blog' +import { IBlog, IBlogAdjacent, IBlogCategory, IBlogComment, IBlogSearch, IBlogStats, IQueryBlog } from '@/types/blog' import qs from 'qs' import { IPageRecord } from '@/types' @@ -52,6 +52,12 @@ export const queryLatestBlogApi = (): Promise => method: 'get' }) +export const queryBlogAdjacentApi = (blogId: number): Promise => + cloudService({ + url: `/blog-api/blog/${blogId}/adjacent`, + method: 'get' + }) + export const queryBlogCommentApi = (blogId: number): Promise => cloudService({ url: `/blog-api/blog/${blogId}/comment`, diff --git a/src/components/Content/BlogDetail.vue b/src/components/Content/BlogDetail.vue index d92644a..f4058a3 100644 --- a/src/components/Content/BlogDetail.vue +++ b/src/components/Content/BlogDetail.vue @@ -31,6 +31,42 @@ -------------本文结束♥感谢您的阅读♥给个五星好评吧~~------------- +
+ + + + + + + + + + + +
+ @@ -38,6 +74,7 @@ diff --git a/src/layout/components/Sidebar/BlogSummary.vue b/src/layout/components/Sidebar/BlogSummary.vue index 26a78ff..ed4f948 100644 --- a/src/layout/components/Sidebar/BlogSummary.vue +++ b/src/layout/components/Sidebar/BlogSummary.vue @@ -45,7 +45,7 @@ const blogSummaryInfo = reactive({ * 监听路由变化 如果当前是查看博客 则需要显示博客目录 */ watch(() => router.currentRoute.value.path, (path) => { - blogSummaryInfo.isBlogDetail = path.includes('/blog/detail') + blogSummaryInfo.isBlogDetail = path.includes('/detail') if (blogSummaryInfo.isBlogDetail) { blogSummaryInfo.activePanelName = 'Catalog' } diff --git a/src/store/blog.ts b/src/store/blog.ts index a5391c2..a1d66c1 100644 --- a/src/store/blog.ts +++ b/src/store/blog.ts @@ -1,10 +1,10 @@ import { defineStore } from 'pinia' import { - IBlog, IBlogCategory, IBlogComment, + IBlog, IBlogAdjacent, IBlogCategory, IBlogComment, IBlogLatest, IBlogNestedComment, IBlogSearch, IBlogStats, INewBlog, IQueryBlog } from '@/types/blog' import { - addBlogCommentApi, + addBlogCommentApi, queryBlogAdjacentApi, queryBlogApi, queryBlogByConditionApi, queryBlogByIdApi, queryBlogCategoryApi, queryBlogCommentApi, queryBlogStatsApi, queryLatestBlogApi, searchBlogApi } from '@/apis/blog.ts' @@ -50,6 +50,7 @@ export const useBlogStore = defineStore('blog', { blogCategoryList: [] as IBlogCategory[], blogStats: {} as IBlogStats, latestBlogList: [] as IBlogLatest[], + blogAdjacentList: [{ id: 0, title: '' }, { id: 0, title: '' }] as IBlogAdjacent[], queryBlog: {} as IQueryBlog, searchBlogKeyword: '', isSearching: false, @@ -84,6 +85,9 @@ export const useBlogStore = defineStore('blog', { await this.queryBlogComment(this.currentBlogId) this.blogNestedCommentList = flattenToTwoLevel(this.blogCommentList) }, + async queryBlogAdjacent(blogId: number) { + this.blogAdjacentList = await queryBlogAdjacentApi(blogId) + }, async queryBlogComment(blogId: number) { this.blogCommentList = await queryBlogCommentApi(blogId) }, diff --git a/src/styles/blog/blog.sidebar.module.scss b/src/styles/blog/blog.sidebar.module.scss index 657968b..566bcaf 100644 --- a/src/styles/blog/blog.sidebar.module.scss +++ b/src/styles/blog/blog.sidebar.module.scss @@ -245,6 +245,11 @@ $sub-title-font-size: 1rem; width: 100%; overflow: auto; + .md-editor-catalog-active { + background-color: var(--color-copyright-bg); + font-weight: bold; + } + span { word-break: break-all; white-space: normal; diff --git a/src/styles/index.module.scss b/src/styles/index.module.scss index 02a8773..62f8182 100644 --- a/src/styles/index.module.scss +++ b/src/styles/index.module.scss @@ -49,6 +49,7 @@ span, input { --color-card-bg: #FFFFFF; --color-scroll-card-bg: #F8F9FA; --color-copyright-bg: #F8F8F8; + --color-navigation-bg: #F8F8F8; --color-border-bg: #F5F5F5; --color-text: #000000; } diff --git a/src/types/blog.ts b/src/types/blog.ts index 662bf36..4db7c9e 100644 --- a/src/types/blog.ts +++ b/src/types/blog.ts @@ -45,6 +45,11 @@ export interface IBlogCategory { count: number; } +export interface IBlogAdjacent { + id: number; + title: string; +} + export interface IBlogStats { blogCount: number; categoryCount: number;