fix:修复博客接口错误的问题

This commit is contained in:
2025-11-04 09:22:49 +08:00
parent 355a6c256d
commit ed0c8e6664
15 changed files with 13 additions and 1542 deletions

View File

@@ -1,5 +1,5 @@
import { cloudService } from './index'
import { IBlog, IBlogCategory, IBlogComment, IBlogStats, INewBlog, IQueryBlog } from '@/types/blog'
import { IBlog, IBlogCategory, IBlogComment, IBlogStats, IQueryBlog } from '@/types/blog'
import qs from 'qs'
import { IPageRecord } from '@/types'
@@ -23,7 +23,7 @@ export const queryBlogByConditionApi = (query: IQueryBlog): Promise<IBlog[]> =>
export const queryBlogByIdApi = (id: number): Promise<IBlog> =>
cloudService({
url: `/blog-api/blog/content/${id}`,
url: `/blog-api/blog/${id}/content`,
method: 'get'
})
@@ -47,33 +47,6 @@ export const queryLatestBlogApi = (): Promise<IBlog[]> =>
export const queryBlogCommentApi = (blogId: number): Promise<IBlogComment[]> =>
cloudService({
url: `/blog-api/blog/comment/${blogId}`,
url: `/blog-api/blog/${blogId}/comment`,
method: 'get'
})
export const addBlogCommentApi = (blogComment: IBlogComment): Promise<boolean> =>
cloudService({
url: '/blog-api/blog/comment',
method: 'put',
data: blogComment
})
export const addBlogApi = (blog: INewBlog): Promise<boolean> =>
cloudService({
url: '/admin-api/blog-manage',
method: 'post',
data: blog
})
export const updateBlogApi = (id: number, blog: INewBlog): Promise<boolean> =>
cloudService({
url: `/admin-api/blog-manage/${id}`,
method: 'put',
data: blog
})
export const deleteBlogApi = (id: number): Promise<boolean> =>
cloudService({
url: `/admin-api/blog-manage/${id}`,
method: 'DELETE'
})

View File

@@ -1,121 +0,0 @@
<template>
<div class="blog-comment-edit card-item">
<div class="comment-title">
<el-input v-model="blogComment.name"
:maxlength="10" show-word-limit
placeholder="请输入昵称"/>
<el-input v-model="blogComment.website"
:maxlength="50" show-word-limit
placeholder="请输入个人博客网站"/>
</div>
<el-input v-model="blogComment.content"
placeholder="有什么想和我说的呢" :maxlength="500"
:rows="7" show-word-limit type="textarea"
/>
<div class="comment-button">
<el-popover ref="emojiPopoverRef" placement="top" :width="300" trigger="hover">
<template #default>
<div class="emoji-panel">
<EmojiPicker :native="true" @select="onSelectEmoji" />
</div>
</template>
<template #reference>
<el-button circle>
<i class="fa-regular fa-face-smile"></i>
</el-button>
</template>
</el-popover>
<el-button type="primary"
:disabled="blogComment.content.length === 0"
@click="sendCommentClick"
class="send-button">发送</el-button>
</div>
</div>
</template>
<script setup lang="ts">
import EmojiPicker from 'vue3-emoji-picker'
import 'vue3-emoji-picker/css'
import { defineProps, ref, onMounted } from 'vue'
import { useBlogStore } from '@/store/blog.ts'
import { deepCopyObject } from 'vue3-common/utils/dataUtil'
import { IBlogComment } from '@/types/blog.ts'
const blogStore = useBlogStore()
const emojiPopoverRef = ref()
const props = defineProps({
parentId: {
required: true,
type: Number,
default: 0
}
})
const blogComment = ref<IBlogComment>({
id: 0,
blogId: 0,
name: '',
website: '',
content: '',
ipAddress: '',
userAgent: '',
parentId: 0,
isApproved: true,
createTime: ''
})
onMounted(() => {
blogComment.value = deepCopyObject(blogStore.getEmptyBlogComment())
})
const onSelectEmoji = (emoji) => {
if (blogComment.value.content.length <= 498) {
blogComment.value.content += emoji.i
}
emojiPopoverRef.value.hide()
}
const sendCommentClick = async () => {
blogComment.value.parentId = props.parentId
blogComment.value.blogId = blogStore.currentBlogId
if (!blogComment.value.name) {
blogComment.value.name = 'Anonymous'
}
await blogStore.addBlogComment(blogComment.value)
blogComment.value = deepCopyObject(blogStore.getEmptyBlogComment())
blogStore.isShowBlogCommentEdit = false
}
</script>
<style lang="scss">
.blog-comment-edit {
width: 100%;
padding: 10px;
display: flex;
flex-direction: column;
gap: 10px;
.comment-title {
display: flex;
justify-content: space-between;
gap: 10px;
}
.comment-button {
width: 100%;
display: flex;
.send-button {
margin-left: auto;
}
}
}
</style>

