feat:增加博客统计模块

This commit is contained in:
2025-10-27 15:03:24 +08:00
parent 4d52c2ae82
commit 1ba0e6c40b
9 changed files with 375 additions and 8 deletions

View File

@@ -4,9 +4,17 @@ import {
IBlogLatest, IBlogNestedComment, IBlogStats, INewBlog, IQueryBlog
} from '@/types/blog'
import {
addBlogApi, addBlogCommentApi, deleteBlogApi,
queryBlogApi, queryBlogByIdApi,
queryBlogCategoryApi, queryBlogCommentApi, queryBlogStatsApi, queryLatestBlogApi, updateBlogApi
addBlogApi,
addBlogCommentApi,
deleteBlogApi,
queryBlogApi,
queryBlogByIdApi,
queryBlogCategoryApi,
queryBlogCommentApi,
queryBlogStatsApi,
queryLatestBlogApi,
queryUnapprovedBlogApi,
updateBlogApi
} from '@/apis/blog.ts'
import { IHandleApi } from 'vue3-common/types'
import { ElMessage } from 'element-plus'
@@ -16,6 +24,7 @@ import { flattenToTwoLevel } from '@/utils/blog/blogUtil.ts'
export const useBlogStore = defineStore('blog', {
state: () => ({
blogList: [] as IBlog[],
unapprovedBlogList: [] as IBlog[],
blogCommentList: [] as IBlogComment[],
blogNestedCommentList: [] as IBlogNestedComment[],
currentBlogComment: {
@@ -66,7 +75,8 @@ export const useBlogStore = defineStore('blog', {
totalSize: 1
},
isScrollEnd: false,
progressValue: '0%'
progressValue: '0%',
isRefresh: false
}),
actions: {
async queryBlogList() {
@@ -75,6 +85,9 @@ export const useBlogStore = defineStore('blog', {
this.blogList = result.records
this.pageInfo.totalSize = result.total
},
async queryUnapprovedBlogList() {
this.unapprovedBlogList = await queryUnapprovedBlogApi()
},
async queryBlogById(id: number) {
this.currentBlog = await queryBlogByIdApi(id)
await this.queryBlogComment(this.currentBlogId)