From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/components/DiyEditor/util.ts | 125 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 125 insertions(+), 0 deletions(-)
diff --git a/src/components/DiyEditor/util.ts b/src/components/DiyEditor/util.ts
new file mode 100644
index 0000000..b6febb9
--- /dev/null
+++ b/src/components/DiyEditor/util.ts
@@ -0,0 +1,125 @@
+import { PageConfigProperty } from '@/components/DiyEditor/components/mobile/PageConfig/config'
+import { NavigationBarProperty } from '@/components/DiyEditor/components/mobile/NavigationBar/config'
+import { TabBarProperty } from '@/components/DiyEditor/components/mobile/TabBar/config'
+
+// 椤甸潰瑁呬慨缁勪欢
+export interface DiyComponent<T> {
+ // 鐢ㄤ簬鍖哄垎鍚屼竴绉嶇粍浠剁殑涓嶅悓瀹炰緥
+ uid?: number
+ // 缁勪欢鍞竴鏍囪瘑
+ id: string
+ // 缁勪欢鍚嶇О
+ name: string
+ // 缁勪欢鍥炬爣
+ icon: string
+ /*
+ 缁勪欢浣嶇疆锛�
+ top: 鍥哄畾浜庢墜鏈洪《閮紝渚嬪 椤堕儴鐨勫鑸爮
+ bottom: 鍥哄畾浜庢墜鏈哄簳閮紝渚嬪 搴曢儴鐨勮彍鍗曞鑸爮
+ center: 浣嶄簬鎵嬫満涓績锛屾瘡涓粍浠跺崰涓�琛岋紝椤哄簭鍚戜笅鎺掑垪
+ 绌猴細鍚宑enter
+ fixed: 鐢辩粍浠惰嚜宸卞喅瀹氫綅缃紝濡傚脊绐椾綅浜庢墜鏈轰腑蹇冦�佹诞鍔ㄦ寜閽竴鑸綅浜庢墜鏈哄彸涓嬭
+ */
+ position?: 'top' | 'bottom' | 'center' | '' | 'fixed'
+ // 缁勪欢灞炴��
+ property: T
+}
+
+// 椤甸潰瑁呬慨缁勪欢搴�
+export interface DiyComponentLibrary {
+ // 缁勪欢搴撳悕绉�
+ name: string
+ // 鏄惁灞曞紑
+ extended: boolean
+ // 缁勪欢鍒楄〃
+ components: string[]
+}
+
+// 缁勪欢鏍峰紡
+export interface ComponentStyle {
+ // 鑳屾櫙绫诲瀷
+ bgType: 'color' | 'img'
+ // 鑳屾櫙棰滆壊
+ bgColor: string
+ // 鑳屾櫙鍥剧墖
+ bgImg: string
+ // 澶栬竟璺�
+ margin: number
+ marginTop: number
+ marginRight: number
+ marginBottom: number
+ marginLeft: number
+ // 鍐呰竟璺�
+ padding: number
+ paddingTop: number
+ paddingRight: number
+ paddingBottom: number
+ paddingLeft: number
+ // 杈规鍦嗚
+ borderRadius: number
+ borderTopLeftRadius: number
+ borderTopRightRadius: number
+ borderBottomRightRadius: number
+ borderBottomLeftRadius: number
+}
+
+// 椤甸潰閰嶇疆
+export interface PageConfig {
+ // 椤甸潰灞炴��
+ page: PageConfigProperty
+ // 椤堕儴瀵艰埅鏍忓睘鎬�
+ navigationBar: NavigationBarProperty
+ // 搴曢儴瀵艰埅鑿滃崟灞炴��
+ tabBar?: TabBarProperty
+ // 椤甸潰缁勪欢鍒楄〃
+ components: PageComponent[]
+}
+// 椤甸潰缁勪欢锛屽彧淇濈暀缁勪欢ID锛岀粍浠跺睘鎬�
+export interface PageComponent extends Pick<DiyComponent<any>, 'id' | 'property'> {}
+
+// 椤甸潰缁勪欢搴�
+export const PAGE_LIBS = [
+ {
+ name: '鍩虹缁勪欢',
+ extended: true,
+ components: [
+ 'SearchBar',
+ 'NoticeBar',
+ 'MenuSwiper',
+ 'MenuGrid',
+ 'MenuList',
+ 'Popover',
+ 'FloatingActionButton'
+ ]
+ },
+ {
+ name: '鍥炬枃缁勪欢',
+ extended: true,
+ components: [
+ 'ImageBar',
+ 'Carousel',
+ 'TitleBar',
+ 'VideoPlayer',
+ 'Divider',
+ 'MagicCube',
+ 'HotZone'
+ ]
+ },
+ { name: '鍟嗗搧缁勪欢', extended: true, components: ['ProductCard', 'ProductList'] },
+ {
+ name: '鐢ㄦ埛缁勪欢',
+ extended: true,
+ components: ['UserCard', 'UserOrder', 'UserWallet', 'UserCoupon']
+ },
+ {
+ name: '钀ラ攢缁勪欢',
+ extended: true,
+ components: [
+ 'PromotionCombination',
+ 'PromotionSeckill',
+ 'PromotionPoint',
+ 'CouponCard',
+ 'PromotionArticle'
+ ]
+ }
+] as DiyComponentLibrary[]
--
Gitblit v1.8.0