-
DiyEditor 组件
-
此组件待实现
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
+
+
+
+
+ handleMoveComponent(index, direction)
+ "
+ />
+
+
+
+
+
+
+
+
+
+
+
+ {{ pageConfigComponent.name }}
+
+
+
+
+ {{ component.name }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ selectedComponent?.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
手机扫码预览
+
![qrcode]()
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/util.ts b/apps/web-antd/src/views/mall/promotion/components/diy-editor/util.ts
index b273e8a92..3666a4711 100644
--- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/util.ts
+++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/util.ts
@@ -1,3 +1,7 @@
+import type { NavigationBarProperty } from './components/mobile/navigation-bar/config';
+import type { PageConfigProperty } from './components/mobile/page-config/config';
+import type { TabBarProperty } from './components/mobile/tab-bar/config';
+
// 页面装修组件
export interface DiyComponent
{
// 用于区分同一种组件的不同实例
@@ -62,11 +66,11 @@ export interface ComponentStyle {
// 页面配置
export interface PageConfig {
// 页面属性
- page: any;
+ page: PageConfigProperty;
// 顶部导航栏属性
- navigationBar: any;
+ navigationBar: NavigationBarProperty;
// 底部导航菜单属性
- tabBar?: any;
+ tabBar?: TabBarProperty;
// 页面组件列表
components: PageComponent[];
}
diff --git a/apps/web-antd/src/views/mall/promotion/components/draggable/index.vue b/apps/web-antd/src/views/mall/promotion/components/draggable/index.vue
new file mode 100644
index 000000000..aaca15c97
--- /dev/null
+++ b/apps/web-antd/src/views/mall/promotion/components/draggable/index.vue
@@ -0,0 +1,99 @@
+
+
+
+ 拖动左上角的小圆点可对其排序
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mall/promotion/components/index.ts b/apps/web-antd/src/views/mall/promotion/components/index.ts
index a382904c1..a088806e2 100644
--- a/apps/web-antd/src/views/mall/promotion/components/index.ts
+++ b/apps/web-antd/src/views/mall/promotion/components/index.ts
@@ -1,7 +1,9 @@
+export { default as AppLinkInput } from './app-link-input/index.vue';
+export { default as ColorInput } from './color-input/index.vue';
export { default as DiyEditor } from './diy-editor/index.vue';
export { type DiyComponentLibrary, PAGE_LIBS } from './diy-editor/util';
-export { default as SpuAndSkuList } from './spu-and-sku-list.vue';
-export { default as SpuSkuSelect } from './spu-sku-select.vue';
+export { default as Draggable } from './draggable/index.vue';
+export { default as InputWithColor } from './input-with-color/index.vue';
-export type * from './types';
-// TODO @puhui999:这个要不要也放到 product/spu/components 下?相当于各种商品的 select 能力,统一由 spu 提供组件化能力!
+export { default as MagicCubeEditor } from './magic-cube-editor/index.vue';
+export { default as VerticalButtonGroup } from './vertical-button-group/index.vue';
diff --git a/apps/web-antd/src/views/mall/promotion/components/input-with-color/index.vue b/apps/web-antd/src/views/mall/promotion/components/input-with-color/index.vue
new file mode 100644
index 000000000..2e6336f5f
--- /dev/null
+++ b/apps/web-antd/src/views/mall/promotion/components/input-with-color/index.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/index.vue b/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/index.vue
new file mode 100644
index 000000000..d260ded9c
--- /dev/null
+++ b/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/index.vue
@@ -0,0 +1,302 @@
+
+
+
+
+
+
+
+ |
+
+ |
+
+
+
+
+
+
+
+
+
{{
+ `${hotArea.width}×${hotArea.height}`
+ }}
+
+
+
+
+
diff --git a/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/util.ts b/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/util.ts
new file mode 100644
index 000000000..1ee8fb5a4
--- /dev/null
+++ b/apps/web-antd/src/views/mall/promotion/components/magic-cube-editor/util.ts
@@ -0,0 +1,72 @@
+// 坐标点
+export interface Point {
+ x: number;
+ y: number;
+}
+
+// 矩形
+export interface Rect {
+ // 左上角 X 轴坐标
+ left: number;
+ // 左上角 Y 轴坐标
+ top: number;
+ // 右下角 X 轴坐标
+ right: number;
+ // 右下角 Y 轴坐标
+ bottom: number;
+ // 矩形宽度
+ width: number;
+ // 矩形高度
+ height: number;
+}
+
+/**
+ * 判断两个矩形是否重叠
+ * @param a 矩形 A
+ * @param b 矩形 B
+ */
+export const isOverlap = (a: Rect, b: Rect): boolean => {
+ return (
+ a.left < b.left + b.width &&
+ a.left + a.width > b.left &&
+ a.top < b.top + b.height &&
+ a.height + a.top > b.top
+ );
+};
+/**
+ * 检查坐标点是否在矩形内
+ * @param hotArea 矩形
+ * @param point 坐标
+ */
+export const isContains = (hotArea: Rect, point: Point): boolean => {
+ return (
+ point.x >= hotArea.left &&
+ point.x < hotArea.right &&
+ point.y >= hotArea.top &&
+ point.y < hotArea.bottom
+ );
+};
+
+/**
+ * 在两个坐标点中间,创建一个矩形
+ *
+ * 存在以下情况:
+ * 1. 两个坐标点是同一个位置,只占一个位置的正方形,宽高都为 1
+ * 2. X 轴坐标相同,只占一行的矩形,高度为 1
+ * 3. Y 轴坐标相同,只占一列的矩形,宽度为 1
+ * 4. 多行多列的矩形
+ *
+ * @param a 坐标点一
+ * @param b 坐标点二
+ */
+export const createRect = (a: Point, b: Point): Rect => {
+ // 计算矩形的范围
+ const [left, left2] = [a.x, b.x].sort();
+ const [top, top2] = [a.y, b.y].sort();
+ const right = left2 + 1;
+ const bottom = top2 + 1;
+ const height = bottom - top;
+ const width = right - left;
+
+ return { left, right, top, bottom, height, width };
+};
diff --git a/apps/web-antd/src/views/mall/promotion/components/spu-and-sku-list.vue b/apps/web-antd/src/views/mall/promotion/components/spu-and-sku-list.vue
deleted file mode 100644
index 4c3aacc8a..000000000
--- a/apps/web-antd/src/views/mall/promotion/components/spu-and-sku-list.vue
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/web-antd/src/views/mall/promotion/components/spu-sku-select.vue b/apps/web-antd/src/views/mall/promotion/components/spu-sku-select.vue
deleted file mode 100644
index 8b1ff79d5..000000000
--- a/apps/web-antd/src/views/mall/promotion/components/spu-sku-select.vue
+++ /dev/null
@@ -1,316 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/web-antd/src/views/mall/promotion/components/types.ts b/apps/web-antd/src/views/mall/promotion/components/types.ts
deleted file mode 100644
index ff4ecc96f..000000000
--- a/apps/web-antd/src/views/mall/promotion/components/types.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type { PropertyAndValues } from '#/views/mall/product/spu/form';
-
-/**
- * SPU 属性配置
- * 用于活动商品选择中,关联 SPU 和其属性列表
- */
-export interface SpuProperty {
- spuId: number; // SPU ID
- spuDetail: T; // SPU 详情
- propertyList: PropertyAndValues[]; // 属性列表
-}
diff --git a/apps/web-antd/src/views/mall/promotion/components/vertical-button-group/index.vue b/apps/web-antd/src/views/mall/promotion/components/vertical-button-group/index.vue
new file mode 100644
index 000000000..7af14dbcc
--- /dev/null
+++ b/apps/web-antd/src/views/mall/promotion/components/vertical-button-group/index.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+