fix: 系统公告弹窗前端
This commit is contained in:
31
Yi.Ai.Vue3/src/api/announcement/index.ts
Normal file
31
Yi.Ai.Vue3/src/api/announcement/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { get } from '@/utils/request'
|
||||
import type {
|
||||
ActivityDetailResponse,
|
||||
AnnouncementDetailResponse,
|
||||
SystemAnnouncementResponse,
|
||||
} from './types'
|
||||
|
||||
/**
|
||||
* 获取系统公告和活动数据
|
||||
*/
|
||||
export function getSystemAnnouncements() {
|
||||
return get<SystemAnnouncementResponse>('/announcement/system').json()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动详情
|
||||
* @param id 活动ID
|
||||
*/
|
||||
export function getActivityDetail(id: string | number) {
|
||||
return get<ActivityDetailResponse>(`/announcement/activity/${id}`).json()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公告详情
|
||||
* @param id 公告ID
|
||||
*/
|
||||
export function getAnnouncementDetail(id: string | number) {
|
||||
return get<AnnouncementDetailResponse>(`/announcement/detail/${id}`).json()
|
||||
}
|
||||
|
||||
export * from './types'
|
||||
51
Yi.Ai.Vue3/src/api/announcement/types.ts
Normal file
51
Yi.Ai.Vue3/src/api/announcement/types.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// 轮播图类型
|
||||
export interface CarouselItem {
|
||||
id: number | string
|
||||
imageUrl: string
|
||||
link?: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
// 活动类型
|
||||
export interface Activity {
|
||||
id: number | string
|
||||
title: string
|
||||
description: string
|
||||
content: string
|
||||
coverImage?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
status: 'active' | 'inactive' | 'expired'
|
||||
createdAt: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
// 公告类型
|
||||
export interface Announcement {
|
||||
id: number | string
|
||||
title: string
|
||||
content: string
|
||||
type: 'latest' | 'history'
|
||||
isImportant?: boolean
|
||||
publishTime: string
|
||||
createdAt: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
// 系统公告响应类型
|
||||
export interface SystemAnnouncementResponse {
|
||||
carousels: CarouselItem[]
|
||||
activities: Activity[]
|
||||
announcements: Announcement[]
|
||||
}
|
||||
|
||||
// 公告详情响应类型
|
||||
export interface AnnouncementDetailResponse extends Announcement {
|
||||
views?: number
|
||||
}
|
||||
|
||||
// 活动详情响应类型
|
||||
export interface ActivityDetailResponse extends Activity {
|
||||
views?: number
|
||||
participantCount?: number
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './announcement'
|
||||
export * from './auth';
|
||||
export * from './chat';
|
||||
export * from './model';
|
||||
|
||||
Reference in New Issue
Block a user