home.js 991 B

1234567891011121314151617181920212223242526272829303132
  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. }