notice.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import request from '@/utils/request';
  2. import type { PostOrPutNoticeType } from '@/pages/notice/data';
  3. import { IBanner } from '@/pages/setting/banner/types';
  4. // 查询公告
  5. type getNoticeType = {
  6. curPage: number;
  7. label: string;
  8. };
  9. export async function getNotice(params: getNoticeType): Promise<any> {
  10. return request('/forum/admin/notice', { params });
  11. }
  12. // 新增公告
  13. export async function postOrPutNotice(data: PostOrPutNoticeType): Promise<any> {
  14. const { methodType } = data;
  15. return request('/forum/admin/notice', { method: methodType === 0 ? 'POST' : 'PUT', data });
  16. }
  17. // 查看详情
  18. export async function getNoticeDetail(id: string): Promise<any> {
  19. return request(`/forum/admin/notice/${id}`);
  20. }
  21. // 删除公告
  22. export async function deleteNotice(id: string): Promise<any> {
  23. return request(`/forum/admin/notice/${id}`, { method: 'DELETE' });
  24. }
  25. // 轮播图
  26. // 批量添加/修改轮播图
  27. export async function opraBanner(data: IBanner[], roleId: string) {
  28. return request(`/forum/admin/banner/many?roleId=${roleId}`, { method: 'POST', data });
  29. }
  30. // 查询轮播图
  31. export async function getBanner(roleId: string) {
  32. return request(`/forum/admin/banner?roleId=${roleId}`, { method: 'GET' });
  33. }
  34. // 删除轮播图
  35. export async function deleteBanner(id: string) {
  36. return request(`/forum/admin/banner/${id}`, { method: 'DELETE' });
  37. }