From b4a177258467e3a08c33524e50c80b46eaca5215 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 17 Nov 2023 10:14:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6=E3=80=90?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=8D=A1=E7=89=87=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/MagicCube/config.ts | 2 +- .../components/mobile/ProductCard/config.ts | 97 ++++++++++ .../components/mobile/ProductCard/index.vue | 165 ++++++++++++++++++ .../mobile/ProductCard/property.vue | 149 ++++++++++++++++ .../product/spu/components/SpuShowcase.vue | 126 +++++++++++++ 5 files changed, 538 insertions(+), 1 deletion(-) create mode 100644 src/components/DiyEditor/components/mobile/ProductCard/config.ts create mode 100644 src/components/DiyEditor/components/mobile/ProductCard/index.vue create mode 100644 src/components/DiyEditor/components/mobile/ProductCard/property.vue create mode 100644 src/views/mall/product/spu/components/SpuShowcase.vue diff --git a/src/components/DiyEditor/components/mobile/MagicCube/config.ts b/src/components/DiyEditor/components/mobile/MagicCube/config.ts index ce5d21a3..bd3120bb 100644 --- a/src/components/DiyEditor/components/mobile/MagicCube/config.ts +++ b/src/components/DiyEditor/components/mobile/MagicCube/config.ts @@ -33,7 +33,7 @@ export interface MagicCubeItemProperty { export const component = { id: 'MagicCube', name: '广告魔方', - icon: 'fluent:puzzle-cube-piece-20-filled', + icon: 'bi:columns', property: { borderRadiusTop: 0, borderRadiusBottom: 0, diff --git a/src/components/DiyEditor/components/mobile/ProductCard/config.ts b/src/components/DiyEditor/components/mobile/ProductCard/config.ts new file mode 100644 index 00000000..49dd30d0 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductCard/config.ts @@ -0,0 +1,97 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' + +/** 商品卡片属性 */ +export interface ProductCardProperty { + // 布局类型:单列大图 | 单列小图 | 双列 + layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol' + // 商品字段 + fields: { + // 商品名称 + name: ProductCardFieldProperty + // 商品简介 + introduction: ProductCardFieldProperty + // 商品价格 + price: ProductCardFieldProperty + // 商品市场价 + marketPrice: ProductCardFieldProperty + // 商品销量 + salesCount: ProductCardFieldProperty + // 商品库存 + stock: ProductCardFieldProperty + } + // 角标 + badge: { + // 是否显示 + show: boolean + // 角标图片 + imgUrl: string + } + // 按钮 + btnBuy: { + // 类型:文字 | 图片 + type: 'text' | 'img' + // 文字 + text: string + // 文字按钮:背景渐变起始颜色 + bgBeginColor: string + // 文字按钮:背景渐变结束颜色 + bgEndColor: string + // 图片按钮:图片地址 + imgUrl: string + } + // 上圆角 + borderRadiusTop: number + // 下圆角 + borderRadiusBottom: number + // 间距 + space: number + // 商品编号列表 + spuIds: number[] + // 组件样式 + style: ComponentStyle +} +// 商品字段 +export interface ProductCardFieldProperty { + // 是否显示 + show: boolean + // 颜色 + color: string +} + +// 定义组件 +export const component = { + id: 'ProductCard', + name: '商品卡片', + icon: 'system-uicons:carousel', + property: { + layoutType: 'oneColBigImg', + fields: { + name: { show: true, color: '#000' }, + introduction: { show: true, color: '#999' }, + price: { show: true, color: '#ff3000' }, + marketPrice: { show: true, color: '#c4c4c4' }, + salesCount: { show: true, color: '#c4c4c4' }, + stock: { show: false, color: '#c4c4c4' } + }, + badge: { show: false, imgUrl: '' }, + btnBuy: { + type: 'text', + text: '立即购买', + // todo: @owen 根据主题色配置 + bgBeginColor: '#FF6000', + bgEndColor: '#FE832A', + imgUrl: '' + }, + borderRadiusTop: 8, + borderRadiusBottom: 8, + space: 8, + spuIds: [], + style: { + bgType: 'color', + bgColor: '', + marginLeft: 8, + marginRight: 8, + marginBottom: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/ProductCard/index.vue b/src/components/DiyEditor/components/mobile/ProductCard/index.vue new file mode 100644 index 00000000..a6894ed9 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductCard/index.vue @@ -0,0 +1,165 @@ + + + + diff --git a/src/components/DiyEditor/components/mobile/ProductCard/property.vue b/src/components/DiyEditor/components/mobile/ProductCard/property.vue new file mode 100644 index 00000000..cfa5008b --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductCard/property.vue @@ -0,0 +1,149 @@ + + + + + diff --git a/src/views/mall/product/spu/components/SpuShowcase.vue b/src/views/mall/product/spu/components/SpuShowcase.vue new file mode 100644 index 00000000..a3f16fba --- /dev/null +++ b/src/views/mall/product/spu/components/SpuShowcase.vue @@ -0,0 +1,126 @@ + + + +