diff --git a/src/pages.json b/src/pages.json
index 91d3477..dadf4cb 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -44,6 +44,13 @@
"style": {
"navigationBarTitleText": "登录"
}
+ },
+ {
+ "path" : "pages/hot/hot",
+ "style" :
+ {
+ "navigationBarTitleText" : "热门推荐"
+ }
}
],
"globalStyle": {
diff --git a/src/pages/hot/hot.vue b/src/pages/hot/hot.vue
new file mode 100644
index 0000000..3eb3df5
--- /dev/null
+++ b/src/pages/hot/hot.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+ ¥
+ {{ goods.price }}
+
+
+
+ 正在加载...
+
+
+
+
+
+
+
diff --git a/src/services/hot.ts b/src/services/hot.ts
new file mode 100644
index 0000000..2bd1d18
--- /dev/null
+++ b/src/services/hot.ts
@@ -0,0 +1,20 @@
+import { http } from '@/utils/http'
+import type { PageParams } from '@/types/global'
+import type { HotResult } from '@/types/hot'
+
+type HotParams = PageParams & {
+ /** Tab 项的 id,默认查询全部 Tab 项的第 1 页数据 */
+ subType?: string
+}
+/**
+ * 通用热门推荐类型
+ * @param url 请求地址
+ * @param data 请求参数
+ */
+export const getHotRecommendAPI = (url: string, data?: HotParams) => {
+ return http({
+ method: 'GET',
+ url,
+ data,
+ })
+}
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
index 7c2136f..468846d 100644
--- a/src/types/global.d.ts
+++ b/src/types/global.d.ts
@@ -19,3 +19,21 @@ export type PageParams = {
/** 页大小:默认值为 10 */
pageSize?: number
}
+
+/** 通用商品类型 */
+export type GoodsItem = {
+ /** 商品描述 */
+ desc: string
+ /** 商品折扣 */
+ discount: number
+ /** id */
+ id: string
+ /** 商品名称 */
+ name: string
+ /** 商品已下单数量 */
+ orderNum: number
+ /** 商品图片 */
+ picture: string
+ /** 商品价格 */
+ price: number
+}
diff --git a/src/types/home.d.ts b/src/types/home.d.ts
index 31b44c1..cba9b88 100644
--- a/src/types/home.d.ts
+++ b/src/types/home.d.ts
@@ -1,3 +1,5 @@
+import type { GoodsItem } from '@/types/global'
+
/** 首页-广告区域数据类型 */
export type BannerItem = {
/** 跳转链接 */
@@ -37,19 +39,5 @@ export type HotItem = {
}
/** 猜你喜欢-商品类型 */
-export type GuessItem = {
- /** 商品描述 */
- desc: string
- /** 商品折扣 */
- discount: number
- /** id */
- id: string
- /** 商品名称 */
- name: string
- /** 商品已下单数量 */
- orderNum: number
- /** 商品图片 */
- picture: string
- /** 商品价格 */
- price: number
-}
+// GuessItem 和 GoodsItem 类型相同
+export type GuessItem = GoodsItem
diff --git a/src/types/hot.d.ts b/src/types/hot.d.ts
new file mode 100644
index 0000000..0d20b9d
--- /dev/null
+++ b/src/types/hot.d.ts
@@ -0,0 +1,23 @@
+import type { PageResult, GoodsItem } from './global'
+
+/** 热门推荐 */
+export type HotResult = {
+ /** id信息 */
+ id: string
+ /** 活动图片 */
+ bannerPicture: string
+ /** 活动标题 */
+ title: string
+ /** 子类选项 */
+ subTypes: SubTypeItem[]
+}
+
+/** 热门推荐-子类选项 */
+export type SubTypeItem = {
+ /** 子类id */
+ id: string
+ /** 子类标题 */
+ title: string
+ /** 子类对应的商品集合 */
+ goodsItems: PageResult
+}