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 @@