fix: 系统公告弹窗前端

This commit is contained in:
Gsh
2025-11-05 23:12:23 +08:00
parent 09fb43ee14
commit 17337b8d78
21 changed files with 2729 additions and 17 deletions

View 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'

View 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
}

View File

@@ -1,3 +1,4 @@
export * from './announcement'
export * from './auth';
export * from './chat';
export * from './model';