diff --git a/src/components/XtxGuess.vue b/src/components/XtxGuess.vue
new file mode 100644
index 0000000..d04cfc9
--- /dev/null
+++ b/src/components/XtxGuess.vue
@@ -0,0 +1,119 @@
+
+
+
+ 猜你喜欢
+
+
+
+
+ {{ item.name }}
+
+ ¥
+ {{ item.price }}
+
+
+
+ 正在加载...
+
+
+
+
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index ae3f83d..f46d4d0 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -1,14 +1,18 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -16,7 +20,6 @@
import CustomNavbar from './components/CustomNavbar.vue'
import CategoryPanel from './components/CategoryPanel.vue'
import HotPanel from './components/HotPanel.vue'
-import XtxSwiper from '../../components/XtxSwiper.vue'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getHomeBannerAPI, getHomeCategoryAPI, getHomeHotAPI } from '@/services/home'
@@ -55,5 +58,20 @@ onLoad(async () => {
diff --git a/src/services/home.ts b/src/services/home.ts
index 1e04d55..5ed7151 100644
--- a/src/services/home.ts
+++ b/src/services/home.ts
@@ -1,6 +1,7 @@
// 请求封装调用
import { http } from '@/utils/http'
-import type { BannerItem, CategoryItem, HotItem } from '@/types/home'
+import type { BannerItem, CategoryItem, HotItem, GuessItem } from '@/types/home'
+import type { PageParams, PageResult } from '@/types/global'
/**
* 首页-广告区域-小程序
* @param distributionSite 广告区域展示位置(投放位置 投放位置,1为首页,2为分类商品页) 默认是1
@@ -34,3 +35,14 @@ export const getHomeHotAPI = () => {
url: '/home/hot/mutli',
})
}
+
+/**
+ * 猜你喜欢-小程序
+ */
+export const getHomeGoodsGuessLikeAPI = (data?: PageParams) => {
+ return http>({
+ method: 'GET',
+ url: '/home/goods/guessLike',
+ data,
+ })
+}
diff --git a/src/types/component.d.ts b/src/types/component.d.ts
index af2d7f9..a8c97d9 100644
--- a/src/types/component.d.ts
+++ b/src/types/component.d.ts
@@ -7,5 +7,6 @@ import 'vue'
declare module 'vue' {
export interface GlobalComponents {
XtxSwiper: typeof XtxSwiper
+ XtxGuess: typeof XtxGuess
}
}
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
new file mode 100644
index 0000000..adbc8e5
--- /dev/null
+++ b/src/types/global.d.ts
@@ -0,0 +1,13 @@
+/** 通用分页结果类型 */
+export type PageResult = {
+ /** 列表数据 */
+ items: T[]
+ /** 总条数 */
+ counts: number
+ /** 当前页数 */
+ page: number
+ /** 总页数 */
+ pages: number
+ /** 每页条数 */
+ pageSize: number
+}
diff --git a/src/types/home.d.ts b/src/types/home.d.ts
index a4e9753..31b44c1 100644
--- a/src/types/home.d.ts
+++ b/src/types/home.d.ts
@@ -35,3 +35,21 @@ export type HotItem = {
/** 推荐类型 */
type: string
}
+
+/** 猜你喜欢-商品类型 */
+export type GuessItem = {
+ /** 商品描述 */
+ desc: string
+ /** 商品折扣 */
+ discount: number
+ /** id */
+ id: string
+ /** 商品名称 */
+ name: string
+ /** 商品已下单数量 */
+ orderNum: number
+ /** 商品图片 */
+ picture: string
+ /** 商品价格 */
+ price: number
+}