From 8f538dd197b44dcc1f4517545d4539db9a10242f Mon Sep 17 00:00:00 2001 From: jqtmviyu Date: Wed, 23 Apr 2025 15:37:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 2 +- src/pages/hot/hot.vue | 224 +++++++++++++++++++++++++++++++++++++++++- src/services/hot.ts | 18 ++++ src/types/hot.d.ts | 23 +++++ 4 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 src/services/hot.ts create mode 100644 src/types/hot.d.ts diff --git a/src/pages.json b/src/pages.json index e60fb95..db227d4 100644 --- a/src/pages.json +++ b/src/pages.json @@ -51,7 +51,7 @@ { "path": "pages/hot/hot", "style": { - "navigationBarTitleText": "hot" + "navigationBarTitleText": "热门推荐" } }, { diff --git a/src/pages/hot/hot.vue b/src/pages/hot/hot.vue index 2337a94..1b11058 100644 --- a/src/pages/hot/hot.vue +++ b/src/pages/hot/hot.vue @@ -1,7 +1,225 @@ - + + + diff --git a/src/services/hot.ts b/src/services/hot.ts new file mode 100644 index 0000000..36f44d0 --- /dev/null +++ b/src/services/hot.ts @@ -0,0 +1,18 @@ +import { http } from '@/utils/http' +import type { PageParams, PageResult } from '@/types/global' +import type { HotResult } from '@/types/hot' + +type HotParams = PageParams & { + // 推荐列表 Tab 项的 id, 默认查询全部 Tab 项的第 1 页数据 + subType?: string +} +/** + * 获取热门推荐 + */ +export const getHotRecommend = (url: string, data: HotParams) => { + return http({ + url, + method: 'GET', + data, + }) +} diff --git a/src/types/hot.d.ts b/src/types/hot.d.ts new file mode 100644 index 0000000..0b64de9 --- /dev/null +++ b/src/types/hot.d.ts @@ -0,0 +1,23 @@ +import type { PageResult, GoodsItem } from './global' + +/** 热门推荐-子类选项 */ +export type SubTypeItem = { + /** 子类id */ + id: string + /** 子类标题 */ + title: string + /** 子类对应的商品集合 */ + goodsItems: PageResult +} + +/** 热门推荐 */ +export type HotResult = { + /** id信息 */ + id: string + /** 活动图片 */ + bannerPicture: string + /** 活动标题 */ + title: string + /** 子类选项 */ + subTypes: SubTypeItem[] +}