import request from '@/utils/request'; import type { PostOrPutNoticeType } from '@/pages/notice/data'; import { IBanner } from '@/pages/setting/banner/types'; // 查询公告 type getNoticeType = { curPage: number; label: string; }; export async function getNotice(params: getNoticeType): Promise { return request('/forum/admin/notice', { params }); } // 新增公告 export async function postOrPutNotice(data: PostOrPutNoticeType): Promise { const { methodType } = data; return request('/forum/admin/notice', { method: methodType === 0 ? 'POST' : 'PUT', data }); } // 查看详情 export async function getNoticeDetail(id: string): Promise { return request(`/forum/admin/notice/${id}`); } // 删除公告 export async function deleteNotice(id: string): Promise { return request(`/forum/admin/notice/${id}`, { method: 'DELETE' }); } // 轮播图 // 批量添加/修改轮播图 export async function opraBanner(data: IBanner[], roleId: string) { return request(`/forum/admin/banner/many?roleId=${roleId}`, { method: 'POST', data }); } // 查询轮播图 export async function getBanner(roleId: string) { return request(`/forum/admin/banner?roleId=${roleId}`, { method: 'GET' }); } // 删除轮播图 export async function deleteBanner(id: string) { return request(`/forum/admin/banner/${id}`, { method: 'DELETE' }); }