sheet.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * 自定义页面模板
  3. * @see https://api.halo.run/content-api.html#tag/sheet-controller
  4. */
  5. import HttpHandler from '@/common/http/request.js'
  6. export default {
  7. /**
  8. * 获取页面列表
  9. * {
  10. * page:
  11. * size:
  12. * sort:
  13. * }
  14. */
  15. getSheetsList: (params) => {
  16. return HttpHandler.Get(`/api/content/sheets`, params)
  17. },
  18. /**
  19. * 根据分类获取页面数据
  20. */
  21. getSheetsListBySlug: (params) => {
  22. return HttpHandler.Get(`/api/content/sheets/slug`, params)
  23. },
  24. /**
  25. * 获取页面评论(列表)
  26. */
  27. getSheetsCommentsListBySheetId: (sheetId, params) => {
  28. return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/list_view`, params)
  29. },
  30. /**
  31. * 获取页面评论(树形)
  32. */
  33. getSheetsCommentsTreeBySheetId: (sheetId, params) => {
  34. return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/tree_view`, params)
  35. },
  36. /**
  37. * 获取评论的子评论列表
  38. * @param {String} sheetId 页面id
  39. * @param {String} commentParentId 要获取的评论id
  40. * @param {Object} params 查询参数
  41. */
  42. getSheetsChildrenCommentList: (sheetId, commentParentId, params) => {
  43. return HttpHandler.Get(`/api/content/sheets/${sheetId}/comments/${commentParentId}/children`, params)
  44. },
  45. /**
  46. * 给页面添加一个评论
  47. * {
  48. * "allowNotification": true,
  49. * "author": "string",
  50. * "authorUrl": "string",
  51. * "content": "string",
  52. * "email": "string",
  53. * "parentId": 0,
  54. * "postId": 0
  55. * }
  56. */
  57. postSheetsComments: (data) => {
  58. return HttpHandler.Post(`/api/content/sheets/comments`, data)
  59. },
  60. }