webVideo.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import request from '@/utils/request'
  2. // 视频课程相关接口
  3. // 查询视频大类
  4. export function videoType() {
  5. return request({
  6. url: '/front/videoCourse/subjects',
  7. method: 'get',
  8. })
  9. }
  10. // 查询科目
  11. export function videoSubjects(query) {
  12. return request({
  13. url: '/front/videoCourse/courses',
  14. method: 'get',
  15. params: query
  16. })
  17. }
  18. // 查询年级
  19. export function videoGrades(query) {
  20. return request({
  21. url: '/front/videoCourse/grades',
  22. method: 'get',
  23. params: query
  24. })
  25. }
  26. // 查询版本
  27. export function videoVersions(query) {
  28. return request({
  29. url: '/front/videoCourse/versions',
  30. method: 'get',
  31. params: query
  32. })
  33. }
  34. // 视频包列表
  35. export function packList(query) {
  36. return request({
  37. url: '/front/videoCourse/pack/list',
  38. method: 'get',
  39. params: query
  40. })
  41. }
  42. // 视频列表
  43. export function videoList(query) {
  44. return request({
  45. url: '/front/videoCourse/video/list',
  46. method: 'get',
  47. params: query
  48. })
  49. }
  50. // 章节树
  51. export function getChapterTreeList(query) {
  52. return request({
  53. url: '/common/chapter/getChapterTreeList',
  54. method: 'get',
  55. params: query
  56. })
  57. }
  58. // 视频详情
  59. export function videoInfo(query) {
  60. return request({
  61. url: '/front/videoCourse/video/info/tree',
  62. method: 'get',
  63. params: query
  64. })
  65. }
  66. // 视频点播
  67. export function getVideoPlayAuth(query) {
  68. return request({
  69. url: '/common/vod/getVideoPlayAuth',
  70. method: 'get',
  71. params: query
  72. })
  73. }
  74. // /common/vod/getVideoPlayInfo
  75. export function getVideoPlayInfo(videoId) {
  76. return request({
  77. url: '/common/vod/getVideoPlayInfo',
  78. method: 'get',
  79. params: {
  80. videoId
  81. }
  82. })
  83. }
  84. // /prod-api/front/videoCourse/saveWatchRecord
  85. export function saveWatchRecord(sectionId, duration, percent, aliType) {
  86. if (aliType == 'undefined' || typeof aliType == 'undefined') aliType = '' // 容错处理
  87. return request({
  88. url: '/front/videoCourse/saveWatchRecord',
  89. method: 'post',
  90. params: {
  91. sectionId,
  92. duration: Math.floor(duration),
  93. percent: percent.toFixed(3),
  94. type: aliType
  95. }
  96. })
  97. }