View File

@@ -1,127 +0,0 @@
<template>
<div class="blog-comment-card">
<el-avatar :src="`https://api.dicebear.com/6.x/adventurer/svg?seed=${props.comment.name}`"
:size="50" alt="未加载"/>
<div class="blog-comment-content">
<div class="basic-info">
<span>{{ props.comment.name }}</span>
<span class="content">{{ getBrowser(props.comment.userAgent) }}</span>
<span class="content">{{ getOsInfo(props.comment.userAgent) }}</span>
</div>
<div class="sub-info">
<span class="content">{{ props.comment.createTime }}</span>
<el-button v-if="!blogComment.isShowEdit"
type="primary" text @click="replyClick">回复</el-button>
<el-button v-else type="primary"
text @click="cancelClick">取消</el-button>
</div>
<p>{{ props.comment.content }}</p>
<blog-comment-edit v-if="blogComment.isShowEdit"
:parent-id="props.comment.id"/>
<div class="reply-list">
<div class="blog-comment-card" v-for="(item, index) in props.replyList" :key="index">
<el-avatar :src="`https://api.dicebear.com/6.x/adventurer/svg?seed=${item.name}`"
:size="50" alt="未加载"/>
<div class="blog-comment-content">
<div class="basic-info">
<span>{{ item.name }}</span>
<span class="content">{{ getBrowser(props.comment.userAgent) }}</span>
<span class="content">{{ getOsInfo(props.comment.userAgent) }}</span>
</div>
<div class="sub-info">
<span class="content">{{ item.createTime }}</span>
</div>
<p>{{ item.content }}</p>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import BlogCommentEdit from '@/components/Comment/BlogCommentEdit.vue'
import 'vue3-emoji-picker/css'
import { defineProps, PropType, reactive } from 'vue'
import { IBlogComment } from '@/types/blog.ts'
import { useBlogStore } from '@/store/blog.ts'
import { UAParser } from 'ua-parser-js'
const blogStore = useBlogStore()
const props = defineProps({
comment: {
required: true,
type: Object as PropType<IBlogComment>
},
replyList: {
required: true,
type: Object as PropType<IBlogComment[]>
}
})
const blogComment = reactive({
isShowEdit: false
})
const replyClick = () => {
blogStore.currentBlogComment = blogStore.getEmptyBlogComment()
blogComment.isShowEdit = true
}
const cancelClick = () => {
blogComment.isShowEdit = false
}
const getOsInfo = (userAgent: string) => {
const uaParse = new UAParser(userAgent)
return `${uaParse.getOS().name} ${uaParse.getOS().version}`
}
const getBrowser = (userAgent: string) => {
const uaParse = new UAParser(userAgent)
return `${uaParse.getBrowser().name} ${uaParse.getBrowser().version}`
}
</script>
<style lang="scss">
.blog-comment-card {
width: 100%;
padding: 10px;
display: grid;
grid-template-columns: 60px 1fr;
gap: 5px;
.blog-comment-content {
display: flex;
flex-direction: column;
gap: 5px;
.basic-info {
display: flex;
align-items: center;
gap: 10px;
font-size: small;
}
.sub-info {
display: flex;
justify-content: space-between;
align-items: center;
}
.content {
font-size: small;
color: #666666;
}
}
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,230 +0,0 @@
import { MockMethod } from 'vite-plugin-mock'
const billMock: MockMethod[] = [
{
url: '/home-service/bill/pay',
method: 'get',
response: () => {
return [{
id: 602111394902085,
name: '支付宝',
icon: 'fa-brands fa-alipay',
color: '#2220B2'
},
{
id: 602130528899141,
name: '招商银行',
icon: 'fa-solid fa-money-check',
color: '#3E5BFF'
}]
}
},
{
url: '/home-service/bill/book',
method: 'get',
response: () => {
return [{
id: 601082142339141,
name: '日常账本',
icon: 'fa-solid fa-book',
color: '#1E29FF'
},
{
id: 601083198201925,
name: '汽车账本',
icon: 'fa-solid fa-car',
color: '#2E8B57'
}]
}
},
{
url: '/home-service/bill/category',
method: 'get',
response: () => {
return [{
bookName: '日常账本',
color: '#FF1ED6',
icon: 'fa-brands fa-shopify',
id: 601082333016133,
name: '购物',
type: 'expensive'
},
{
bookName: '日常账本',
color: '#3C1EFF',
icon: 'fa-solid fa-utensils',
id: 601082911907909,
name: '餐饮',
type: 'expensive'
},
{
bookName: '日常账本',
color: '#FF1ED6',
icon: 'fa-brands fa-shopify',
id: 601082333016133,
name: '购物',
type: 'expensive'
},
{
bookName: '日常账本',
color: '#FF3C1E',
icon: 'fa-solid fa-sack-dollar',
id: 601422191939653,
name: '工资',
type: 'income'
},
{
bookName: '汽车账本',
color: '#1ED2FF',
icon: 'fa-solid fa-car',
id: 601083391709253,
name: '汽车保养',
type: 'expensive'
}]
}
},
{
url: '/home-service/bill/summary',
method: 'get',
response: () => {
return [{
amount: 213.32,
bookName: '日常账本',
category: '购物',
content: '买东西',
date: '2024-11-11',
id: 611071966380101,
location: '埃斯顿',
payAccount: '支付宝',
remark: '',
type: 'expensive'
},
{
amount: 32.22,
bookName: '日常账本',
category: '餐饮',
content: '肯德基套餐',
date: '2024-10-17',
id: 601083046211653,
location: '肯德基',
payAccount: '招商银行',
remark: '',
type: 'expensive'
},
{
amount: 213.32,
bookName: '日常账本',
category: '购物',
content: '买了一件衣服',
date: '2024-10-17',
id: 601082570399813,
location: '江宁奥特莱斯',
payAccount: '招商银行',
remark: '',
type: 'expensive'
},
{
amount: 55555,
bookName: '日常账本',
category: '工资',
content: '工资收入',
date: '2024-10-17',
id: 601422418636869,
location: '埃斯顿',
payAccount: '招商银行',
remark: '',
type: 'income'
},
{
amount: 2125.23,
bookName: '日常账本',
category: '餐饮',
content: '聚餐',
date: '2024-10-16',
id: 601884663570501,
location: '江宁',
payAccount: '支付宝',
remark: '',
type: 'expensive'
},
{
amount: 532.22,
bookName: '日常账本',
category: '汽车保养',
content: '汽车保养',
date: '2024-10-16',
id: 601083666997317,
location: '溧水4S店',
payAccount: '支付宝',
remark: '',
type: 'expensive'
},
{
amount: 122.32,
bookName: '日常账本',
category: '餐饮',
content: '老表聚餐',
date: '2024-09-12',
id: 601876599046213,
location: '江宁',
payAccount: '招商银行',
remark: '',
type: 'expensive'
}]
}
},
{
url: '/bill/stats/year',
method: 'get',
response: () => {
return [{
name: '2024-10',
value: 2902.9
},
{
name: '2024-09',
value: 122.32
},
{
name: '2024-11',
value: 213.32
}]
}
},
{
url: '/bill/stats/month',
method: 'get',
response: () => {
return []
}
},
{
url: '/bill/stats/book',
method: 'get',
response: () => {
return [{
name: '日常账本',
value: 3238.54
}]
}
},
{
url: '/bill/stats/category',
method: 'get',
response: () => {
return [{
name: '购物',
value: 426.55
},
{
name: '餐饮',
value: 2279.77
},
{
name: '汽车保养',
value: 532.22
}]
}
}]
export default billMock

View File

@@ -1,159 +0,0 @@
import { MockMethod } from 'vite-plugin-mock'
const blogMock: MockMethod[] = [
{
url: '/blog-service/blog/stats',
method: 'get',
response: () => {
return {
blogCount: 10,
categoryCount: 3
}
}
},
{
url: '/blog-service/blog/latest',
method: 'get',
response: () => {
return [{
id: 591259203186757,
title: '一篇标题很长的博客嘿嘿嘿哦哦哦哦哦哦哦'
},
{
id: 591837462601797,
title: '锵锵锵'
},
{
id: 591137032622149,
title: '台风'
},
{
id: 591317392101445,
title: '一篇新的2336'
},
{
id: 591317151170629,
title: '新的一篇文章233500'
}]
}
},
{
url: '/blog-service/blog/category',
method: 'get',
response: () => {
return [{
count: 7,
name: '学习'
},
{
count: 3,
name: '工作'
}]
}
},
{
url: '/blog-service/blog/page',
method: 'get',
response: () => {
return {
current: 1,
pages: 2,
records: [
{
category: '学习',
content: null,
createTime: '2024-09-18 10:52:50',
id: 591837462601797,
isGreat: true,
readDuration: 1.27,
summary: '那半弯新月悬挂于空,洒落一地的晶莹。\n\n夜已被月洗白月下匆匆的步履停顿凝望清点心中如帛的情丝。\n月透着初秋的韵致想念已悄然坠临无语凝噎的痛楚在心间扩散丰盈的思念在秋夜沉迷抒这夜的情愁',
title: '锵锵锵',
topValue: 3,
updateTime: '2024-09-18 10:57:20',
visitCount: 19,
wordCount: 761
},
{
category: '学习',
content: null,
createTime: '2024-09-16 11:22:47',
id: 591837462601797,
isGreat: true,
readDuration: 1.27,
summary: '# 台风12312321312312',
title: '锵锵锵',
topValue: 3,
updateTime: '2024-09-17 00:16:31',
visitCount: 19,
wordCount: 761
},
{
category: '学习',
content: null,
createTime: '2024-09-18 10:52:50',
id: 591837462601797,
isGreat: true,
readDuration: 1.27,
summary: '那半弯新月悬挂于空,洒落一地的晶莹。\n\n夜已被月洗白月下匆匆的步履停顿凝望清点心中如帛的情丝。\n月透着初秋的韵致想念已悄然坠临无语凝噎的痛楚在心间扩散丰盈的思念在秋夜沉迷抒这夜的情愁',
title: '锵锵锵',
topValue: 3,
updateTime: '2024-09-18 10:57:20',
visitCount: 19,
wordCount: 761
},
{
category: '学习',
content: null,
createTime: '2024-09-18 10:52:50',
id: 591837462601797,
isGreat: true,
readDuration: 1.27,
summary: '那半弯新月悬挂于空,洒落一地的晶莹。\n\n夜已被月洗白月下匆匆的步履停顿凝望清点心中如帛的情丝。\n月透着初秋的韵致想念已悄然坠临无语凝噎的痛楚在心间扩散丰盈的思念在秋夜沉迷抒这夜的情愁',
title: '锵锵锵',
topValue: 3,
updateTime: '2024-09-18 10:57:20',
visitCount: 19,
wordCount: 761
},
{
category: '学习',
content: null,
createTime: '2024-09-18 10:52:50',
id: 591837462601797,
isGreat: true,
readDuration: 1.27,
summary: '那半弯新月悬挂于空,洒落一地的晶莹。\n\n夜已被月洗白月下匆匆的步履停顿凝望清点心中如帛的情丝。\n月透着初秋的韵致想念已悄然坠临无语凝噎的痛楚在心间扩散丰盈的思念在秋夜沉迷抒这夜的情愁',
title: '锵锵锵',
topValue: 3,
updateTime: '2024-09-18 10:57:20',
visitCount: 19,
wordCount: 761
}
],
size: 5,
total: 10
}
}
},
{
url: '/blog-service/blog/content/591837462601797',
method: 'get',
response: () => {
return {
category: '学习',
content: '# 台风12312321312312',
createTime: '2024-09-16 11:22:47',
id: 591137032622149,
isGreat: true,
readDuration: 0.03,
summary: '# 台风12312321312312',
title: '台风',
topValue: 3,
updateTime: '2024-09-17 00:16:31',
visitCount: 1,
wordCount: 17
}
}
}]
export default blogMock

View File

@@ -1,117 +0,0 @@
import { MockMethod } from 'vite-plugin-mock'
const budgetMock: MockMethod[] = [
{
url: '/home-service/budget/category',
method: 'get',
response: () => {
return ['结婚预算']
}
},
{
url: '/home-service/budget',
method: 'get',
response: () => {
return [{
actual: 26000,
budget: 23123,
category: '结婚预算',
content: '10.2午宴',
id: 611115630714949,
payTime: null,
project: '婚宴',
remake: '5桌',
vendor: '世纪缘酒店'
},
{
actual: 680,
budget: 700,
category: '结婚预算',
content: '看结婚日子',
id: 611116171505733,
payTime: null,
project: '吉日',
remake: '',
vendor: '算命先生'
},
{
actual: 0,
budget: 0,
category: '结婚预算',
content: '化妆师',
id: 611404639944773,
payTime: null,
project: '婚庆',
remake: '',
vendor: ''
},
{
actual: 0,
budget: 0,
category: '结婚预算',
content: '主持人',
id: 611404716798021,
payTime: null,
project: '婚庆',
remake: '',
vendor: ''
},
{
actual: 10000,
budget: 10000,
category: '结婚预算',
content: '婚车',
id: 611404772474949,
payTime: null,
project: '婚庆',
remake: '',
vendor: ''
}]
}
},
{
url: '/home-service/budget/stats/rank',
method: 'get',
response: () => {
return [{
name: '10.2午宴',
value: 26000
},
{
name: '婚车',
value: 10000
},
{
name: '看结婚日子',
value: 680
},
{
name: '化妆师',
value: 0
},
{
name: '主持人',
value: 0
}]
}
},
{
url: '/home-service/budget/stats/project',
method: 'get',
response: () => {
return [{
name: '婚宴',
value: 26000
},
{
name: '吉日',
value: 680
},
{
name: '婚庆',
value: 10000
}]
}
}]
export default budgetMock

View File

@@ -1,166 +0,0 @@
import { MockMethod } from 'vite-plugin-mock'
const foodMock: MockMethod[] = [
{
url: '/home-service/food/origin',
method: 'get',
response: () => {
return ['中餐']
}
},
{
url: '/home-service/food/summary/page',
method: 'get',
response: () => {
return {
current: 1,
pages: 1,
records: [
{
id: 614660173221957,
name: '鱼头汤',
recommendRate: 5,
workList: [
{
finishBy: '哥哥',
finishTime: '2024-11-13',
id: 614673962934342,
imageUrl: 'files\\food\\image2.png'
},
{
finishBy: '哥哥',
finishTime: '2024-11-20',
id: 614673962934341,
imageUrl: 'files\\food\\image1.png'
}
]
},
{
id: 614665900060741,
name: '红烧肉',
recommendRate: 3,
workList: []
},
{
id: 614668663291973,
name: '红烧排骨',
recommendRate: 5,
workList: []
}
],
size: 6,
total: 3
}
}
},
{
url: '/home-service/food/614660173221957',
method: 'get',
response: () => {
return {
attention: '',
category: '淮扬菜',
cuisine: '清炖',
id: 614660173221957,
materialList: [
{
amount: '一个鱼头',
id: 614673962901573,
name: '胖头鱼',
type: '主料'
},
{
amount: '一块',
id: 614673962901574,
name: '豆腐',
type: '辅料'
},
{
amount: '1小块',
id: 614673962901575,
name: '生姜',
type: '调料'
},
{
amount: '2勺',
id: 614673962901576,
name: '生抽',
type: '调料'
}
],
name: '鱼头汤',
nutritiveValue: '',
origin: '中餐',
recommendRate: 5,
remark: null,
stepList: [{
content: '先把鱼头剁开',
id: 614673962917957,
imageUrl: '',
sort: 0
},
{
content: '洗鱼',
id: 614673962917958,
imageUrl: '',
sort: 1
},
{
content: '倒水放砂锅里煮',
id: 614673962917959,
imageUrl: '',
sort: 2
},
{
content: '放豆腐',
id: 614673962917960,
imageUrl: '',
sort: 3
},
{
content: '放盐',
id: 614673962917961,
imageUrl: '',
sort: 4
}],
workList: [
{
finishBy: '哥哥',
finishTime: '2024-11-20',
id: 614673962934341,
imageUrl: 'files\\food\\image1.png'
}
]
}
}
},
{
url: '/home-service/food/stats/category',
method: 'get',
response: () => {
return [{
name: '淮扬菜',
value: 3
},
{
name: '鲁菜',
value: 2
}]
}
},
{
url: '/home-service/food/stats/cuisine',
method: 'get',
response: () => {
return [{
name: '清炖',
value: 3
},
{
name: '红烧',
value: 2
}]
}
}]
export default foodMock

View File

@@ -1,9 +0,0 @@
import BillMock from './bill'
import BudgetMock from './budget'
import FoodMock from './food'
export default [
...BillMock,
...BudgetMock,
...FoodMock
]

View File

@@ -4,12 +4,10 @@ import {
IBlogLatest, IBlogNestedComment, IBlogStats, INewBlog, IQueryBlog
} from '@/types/blog'
import {
addBlogApi, addBlogCommentApi, deleteBlogApi,
queryBlogApi, queryBlogByConditionApi, queryBlogByIdApi,
queryBlogCategoryApi, queryBlogCommentApi, queryBlogStatsApi, queryLatestBlogApi, updateBlogApi
queryBlogCategoryApi, queryBlogCommentApi, queryBlogStatsApi, queryLatestBlogApi
} from '@/apis/blog.ts'
import { IHandleApi } from 'vue3-common/types'
import { ElMessage } from 'element-plus'
import { ImagePathEnum } from '@/types'
import { flattenToTwoLevel } from '@/utils/blog/blogUtil.ts'
@@ -90,10 +88,6 @@ export const useBlogStore = defineStore('blog', {
async queryBlogComment(blogId: number) {
this.blogCommentList = await queryBlogCommentApi(blogId)
},
async addBlogComment(blogComment: IBlogComment) {
await addBlogCommentApi(blogComment)
await this.queryBlogById(blogComment.blogId)
},
async queryBlogCategory() {
this.blogCategoryList = await queryBlogCategoryApi()
},
@@ -103,25 +97,6 @@ export const useBlogStore = defineStore('blog', {
async queryLatestBlog() {
this.latestBlogList = await queryLatestBlogApi()
},
async handleBlogApi(id?: number) {
switch (this.blogApiType) {
case 'ADD':
await addBlogApi(this.newBlog)
ElMessage.success('新增博客成功')
break
case 'UPDATE':
await updateBlogApi(this.newBlog.id as number, this.newBlog)
ElMessage.success('更新博客成功')
break
case 'DELETE':
await deleteBlogApi(id as number)
ElMessage.success('删除博客成功')
break
default:
break
}
await this.refreshInfo()
},
async refreshInfo() {
this.pageInfo.currentPage = 1
await this.queryBlog()

View File

@@ -1,88 +0,0 @@
import { defineStore } from 'pinia'
import { IBudgetInfo, IBudgetQuery } from '@/types/budget'
import {
addBudgetApi, deleteBudgetApi,
queryBudgetApi,
queryBudgetCategory,
queryBudgetProjectStats,
queryBudgetRankStats, updateBudgetApi
} from '@/apis/budget'
import type { IDialog, IHandleApi, IShowData, IStatsChart } from 'vue3-common/types'
import { ElMessage } from 'element-plus'
export const useBudgetStore = defineStore('budget', {
state: () => ({
budgetList: [] as IBudgetInfo[],
budgetCategoryList: [] as string[],
queryInfo: {
category: ''
} as IBudgetQuery,
budgetApiType: 'ADD' as IHandleApi,
budgetDialog: {
visible: false,
title: '',
data: {}
} as IDialog<IBudgetInfo>,
isRefresh: false,
showDataType: 'DATA' as IShowData,
budgetRankStatsList: [] as IStatsChart[],
budgetProjectStatsList: [] as IStatsChart[]
}),
actions: {
async queryBudget() {
this.budgetList = await queryBudgetApi(this.queryInfo.category)
},
async queryBudgetCategory() {
this.budgetCategoryList = await queryBudgetCategory()
},
async queryBudgetStats() {
this.budgetRankStatsList = await queryBudgetRankStats(this.queryInfo.category)
this.budgetProjectStatsList = await queryBudgetProjectStats(this.queryInfo.category)
},
async handleBlogApi(id?: number) {
switch (this.budgetApiType) {
case 'ADD':
await addBudgetApi(this.budgetDialog.data)
ElMessage.success('新增预算成功')
break
case 'UPDATE':
await updateBudgetApi(id as number, this.budgetDialog.data)
ElMessage.success('更新预算成功')
break
case 'DELETE':
await deleteBudgetApi(id as number)
ElMessage.success('删除预算成功')
break
default:
break
}
this.budgetDialog.visible = false
await this.refreshInfo()
},
async refreshInfo() {
switch (this.showDataType) {
case 'DATA':
await this.queryBudget()
break
case 'CHART':
await this.queryBudgetStats()
break
default:
break
}
this.isRefresh = !this.isRefresh
},
getEmptyBudget(): IBudgetInfo {
return {
actual: 0,
budget: 0,
category: '',
content: '',
payTime: '',
project: '',
remake: '',
vendor: ''
}
}
}
})

View File

@@ -22,10 +22,10 @@
.item {
display: grid;
grid-template-columns: 40px 200px 1fr;
grid-template-columns: 30px 150px 1fr;
justify-items: center;
align-items: center;
gap: 10px;
gap: 5px;
cursor: pointer;
color: blog.$normal-text-color;

View File

@@ -37,6 +37,13 @@
color: #FFFFFF !important;
background-color: #7d26cd;
padding: 2px;
.fa-newspaper::after {
content: "精品";
margin-left: 2px;
font-size: smaller;
font-family: CustomFont, serif;
}
}
.date {