From 4271a7a5ddd1d8288a95ea5313d1329bb1fb9e61 Mon Sep 17 00:00:00 2001 From: jqtmviyu Date: Thu, 24 Apr 2025 11:36:39 +0800 Subject: [PATCH] =?UTF-8?q?style:=20:art:=20aPI=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=B7=BB=E5=8A=A0=E5=90=8E=E7=BC=80API,=20?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JbcGuess.vue | 4 ++-- src/pages/hot/hot.vue | 6 +++--- src/pages/index/index.vue | 14 +++++++------- src/services/home.ts | 8 ++++---- src/services/hot.ts | 2 +- src/types/category.d.ts | 27 +++++++++++++++++++++++++++ 6 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 src/types/category.d.ts diff --git a/src/components/JbcGuess.vue b/src/components/JbcGuess.vue index 127769a..3877a74 100644 --- a/src/components/JbcGuess.vue +++ b/src/components/JbcGuess.vue @@ -25,7 +25,7 @@ diff --git a/src/services/home.ts b/src/services/home.ts index 79097bb..2486152 100644 --- a/src/services/home.ts +++ b/src/services/home.ts @@ -7,7 +7,7 @@ import { http } from '@/utils/http' * @param distributionSite - 广告区域展示位置: 1 为首页(默认值); 2 为商品分类页 * @returns 轮播图数据 */ -export const getHomeBanner = (distributionSite = 1) => { +export const getHomeBannerAPI = (distributionSite = 1) => { return http({ url: '/home/banner', method: 'GET', @@ -21,7 +21,7 @@ export const getHomeBanner = (distributionSite = 1) => { * 获取首页分类 * @returns 分类数据 */ -export const getCategory = () => { +export const getCategoryAPI = () => { return http({ url: '/home/category/mutli', method: 'GET', @@ -32,7 +32,7 @@ export const getCategory = () => { * 获取首页热门商品 * @returns 热门商品数据 */ -export const getHomeHot = () => { +export const getHomeHotAPI = () => { return http({ url: '/home/hot/mutli', method: 'GET', @@ -44,7 +44,7 @@ export const getHomeHot = () => { * @param data - 分页参数 * @returns 猜你喜欢数据 */ -export const getGuessLike = (data?: PageParams) => { +export const getGuessLikeAPI = (data?: PageParams) => { return http>({ url: '/home/goods/guessLike', method: 'GET', diff --git a/src/services/hot.ts b/src/services/hot.ts index 36f44d0..1392bed 100644 --- a/src/services/hot.ts +++ b/src/services/hot.ts @@ -9,7 +9,7 @@ type HotParams = PageParams & { /** * 获取热门推荐 */ -export const getHotRecommend = (url: string, data: HotParams) => { +export const getHotRecommendAPI = (url: string, data: HotParams) => { return http({ url, method: 'GET', diff --git a/src/types/category.d.ts b/src/types/category.d.ts new file mode 100644 index 0000000..180f2fc --- /dev/null +++ b/src/types/category.d.ts @@ -0,0 +1,27 @@ +import type { GoodsItem } from './global' + +/** 一级分类项 */ +export type CategoryTopItem = { + /** 二级分类集合[ 二级分类项 ] */ + children: CategoryChildItem[] + /** 一级分类id */ + id: string + /** 一级分类图片集[ 一级分类图片项 ] */ + imageBanners: string[] + /** 一级分类名称 */ + name: string + /** 一级分类图片 */ + picture: string +} + +/** 二级分类项 */ +export type CategoryChildItem = { + /** 商品集合[ 商品项 ] */ + goods: GoodsItem[] + /** 二级分类id */ + id: string + /** 二级分类名称 */ + name: string + /** 二级分类图片 */ + picture: string +}