courseEditor.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import request from "@/util/request.ts";
  2. /**
  3. * 获取课程的详情
  4. * 包括课程的名称,封面,知识点等
  5. */
  6. export function getCourseDetail(id:any) {
  7. return request({
  8. method: "get",
  9. url: "/course",
  10. params: {
  11. id: id
  12. }
  13. });
  14. }
  15. /**
  16. * 新增或保存课程
  17. *
  18. */
  19. export function saveCourse(data:any) {
  20. if (data.id != null && data.id.length > 0) {
  21. return request({
  22. url:"/course",
  23. method: "put",
  24. data:data
  25. });
  26. } else {
  27. return request({
  28. url: "/course",
  29. method: "post",
  30. data: data
  31. });
  32. }
  33. }
  34. /*********Start 章节相关************/
  35. export function saveChapterItem(data:any) {
  36. if (data.id != null && data.id.length > 0) {
  37. return request({
  38. url: "/courseChapter",
  39. method: "put",
  40. data: data
  41. });
  42. } else {
  43. return request({
  44. url: "/courseChapter",
  45. method: "post",
  46. data: data
  47. });
  48. }
  49. }
  50. export function deleteChapterItem(id: any) {
  51. return request({
  52. method: "delete",
  53. url: "/courseChapter",
  54. params: {
  55. id: id
  56. }
  57. });
  58. }
  59. /**
  60. *
  61. * @param id
  62. */
  63. export function getChapterDetail(id: any) {
  64. return request({
  65. method: "get",
  66. url: "courseChapter",
  67. params: {
  68. id: id
  69. }
  70. });
  71. }
  72. export function getChapterTree(id:any) {
  73. return request({
  74. method: "get",
  75. url: "/courseChapter/tree",
  76. params: {
  77. courseId:id
  78. }
  79. });
  80. }