home.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import Request from '../common/request.js';
  2. const request = new Request().http;
  3. /**
  4. * 首页初始化核心数据(频道入口、分类标签、商品分类导航)
  5. */
  6. export function getHomeInit() {
  7. return request('/app/index/home/init', null, 'GET');
  8. }
  9. /**
  10. * 首页推荐区块(直播中、上新推荐等)
  11. */
  12. export function getHomeRecommend() {
  13. return request('/app/index/home/recommend', null, 'GET');
  14. }
  15. /**
  16. * 首页商品列表(支持用户端分类 id,id 为空查全部)
  17. * @param {Object} data - { id, pageNum, pageSize } 其中 id 可选,不传或空为全部
  18. */
  19. export function getHomeGoods(data) {
  20. return request('/app/index/home/goods', data || {}, 'GET');
  21. }
  22. /**
  23. * 首页推荐「更多」分页:绿色有机(green) / 上新推荐(hot)
  24. * @param {Object} data - { type: 'green'|'hot', pageNum, pageSize } 默认第1页10条
  25. */
  26. export function getHomeGoodsRecommend(data) {
  27. return request('/app/index/home/goods/recommend', data || {}, 'GET');
  28. }
  29. /**
  30. * 公域课程二级分类(CourseController.listPublicCourseCategory)
  31. */
  32. export function listPublicCourseCategory(data) {
  33. return request('/course_auto/app/course/publicCourseCategory/list', data || {}, 'GET');
  34. }
  35. /**
  36. * 公域课程列表(CourseController.listPublicCourse)
  37. */
  38. export function listPublicCourse(data) {
  39. return request('/course_auto/app/course/publicCourse/list', data || {}, 'GET');
  40. }