home.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { http, Method } from "@/utils/request.js";
  2. /**
  3. * 获取广告图
  4. */
  5. export function getAdvertisement() {
  6. return http.request({
  7. url: "/advertisement",
  8. method: Method.GET,
  9. });
  10. }
  11. /**
  12. * 获取首页商品分类
  13. * @param parent_id
  14. */
  15. export function getCategory(parent_id = 0) {
  16. return http.request({
  17. url: `goods/categories/${parent_id}/children`,
  18. method: Method.GET,
  19. loading: false,
  20. });
  21. }
  22. /**
  23. * 获取热门关键词
  24. * @param num
  25. */
  26. export function getHotKeywords(start = 0, end = 10) {
  27. return http.request({
  28. url: "/goods/hot-words",
  29. method: Method.GET,
  30. loading: false,
  31. params: { start, end },
  32. });
  33. }
  34. /**
  35. * 获取楼层数据
  36. * @param client_type
  37. * @param page_type
  38. */
  39. export function getFloorData() {
  40. return http.request({
  41. url: `/pageData/getIndex?clientType=H5`,
  42. method: "get",
  43. });
  44. }
  45. /**
  46. * 获取获取首页分类数据
  47. */
  48. export function getCategoryIndexData(parentId = 0) {
  49. return http.request({
  50. url: `/category/get/${parentId}`,
  51. method: "get",
  52. });
  53. }