index.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import request from '@/utils/request';
  2. import { AxiosPromise } from 'axios';
  3. import { ArticleVO, ArticleForm, ArticleQuery } from '@/api/system/article/types';
  4. /**
  5. * 查询文章(可用于活动预热)列表
  6. * @param query
  7. * @returns {*}
  8. */
  9. export const listArticle = (query?: ArticleQuery): AxiosPromise<ArticleVO[]> => {
  10. return request({
  11. url: '/system/article/list',
  12. method: 'get',
  13. params: query
  14. });
  15. };
  16. /**
  17. * 查询文章(可用于活动预热)详细
  18. * @param id
  19. */
  20. export const getArticle = (id: string | number): AxiosPromise<ArticleVO> => {
  21. return request({
  22. url: '/system/article/' + id,
  23. method: 'get'
  24. });
  25. };
  26. /**
  27. * 新增文章(可用于活动预热)
  28. * @param data
  29. */
  30. export const addArticle = (data: ArticleForm) => {
  31. return request({
  32. url: '/system/article',
  33. method: 'post',
  34. data: data
  35. });
  36. };
  37. /**
  38. * 修改文章(可用于活动预热)
  39. * @param data
  40. */
  41. export const updateArticle = (data: ArticleForm) => {
  42. return request({
  43. url: '/system/article',
  44. method: 'put',
  45. data: data
  46. });
  47. };
  48. /**
  49. * 删除文章(可用于活动预热)
  50. * @param id
  51. */
  52. export const delArticle = (id: string | number | Array<string | number>) => {
  53. return request({
  54. url: '/system/article/' + id,
  55. method: 'delete'
  56. });
  57. };
  58. /**
  59. * 修改文章默认状态
  60. * @param data - 文章BO对象
  61. */
  62. export const changeArticleDefault = (data: ArticleForm): AxiosPromise<void> => {
  63. return request({
  64. url: '/system/article/changeArticleDefault',
  65. method: 'post',
  66. data: data
  67. });
  68. };
  69. /**
  70. * 查询赛事项目数量
  71. * @returns {*}
  72. */
  73. export const getArticleCount = () => {
  74. return request({
  75. url: '/system/article/count',
  76. method: 'get'
  77. });
  78. };