From 5c4e39121f10591c1e406e85e16bbcddb65649df Mon Sep 17 00:00:00 2001 From: xiaoguang Date: Thu, 12 May 2022 21:02:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=96=B0=E5=93=81=E4=B8=8A=E6=9E=B6=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 36 +++-- pages/index/module/Pick.vue | 293 +++++++++++++++++++++++++++++------- 2 files changed, 260 insertions(+), 69 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 4ce5936..9eec998 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -16,7 +16,7 @@ :current="currentTime" @refresh="handleSeckillRefresh" /> - + @@ -27,11 +27,15 @@ import { ApiGetCurrentTime, ApiGetSeckillGoods, } from "@/plugins/api/seckill"; -import { ApiGetRecommendedGoodsList } from "@/plugins/api/goods"; +import { + ApiGetRecommendedGoodsList, + ApiGetGoodsList, +} from "@/plugins/api/goods"; import Banner from "./module/Banner.vue"; import Seckil from "./module/Seckill.vue"; import Pick from "./module/Pick.vue"; -const PICK_COUNT_MIN = 3; // 甄选推荐最小商品数 +const SECKILL_COUNT = 20; // 秒杀商品数 +const NEW_COUNT = 5; // 新品上架商品数 export default { components: { Banner, Seckil, Pick }, @@ -43,7 +47,7 @@ export default { if (seckillData.activityTimeVO) { const { result } = await ApiGetSeckillGoods({ pageIndex: 1, - length: 20, + length: SECKILL_COUNT, activityTimeId: seckillData.activityTimeVO.id, }); if (result) { @@ -53,17 +57,25 @@ export default { // 获取服务器当前时间 const { result: currentTime } = await ApiGetCurrentTime(); - const { result: pickData } = await ApiGetRecommendedGoodsList(); + // 获取甄选商品 + const { result: recommendData } = await ApiGetRecommendedGoodsList(); + + // 获取新品上架商品 + let newData = []; + const { result: newDataResult } = await ApiGetGoodsList({ + pageIndex: 1, + length: NEW_COUNT, + }); + if (newDataResult) { + newData = newDataResult.records || []; + } + return { currentTime, - seckillData: seckillData || { activityTimeVO: null }, + newData, sekillGoodsList, - pickData: pickData || [], - }; - }, - data() { - return { - PICK_COUNT_MIN, + seckillData: seckillData || { activityTimeVO: null }, + recommendData: recommendData || [], }; }, methods: { diff --git a/pages/index/module/Pick.vue b/pages/index/module/Pick.vue index d8a8454..3ffd689 100644 --- a/pages/index/module/Pick.vue +++ b/pages/index/module/Pick.vue @@ -1,52 +1,71 @@