101 lines
1.6 KiB
TypeScript
101 lines
1.6 KiB
TypeScript
import request from '@/utils/http'
|
|
|
|
/**
|
|
* 评论相关 API
|
|
*/
|
|
|
|
/**
|
|
* 获取评论列表
|
|
*/
|
|
export function fetchGetComments(params: {
|
|
target_type?: string
|
|
target_id?: string
|
|
page?: number
|
|
pageSize?: number
|
|
}) {
|
|
return request.get<{
|
|
list: CommentItem[]
|
|
total: number
|
|
page: number
|
|
pageSize: number
|
|
}>({
|
|
url: '/web/system/comments',
|
|
params
|
|
})
|
|
}
|
|
|
|
export interface CommentItem {
|
|
id: string
|
|
parentId?: string
|
|
author: string
|
|
authorId?: string
|
|
content: string
|
|
targetType?: string
|
|
targetId?: string
|
|
timestamp: string
|
|
replies: CommentItem[]
|
|
}
|
|
|
|
/**
|
|
* 创建评论
|
|
*/
|
|
export function fetchCreateComment(data: {
|
|
author: string
|
|
content: string
|
|
parent_id?: string
|
|
author_id?: string
|
|
target_type?: string
|
|
target_id?: string
|
|
}) {
|
|
return request.post<CommentItem>({
|
|
url: '/web/system/comments',
|
|
data
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 删除评论
|
|
*/
|
|
export function fetchDeleteComment(commentId: string) {
|
|
return request.delete<{ id: string }>({
|
|
url: `/web/system/comments/${commentId}`
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 系统配置相关 API
|
|
*/
|
|
|
|
/**
|
|
* 获取中国地图GeoJSON数据
|
|
*/
|
|
export function fetchGetChinaMapData() {
|
|
return request.get<any>({
|
|
url: '/web/system/china-map'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取系统配置
|
|
*/
|
|
export function fetchGetSystemConfig(configKey: string) {
|
|
return request.get<{
|
|
key: string
|
|
value: unknown
|
|
name: string
|
|
type: string
|
|
description?: string
|
|
} | null>({
|
|
url: `/web/system/config/${configKey}`
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取当前系统版本号
|
|
*/
|
|
export function fetchGetCurrentVersion() {
|
|
return request.get<{ version: string }>({
|
|
url: '/web/system/version'
|
|
})
|
|
}
|