From 965417aab282e3aa1d254207c7c134e66ac685a6 Mon Sep 17 00:00:00 2001
From: sunlizhou <296190577@qq.com>
Date: Thu, 14 Dec 2023 17:33:19 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E9=AD=94=E6=96=B9=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E5=8F=8A=E8=BE=85=E5=8A=A9=E5=8C=BA=E5=9F=9F=EF=BC=8C?=
=?UTF-8?q?=E8=BE=85=E5=8A=A9=E7=BA=BF=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/engineer/components/ConfigCurrentView.vue | 2 +
src/engineer/utils/dynamic.ts | 9 +-
src/modules/activity-cube.ts | 30 ++++++
src/modules/auxiliary-empty.ts | 25 +++++
src/modules/auxiliary-line.ts | 32 +++++++
src/modules/diy-title.ts | 45 +++++++++
src/modules/index.ts | 95 ++++---------------
src/modules/product-column.ts | 53 +++++++++++
8 files changed, 212 insertions(+), 79 deletions(-)
create mode 100644 src/modules/activity-cube.ts
create mode 100644 src/modules/auxiliary-empty.ts
create mode 100644 src/modules/auxiliary-line.ts
create mode 100644 src/modules/diy-title.ts
create mode 100644 src/modules/product-column.ts
diff --git a/src/engineer/components/ConfigCurrentView.vue b/src/engineer/components/ConfigCurrentView.vue
index 4070677..9b1244f 100644
--- a/src/engineer/components/ConfigCurrentView.vue
+++ b/src/engineer/components/ConfigCurrentView.vue
@@ -41,8 +41,10 @@ const label = computed(()=>{
+
+
diff --git a/src/engineer/utils/dynamic.ts b/src/engineer/utils/dynamic.ts
index de00aea..da52974 100644
--- a/src/engineer/utils/dynamic.ts
+++ b/src/engineer/utils/dynamic.ts
@@ -1,9 +1,16 @@
import type { DynamicValue } from "../types"
import type { EngineContext } from "../context"
+const isNumber = (num: number):boolean => {
+ return !isNaN(num)
+}
export function dynamic(ctx: EngineContext, blockId: string, value: DynamicValue): T {
if (typeof value === 'string' && value.startsWith('@@')) {
- return ctx.value(blockId, value) as T
+ const val = ctx.value(blockId,value)
+ if(isNumber(val as number)){
+ return parseFloat(val as string) as T
+ }
+ return ctx.value(blockId, value) as T
}
return value as T
}
diff --git a/src/modules/activity-cube.ts b/src/modules/activity-cube.ts
new file mode 100644
index 0000000..6e1b089
--- /dev/null
+++ b/src/modules/activity-cube.ts
@@ -0,0 +1,30 @@
+import type { Module } from '../engineer'
+import { createUniqueId } from '../engineer/utils'
+const module: Module = {
+ vid: createUniqueId(),
+ mid: createUniqueId(),
+ title: '活动魔方',
+ configs: [],
+ init:{
+ theme:{
+ color: '#fff',
+ innerColor: 'pink'
+ }
+ },
+ theme:{
+ color: '@@theme.color',
+ padding: 5,
+ radius: '@@theme.radius'
+ },
+ children: {
+ theme:{
+ color: '@@theme.innerColor',
+ radius: '@@theme.radius',
+ height: 20
+ },
+ children:[]
+ }
+
+
+}
+export default module
diff --git a/src/modules/auxiliary-empty.ts b/src/modules/auxiliary-empty.ts
new file mode 100644
index 0000000..ae561ec
--- /dev/null
+++ b/src/modules/auxiliary-empty.ts
@@ -0,0 +1,25 @@
+import type { Module } from '../engineer'
+import { createUniqueId } from '../engineer/utils'
+
+const module:Module = {
+ mid: createUniqueId(),
+ vid: createUniqueId(),
+ title: '辅助空白',
+ configs:[
+
+ ],
+ init:{
+ theme:{
+ height: 10,
+ color: 'white'
+ }
+ },
+ theme:{
+ height: '@@theme.height',
+ color: '@@theme.color'
+ },
+ children:{
+
+ }
+}
+export default module
diff --git a/src/modules/auxiliary-line.ts b/src/modules/auxiliary-line.ts
new file mode 100644
index 0000000..63add16
--- /dev/null
+++ b/src/modules/auxiliary-line.ts
@@ -0,0 +1,32 @@
+import type { Module } from '../engineer'
+import { createUniqueId } from '../engineer/utils'
+
+const module: Module = {
+ vid: createUniqueId(),
+ mid: createUniqueId(),
+ title: '辅助线',
+ configs: [],
+ init:{
+ theme:{
+ innerColor: '#dedede',
+ height:10,
+ color: 'white'
+ }
+ },
+ theme:{
+ height: '@@theme.height',
+ flexible: true,
+ mainAlign:'center',
+ crossAlign: 'center',
+ textColor: '@@theme.innerColor',
+ color: '@@theme.color'
+ },
+ children:{
+ theme:{
+ width: 345,
+ height: 0.8,
+ color: '@@theme.innerColor'
+ }
+ }
+}
+export default module
diff --git a/src/modules/diy-title.ts b/src/modules/diy-title.ts
new file mode 100644
index 0000000..eb5bc37
--- /dev/null
+++ b/src/modules/diy-title.ts
@@ -0,0 +1,45 @@
+import { createUniqueId } from '../engineer/utils'
+import { Module } from '../engineer'
+
+const module: Module = {
+ title: '自定义标题',
+ vid: createUniqueId(),
+ mid: createUniqueId(),
+ maxReferenceCount: -1,
+ referenceCount: 0,
+ image: undefined,
+ configs: [
+ {
+ type: 'text',
+ field: 'Title',
+ label: '标题',
+ help: '自定义标题', // 自动生成:"请输入${label}"
+ },
+ ],
+ init: {
+ Title: '猜你喜欢',
+ theme:{
+ color: '#fff',
+ textColor: '#333'
+ }
+ },
+ theme: {
+ padding: {
+ vertical: 15,
+ horizontal: 15,
+ },
+ color: '@@theme.color',
+ textColor: '@@theme.textColor',
+ fontSize: 18,
+ fontWeight: 900,
+ },
+ children: {
+ type: 'text',
+ key: 'Title'
+ }
+
+}
+export default module
+
+
+
diff --git a/src/modules/index.ts b/src/modules/index.ts
index 73b9c70..8094f7b 100644
--- a/src/modules/index.ts
+++ b/src/modules/index.ts
@@ -5,6 +5,11 @@ import { createUniqueId } from '../engineer/utils'
import { Category } from '../engineer'
import categoryBar from './category-bar.ts'
import searchCube from './search-cube.ts'
+import productColumn from './product-column.ts'
+import diyTitle from './diy-title.ts'
+import auxiliaryEmpty from './auxiliary-empty.ts'
+import auxiliaryLine from './auxiliary-line.ts'
+import activityCube from './activity-cube.ts'
export default {
icon: 'trash',
@@ -13,99 +18,35 @@ export default {
swiper,
productGroup,
categoryBar,
+ productColumn,
+ diyTitle,
+ searchCube,
+ imageCube,
+ auxiliaryEmpty,
+ auxiliaryLine,
+ activityCube,
{
- title: '两列产品卡片',
- vid: createUniqueId(),
- mid: createUniqueId(),
- maxReferenceCount: -1,
- referenceCount: 0,
- image: undefined,
- configs: [],
- init: {},
- theme: {
- color: 'pink',
- padding: {
- top: 12.5,
- left: 12.5,
- right: 12.5
- },
- gap: 10,
- },
- children: [
- {
- theme: {
- width: 170,
- height: 200,
- color: 'white'
- },
- children: '产品'
- },
- {
- theme: {
- width: 170,
- height: 200,
- color: 'white'
- },
- children: '产品'
- }
- ]
- },
- {
- title: '自定义标题',
+ title: '商品分类',
vid: createUniqueId(),
mid: createUniqueId(),
maxReferenceCount: -1,
referenceCount: 0,
image: undefined,
- configs: [
- {
- type: 'text',
- field: 'Title',
- label: '标题',
- help: '自定义标题', // 自动生成:"请输入${label}"
- },
- ],
init: {
- Title: '猜你喜欢',
theme:{
- fontSize: 18,
- color: '#fff'
- }
- },
- theme: {
- padding: {
- vertical: 15,
- horizontal: 15,
+ color: 'white',
+ textColor: '#333'
},
- color: '@@theme.color',
- textColor: '#333',
- fontSize: '@@theme.fontSize',
- fontWeight: 900,
},
- children: {
- type: 'text',
- key: 'Title'
- }
-
- },
- searchCube,
- imageCube,
- {
- title: '商品分类',
- vid: createUniqueId(),
- mid: createUniqueId(),
- maxReferenceCount: -1,
- referenceCount: 0,
- image: undefined,
- init: {},
templates:{},
configs:[],
theme:{
- color: 'white',
+ color: '@@theme.color',
gap: 15,
fontSize:14,
fontWeight: 400,
padding:10,
+ textColor: '@@theme.textColor'
},
children:[
{children:'产品分类',theme:{fontWeight:600}},
@@ -115,7 +56,5 @@ export default {
{children:'产品分类'},
],
}
-
-
],
} as Category
diff --git a/src/modules/product-column.ts b/src/modules/product-column.ts
new file mode 100644
index 0000000..fab8f4b
--- /dev/null
+++ b/src/modules/product-column.ts
@@ -0,0 +1,53 @@
+import { createUniqueId } from '../engineer/utils'
+import { Module } from '../engineer'
+
+const module: Module = {
+ title: '两列产品卡片',
+ vid: createUniqueId(),
+ mid: createUniqueId(),
+ maxReferenceCount: -1,
+ referenceCount: 0,
+ image: undefined,
+ configs: [],
+ init: {
+ theme:{
+ color: 'pink',
+ innerRadius: 12
+ }
+ },
+ theme: {
+ color: '@@theme.color',
+ padding: {
+ top: 12.5,
+ left: 12.5,
+ right: 12.5
+ },
+ gap: 10,
+ },
+ children: [
+ {
+
+ vid: createUniqueId(),
+ theme: {
+ width: 170,
+ height: 200,
+ color: 'white',
+ radius: '@@theme.innerRadius',
+ clip: 'hidden'
+ },
+ children: '产品'
+ },
+ {
+ vid: createUniqueId(),
+ theme: {
+ width: 170,
+ height: 200,
+ color: 'white',
+ radius: '@@theme.innerRadius',
+ clip: 'hidden'
+ },
+ children: '产品'
+ }
+ ]
+}
+export default module