courseDetails.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import APIConfig from './api.js';
  2. // import efunRequest from '../utils/efunRequest'
  3. import request from '../utils/request'
  4. export default class CourseDetails {
  5. // 获取课程详细信息
  6. static getCourseDetails(courseId) {
  7. // return efunRequest.getHttpRequest().url(`http://ott80testlibrary.yifangjiaoyu.cn/mobile/course/${courseId}`).get();
  8. return request(`http://ott80testlibrary.yifangjiaoyu.cn/mobile/course/${courseId}`, {
  9. method: 'get'
  10. })
  11. }
  12. // 获取评论列表
  13. static getPostsList(columnId) {
  14. console.log(columnId)
  15. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts?columnId=${columnId}`, {
  16. method: "get",
  17. })
  18. // return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts?columnId=${columnId}`,{
  19. // method:"GET",
  20. // headers:{
  21. // "Accept": "application/json",
  22. // "Content-Type": "application/json",
  23. // "uid": "c2e13090a563447c8744a8c03171d1db"
  24. // }
  25. // })
  26. // .then((response)=>response.json())
  27. }
  28. // 收藏
  29. static setFavorites(data) {
  30. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites`, {
  31. method:"post",
  32. body: data,
  33. })
  34. // return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites`,{
  35. // method:"POST",
  36. // headers:{
  37. // "Accept": "application/json",
  38. // "Content-Type": "application/json",
  39. // "uid": "c2e13090a563447c8744a8c03171d1db"
  40. // },
  41. // body: JSON.stringify(data),
  42. // })
  43. // .then((response)=>response.json())
  44. }
  45. // 获取是否收藏
  46. static getisFavorites(data) {
  47. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites/isFavorites`, {
  48. method:"post",
  49. body: data,
  50. })
  51. // return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites/isFavorites`,{
  52. // method:"POST",
  53. // headers:{
  54. // "Accept": "application/json",
  55. // "Content-Type": "application/json",
  56. // "uid": "c2e13090a563447c8744a8c03171d1db"
  57. // },
  58. // body: JSON.stringify(data),
  59. // })
  60. // .then((response)=>response.json())
  61. }
  62. // 写评论
  63. static addCommentList(data) {
  64. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts`, {
  65. method:"post",
  66. body: data,
  67. })
  68. // return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts`,{
  69. // method:"POST",
  70. // headers:{
  71. // "Accept": "application/json",
  72. // "Content-Type": "application/json",
  73. // "uid": "c2e13090a563447c8744a8c03171d1db"
  74. // },
  75. // body: JSON.stringify(data),
  76. // })
  77. // .then((response)=>response.json())
  78. }
  79. // 输入回复
  80. static addReplyList(data) {
  81. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts/reply`, {
  82. method:"post",
  83. body: data,
  84. })
  85. // return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts/reply`,{
  86. // method:"POST",
  87. // headers:{
  88. // "Accept": "application/json",
  89. // "Content-Type": "application/json",
  90. // "uid": "c2e13090a563447c8744a8c03171d1db"
  91. // },
  92. // body: JSON.stringify(data),
  93. // })
  94. // .then((response)=>response.json())
  95. }
  96. static playLog(data) {
  97. return request(`http://ott80test-base.yifangjiaoyu.cn/mobile/playLog`, {
  98. method:"post",
  99. body: data,
  100. })
  101. }
  102. }