courseDetails.js 2.7 KB

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