活动专区
This commit is contained in:
+24
-12
@@ -10,33 +10,34 @@ export interface ApiImage {
|
||||
id: number
|
||||
}
|
||||
|
||||
/** 轮播图项 */
|
||||
export interface CarouselItem {
|
||||
/** 首页可点击链接项(轮播图 / 宫格导航共用) */
|
||||
export interface HomeLinkItem {
|
||||
id: number
|
||||
title: string
|
||||
image: ApiImage
|
||||
link: string
|
||||
status: number // 0: 启用
|
||||
sort: number
|
||||
link_type: number // 0: 跳转 link 链接; 1: 跳转分类页
|
||||
category_id: number // link_type = 1 时携带的分类 ID
|
||||
}
|
||||
|
||||
/** 宫格导航项 */
|
||||
export interface GridNavItem {
|
||||
id: number
|
||||
title: string
|
||||
image: ApiImage
|
||||
link: string
|
||||
status: number // 0: 启用
|
||||
sort: number
|
||||
/** 首页活动项(结构与 HomeLinkItem 相同,额外多一个描述字段) */
|
||||
export interface HomeActivityItem extends HomeLinkItem {
|
||||
description: string
|
||||
}
|
||||
|
||||
/** 首页数据 */
|
||||
export interface HomeData {
|
||||
carousel: CarouselItem[]
|
||||
gridNav: GridNavItem[]
|
||||
carousel: HomeLinkItem[]
|
||||
gridNav: HomeLinkItem[]
|
||||
activity: HomeActivityItem[]
|
||||
site_title: string
|
||||
}
|
||||
|
||||
/** 分类链接项(结构与 HomeLinkItem 相同,但不含 link_type / category_id,均为纯链接) */
|
||||
export type CategoryLinkItem = Omit<HomeLinkItem, 'link_type' | 'category_id'>
|
||||
|
||||
// ==================== API ====================
|
||||
|
||||
/**
|
||||
@@ -48,3 +49,14 @@ export async function getHomeData(): Promise<ResponseStructure<HomeData>> {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定分类下的链接列表(无需登录)
|
||||
* @param categoryId - 分类 ID
|
||||
*/
|
||||
export async function getCategoryLinks(categoryId: number): Promise<ResponseStructure<CategoryLinkItem[]>> {
|
||||
return createRequest<CategoryLinkItem[]>({
|
||||
url: `/api/category/${categoryId}`,
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user