courseDetails.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts?columnId=${columnId}`,{
  19. method:"GET",
  20. headers:{
  21. "uid": ""
  22. }
  23. })
  24. .then((response)=>response.json())
  25. }
  26. // 收藏
  27. static setFavorites(data) {
  28. return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites`,{
  29. method:"POST",
  30. headers:{
  31. "Accept": "application/json",
  32. "Content-Type": "application/json",
  33. "uid": ""
  34. },
  35. body: JSON.stringify(data),
  36. })
  37. .then((response)=>response.json())
  38. }
  39. // 获取是否收藏
  40. static getisFavorites(data) {
  41. return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/favorites/isFavorites`,{
  42. method:"POST",
  43. headers:{
  44. "Accept": "application/json",
  45. "Content-Type": "application/json",
  46. "uid": ""
  47. },
  48. body: JSON.stringify(data),
  49. })
  50. .then((response)=>response.json())
  51. }
  52. // 写评论
  53. static addCommentList(data) {
  54. return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts`,{
  55. method:"POST",
  56. headers:{
  57. "Accept": "application/json",
  58. "Content-Type": "application/json",
  59. "uid": ""
  60. },
  61. body: JSON.stringify(data),
  62. })
  63. .then((response)=>response.json())
  64. }
  65. // 输入评论
  66. static addReplyList(data) {
  67. return fetch(`http://ott80test-base.yifangjiaoyu.cn/mobile/posts/reply`,{
  68. method:"POST",
  69. headers:{
  70. "Accept": "application/json",
  71. "Content-Type": "application/json",
  72. "uid": ""
  73. },
  74. body: JSON.stringify(data),
  75. })
  76. .then((response)=>response.json())
  77. }
  78. }