From fa710b560d9a146c49bfc5f24dff7df3d6373c8c Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 5 Nov 2023 20:42:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?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=9B=BE=E7=89=87=E5=B1=95=E7=A4=BA=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/ImageBar/config.ts | 27 +++++++++++++++ .../components/mobile/ImageBar/index.vue | 24 +++++++++++++ .../components/mobile/ImageBar/property.vue | 34 +++++++++++++++++++ src/components/DiyEditor/util.ts | 33 ++++++++++++++++++ .../mall/promotion/diy/page/decorate.vue | 28 ++------------- .../mall/promotion/diy/template/decorate.vue | 27 ++------------- 6 files changed, 122 insertions(+), 51 deletions(-) create mode 100644 src/components/DiyEditor/components/mobile/ImageBar/config.ts create mode 100644 src/components/DiyEditor/components/mobile/ImageBar/index.vue create mode 100644 src/components/DiyEditor/components/mobile/ImageBar/property.vue diff --git a/src/components/DiyEditor/components/mobile/ImageBar/config.ts b/src/components/DiyEditor/components/mobile/ImageBar/config.ts new file mode 100644 index 00000000..68edf728 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ImageBar/config.ts @@ -0,0 +1,27 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' + +/** 图片展示属性 */ +export interface ImageBarProperty { + // 图片链接 + imgUrl: string + // 跳转链接 + url: string + // 组件样式 + style: ComponentStyle +} + +// 定义组件 +export const component = { + id: 'ImageBar', + name: '图片展示', + icon: 'ep:picture', + property: { + imgUrl: '', + url: '', + style: { + bgType: 'color', + bgColor: '#fff', + marginBottom: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/ImageBar/index.vue b/src/components/DiyEditor/components/mobile/ImageBar/index.vue new file mode 100644 index 00000000..6f70c52d --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ImageBar/index.vue @@ -0,0 +1,24 @@ + + + + diff --git a/src/components/DiyEditor/components/mobile/ImageBar/property.vue b/src/components/DiyEditor/components/mobile/ImageBar/property.vue new file mode 100644 index 00000000..58af1bc8 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ImageBar/property.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/src/components/DiyEditor/util.ts b/src/components/DiyEditor/util.ts index f3461007..0f246ac1 100644 --- a/src/components/DiyEditor/util.ts +++ b/src/components/DiyEditor/util.ts @@ -3,16 +3,25 @@ import { PageConfigProperty } from '@/components/DiyEditor/components/mobile/Pag import { NavigationBarProperty } from '@/components/DiyEditor/components/mobile/NavigationBar/config' import { TabBarProperty } from '@/components/DiyEditor/components/mobile/TabBar/config' +// 页面装修组件 export interface DiyComponent { + // 组件唯一标识 id: string + // 组件名称 name: string + // 组件图标 icon: string + // 组件属性 property: T } +// 页面装修组件库 export interface DiyComponentLibrary { + // 组件库名称 name: string + // 是否展开 extended: boolean + // 组件列表 components: string[] } @@ -85,3 +94,27 @@ export function usePropertyForm(modelValue: T, emit: Function): { formData: R return { formData } } + +// 页面组件库 +export const PAGE_LIBS = [ + { + name: '基础组件', + extended: true, + components: [ + 'SearchBar', + 'NoticeBar', + 'GridNavigation', + 'ListNavigation', + 'Divider', + 'TitleBar' + ] + }, + { name: '图文组件', extended: true, components: ['ImageBar', 'Carousel'] }, + { name: '商品组件', extended: true, components: ['ProductCard'] }, + { + name: '会员组件', + extended: true, + components: ['UserCard', 'OrderCard', 'WalletCard', 'CouponCard'] + }, + { name: '营销组件', extended: true, components: ['Combination', 'Seckill', 'Point', 'Coupon'] } +] as DiyComponentLibrary[] diff --git a/src/views/mall/promotion/diy/page/decorate.vue b/src/views/mall/promotion/diy/page/decorate.vue index 54e7206c..c5e90311 100644 --- a/src/views/mall/promotion/diy/page/decorate.vue +++ b/src/views/mall/promotion/diy/page/decorate.vue @@ -3,7 +3,7 @@ v-if="formData && !formLoading" v-model="formData.property" :title="formData.name" - :libs="componentLibs" + :libs="PAGE_LIBS" :show-page-config="true" :show-navigation-bar="true" :show-tab-bar="false" @@ -13,35 +13,11 @@