hbsmUniapp/src/api/home.ts

66 lines
1.3 KiB
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) => {
2025-08-19 23:31:48 +08:00
return request<bannerItem[]>({
method: 'GET',
2025-08-27 21:16:28 +08:00
url: '/shop/advert/banner',
2025-08-19 23:31:48 +08:00
data: {
type,
},
})
}
/**
*
* @param data
* @returns
*/
export const getGoodsListApi = (data ?: PageParams) => {
2025-08-19 23:31:48 +08:00
return request<PageResult<goodsListItem>>({
method: 'GET',
2025-08-27 21:16:28 +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 21:16:28 +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 21:16:28 +08:00
url: '/shop/advert/hotRecommend',
2025-08-19 23:31:48 +08:00
})
}
// 移动端-首页接口
export const configIndex = (data : { page : number, page_size : number }) => {
return request({
url: '/api/index/config',
method: 'POST',
data,
})
}
// 移动端-首页接口-搜索接口
export const configSearch = (data:Record<string, any>) => {
return request({
url: '/api/index/search',
method: 'POST',
data,
})
}