From af6a02245051d29bb4d57ddf4db92f5acf41f4d8 Mon Sep 17 00:00:00 2001 From: luowenfeng <1092164058@qq.com> Date: Wed, 27 Jul 2022 16:04:53 +0800 Subject: [PATCH] =?UTF-8?q?feature(uniapp=E5=95=86=E5=93=81):=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/spu/AppProductSpuController.java | 12 ++++++++-- .../controller/app/spu/vo/AppSpuRespVO.java | 22 ++++++++++++++++++ yudao-ui-app/api/product.js | 5 +++- yudao-ui-app/pages/index/index.vue | 6 ++--- yudao-ui-app/pages/product/product.vue | 23 +++++++++++++++---- 5 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java index e56aa3813..1cb07eec5 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java @@ -1,18 +1,19 @@ package cn.iocoder.yudao.module.product.controller.app.spu; +import cn.hutool.core.bean.BeanUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuPageReqVO; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuRespVO; import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO; import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO; +import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuRespVO; import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -34,4 +35,11 @@ public class AppProductSpuController { public CommonResult> getSpuPage(@Valid AppSpuPageReqVO pageVO) { return success(spuService.getSpuPage(pageVO)); } + + @GetMapping("/") + @ApiOperation("获取商品 - 通过商品id") + public CommonResult getSpu(@RequestParam("spuId") Long spuId) { + AppSpuRespVO appSpuRespVO = BeanUtil.toBean(spuService.getSpu(spuId), AppSpuRespVO.class); + return success(appSpuRespVO); + } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java new file mode 100644 index 000000000..7f638a704 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.product.controller.app.spu.vo; + +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuRespVO; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + *

+ * + *

+ * + * @author LuoWenFeng + */ +@ApiModel("App - 商品spu Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class AppSpuRespVO extends SpuRespVO { + + +} diff --git a/yudao-ui-app/api/product.js b/yudao-ui-app/api/product.js index bebd27ca9..5338d5d10 100644 --- a/yudao-ui-app/api/product.js +++ b/yudao-ui-app/api/product.js @@ -2,4 +2,7 @@ const { http } = uni.$u // 查询商品spu列表 -export const productSpuPage = params => http.get('/product/spu/page', { params }) +export const productSpuPage = params => http.get('product/spu/page', { params }) + +// 查询商品 +export const productSpu = params => http.get('product/spu/', { params }) diff --git a/yudao-ui-app/pages/index/index.vue b/yudao-ui-app/pages/index/index.vue index 293710648..52b504e87 100644 --- a/yudao-ui-app/pages/index/index.vue +++ b/yudao-ui-app/pages/index/index.vue @@ -169,8 +169,8 @@ export default { } }, onLoad() { - //this.loadBannerData(); - //this.loadNoticeData(); + this.loadBannerData(); + this.loadNoticeData(); }, methods: { loadBannerData() { @@ -302,7 +302,7 @@ export default { margin: 10rpx; background: #ffffff; border-radius: 10rpx; - box-shadow: -1rpx 1rpx 2rpx #afd3f5, 1rpx 1rpx 0rpx #afd3f5; + box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); .prod-image { width: 224rpx; height: 224rpx; diff --git a/yudao-ui-app/pages/product/product.vue b/yudao-ui-app/pages/product/product.vue index 532bc4fc6..6fbbb8708 100644 --- a/yudao-ui-app/pages/product/product.vue +++ b/yudao-ui-app/pages/product/product.vue @@ -43,7 +43,7 @@ - + {{ product.sku[currentSkuIndex].desc }} @@ -178,6 +178,8 @@