50 lines
948 B
TypeScript
50 lines
948 B
TypeScript
![]() |
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',
|
||
|
url: '/advert/banner',
|
||
|
data: {
|
||
|
type,
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取商品列表
|
||
|
* @param data
|
||
|
* @returns
|
||
|
*/
|
||
|
export const getGoodsListApi = (data?: PageParams) => {
|
||
|
return request<PageResult<goodsListItem>>({
|
||
|
method: 'GET',
|
||
|
url: '/goods',
|
||
|
data,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取通告栏
|
||
|
* @param id
|
||
|
* @returns
|
||
|
*/
|
||
|
export const getNoticeBartApi = () => {
|
||
|
return request<noticeBarItem[]>({
|
||
|
method: 'GET',
|
||
|
url: '/advert/noticeBar',
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export const getHotRecommendApi = () => {
|
||
|
return request<hotRecommendItem[]>({
|
||
|
method: 'GET',
|
||
|
url: '/advert/hotRecommend',
|
||
|
})
|
||
|
}
|