From 7f4f95a90a7fe930996d24f846db13e2ede1ee39 Mon Sep 17 00:00:00 2001
From: liruiqiang <3151805288@qq.com>
Date: Thu, 14 Aug 2025 14:35:22 +0800
Subject: [PATCH] =?UTF-8?q?=E7=8C=9C=E4=BD=A0=E5=96=9C=E6=AC=A2=E5=B8=83?=
=?UTF-8?q?=E5=B1=80=E4=B8=8E=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/XtxGuess.vue | 119 ++++++++++++++++++++++++++++++++++++++++++++
src/pages/index/index.vue | 38 ++++++++++----
src/services/home.ts | 14 +++++-
src/types/component.d.ts | 1 +
src/types/global.d.ts | 13 +++++
src/types/home.d.ts | 18 +++++++
6 files changed, 192 insertions(+), 11 deletions(-)
create mode 100644 src/components/XtxGuess.vue
create mode 100644 src/types/global.d.ts
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
+}