course.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * 授权 API
  3. */
  4. import {
  5. http
  6. } from '../request/main.js';
  7. /**
  8. * 获取分类列表
  9. *
  10. * @returns {Promise}
  11. */
  12. export function getCategoryList(id) {
  13. return http.post('/course/getCategoryList', {}, {
  14. muteLogin: true
  15. });
  16. }
  17. /**
  18. * 获取课程列表
  19. *
  20. * @returns {Promise}
  21. */
  22. export function getCourseList(category_id, group, sort, keyword, page, page_size) {
  23. return http.post('/course/getCourseList', {
  24. category_id,
  25. group,
  26. sort,
  27. keyword,
  28. page,
  29. page_size
  30. }, {
  31. muteLogin: true
  32. });
  33. }
  34. /**
  35. * 获取课程详情
  36. *
  37. * @returns {Promise}
  38. */
  39. export function getCourseDetail(id) {
  40. return http.post('/course/getCourseDetail', {
  41. id
  42. }, {
  43. muteLogin: true
  44. });
  45. }
  46. /**
  47. * 获取课程考核
  48. *
  49. * @returns {Promise}
  50. */
  51. export function getCourseExamine(id) {
  52. return http.post('/course/getCourseExamine', {
  53. id
  54. }, {
  55. muteLogin: true
  56. });
  57. }
  58. /**
  59. * 获取内容详情
  60. *
  61. * @returns {Promise}
  62. */
  63. export function getContentDetail(id) {
  64. return http.post('/course/getContentDetail', {
  65. id
  66. });
  67. }
  68. /**
  69. * 开始学习
  70. *
  71. * @returns {Promise}
  72. */
  73. export function startLearn(id) {
  74. return http.post('/course/startLearn', {
  75. id
  76. });
  77. }
  78. /**
  79. * 同步播放状态
  80. *
  81. * @returns {Promise}
  82. */
  83. export function syncPlayState(course_id, content_id, current_time, current_offset, play_time, sync_time) {
  84. return http.post('/course/syncPlayState', {
  85. course_id,
  86. content_id,
  87. current_time,
  88. current_offset,
  89. play_time,
  90. sync_time
  91. });
  92. }
  93. /**
  94. * 获取收藏列表
  95. *
  96. * @returns {Promise}
  97. */
  98. export function getLikeList(page, page_size) {
  99. return http.post('/course/getLikeList', {
  100. page,
  101. page_size
  102. });
  103. }
  104. /**
  105. * 收藏操作
  106. *
  107. * @returns {Promise}
  108. */
  109. export function handleLike(course_id, action) {
  110. return http.post('/course/handleLike', {
  111. course_id,
  112. action
  113. });
  114. }
  115. /**
  116. * 获取我的课程列表
  117. *
  118. * @returns {Promise}
  119. */
  120. export function getMineCourseList(page, page_size) {
  121. return http.post('/course/getMineCourseList', {
  122. page,
  123. page_size
  124. });
  125. }
  126. /**
  127. * 删除我的课程
  128. *
  129. * @returns {Promise}
  130. */
  131. export function mineCourseDelete(course_id) {
  132. return http.post('/course/mineCourseDelete', {
  133. course_id
  134. });
  135. }
  136. /**
  137. * 获取评价列表
  138. *
  139. * @returns {Promise}
  140. */
  141. export function getEvaluateList(teacher_id, page, page_size) {
  142. return http.post('/teacher/getEvaluateList', {
  143. teacher_id,
  144. page,
  145. page_size
  146. }, {
  147. muteLogin: true
  148. })
  149. }