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
|
|
|
})
|
|
|
|
}
|