home.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Request from '../common/request.js';
  2. const request = new Request().http;
  3. /**
  4. * 首页初始化核心数据(频道入口、分类标签、商品分类导航)
  5. */
  6. export function getHomeInit() {
  7. return request('/store/app/index/home/init', null, 'GET');
  8. }
  9. /**
  10. * 首页推荐区块(直播中、上新推荐等)
  11. */
  12. export function getHomeRecommend() {
  13. return request('/store/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('/store/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('/store/app/index/home/goods/recommend', data || {}, 'GET');
  28. }
  29. /* 课程分类分页 */
  30. export function courseTypeDataApi(data) {
  31. return request('/app/course/publicCourseCategory/list', data || {}, 'GET');
  32. }
  33. // 课程列表分页
  34. export function courseListDataApi(data) {
  35. return request('/app/course/publicCourse/list', data || {}, 'GET');
  36. }