hbsmUniapp/src/api/home.ts

50 lines
964 B
TypeScript
Raw Normal View History

2025-08-19 23:31:48 +08:00
import type { PageParams, PageResult } from '@/types/global'
import type { bannerItem, goodsListItem, hotRecommendItem, noticeBarItem } from '@/types/home'
import { request } from '@/utils/request'
/**
*
* @returns
*/
export const getBannerApi = (type: number = 1) => {
return request<bannerItem[]>({
method: 'GET',
2025-08-27 20:45:34 +08:00
url: 'shop/advert/banner',
2025-08-19 23:31:48 +08:00
data: {
type,
},
})
}
/**
*
* @param data
* @returns
*/
export const getGoodsListApi = (data?: PageParams) => {
return request<PageResult<goodsListItem>>({
method: 'GET',
2025-08-27 20:45:34 +08:00
url: 'shop/goods',
2025-08-19 23:31:48 +08:00
data,
})
}
/**
*
* @param id
* @returns
*/
export const getNoticeBartApi = () => {
return request<noticeBarItem[]>({
method: 'GET',
2025-08-27 20:45:34 +08:00
url: 'shop/advert/noticeBar',
2025-08-19 23:31:48 +08:00
})
}
export const getHotRecommendApi = () => {
return request<hotRecommendItem[]>({
method: 'GET',
2025-08-27 20:45:34 +08:00
url: 'shop/advert/hotRecommend',
2025-08-19 23:31:48 +08:00
})
}