index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import request from '@/utils/request'
  2. class ShortVideoApi {
  3. /** 查询短视频列表 */
  4. getList(query) {
  5. return request({
  6. url: 'pc/teachingDsp/dsp/list',
  7. method: 'get',
  8. params: {
  9. status: 0,
  10. ...query,
  11. },
  12. })
  13. }
  14. /** 查询短视频详情 */
  15. getVideoInfo(Id) {
  16. return request({
  17. url: 'pc/teachingDsp/dsp/' + Id,
  18. method: 'get',
  19. })
  20. }
  21. /** 新增短视频 */
  22. addVideo(data) {
  23. return request({
  24. url: 'pc/teachingDsp/dsp',
  25. method: 'post',
  26. data: data,
  27. })
  28. }
  29. /** 修改短视频信息 */
  30. updateVideo(data) {
  31. return request({
  32. url: 'pc/teachingDsp/dsp',
  33. method: 'put',
  34. data: data,
  35. })
  36. }
  37. /** 删除短视频 */
  38. delVideo(ids) {
  39. return request({
  40. url: 'pc/teachingDsp/dsp/' + ids,
  41. method: 'put',
  42. })
  43. }
  44. /** 上传视频封面 */
  45. uploadCover(data, fn) {
  46. return request({
  47. url: 'pc/teachingDsp/dsp/coverUp',
  48. method: 'put',
  49. headers: {
  50. 'content-type': 'multipart/form-data',
  51. },
  52. data,
  53. onUploadProgress: fn,
  54. timeout: 0,
  55. })
  56. }
  57. /** 修改上架状态 */
  58. changeUserStatus(id, shelfStatus) {
  59. if (shelfStatus != 0) {
  60. return request({
  61. url: 'pc/teachingDsp/dsp/offShelf/' + id,
  62. method: 'put',
  63. })
  64. } else {
  65. return request({
  66. url: 'pc/teachingDsp/dsp/putShelf/' + id,
  67. method: 'put',
  68. })
  69. }
  70. }
  71. /**下架短视频 */
  72. offShelf(ids) {
  73. return request({
  74. url: 'pc/teachingDsp/dsp/offShelf/' + ids,
  75. method: 'put',
  76. })
  77. }
  78. /**上架短视频 */
  79. putShelf(ids) {
  80. return request({
  81. url: 'pc/teachingDsp/dsp/putShelf/' + ids,
  82. method: 'put',
  83. })
  84. }
  85. }
  86. export default new ShortVideoApi()