diff --git a/src/components/common/custom-module/data-rendering/index.vue b/src/components/common/custom-module/data-rendering/index.vue
index 4a34b2d3..e02baec0 100644
--- a/src/components/common/custom-module/data-rendering/index.vue
+++ b/src/components/common/custom-module/data-rendering/index.vue
@@ -2,19 +2,19 @@
@@ -47,10 +47,6 @@ const props = defineProps({
return {};
}
},
- sourceType: {
- type: String,
- default: ''
- },
dataHeight: {
type: Number,
default: 0,
@@ -58,6 +54,21 @@ const props = defineProps({
scale: {
type: Number,
default: 1,
+ },
+ isCustom: {
+ type: Boolean,
+ default: false
+ },
+ showData: {
+ type: Object as PropType<{
+ data_key: string;
+ data_name: string;
+ data_logo?: string;
+ }>,
+ default: () => ({
+ data_key: 'id',
+ data_name: 'name',
+ })
}
});
diff --git a/src/components/common/custom-module/model-icon/index.vue b/src/components/common/custom-module/model-icon/index.vue
index 8ff9f267..0e524da0 100644
--- a/src/components/common/custom-module/model-icon/index.vue
+++ b/src/components/common/custom-module/model-icon/index.vue
@@ -33,9 +33,9 @@ const props = defineProps({
type: Number,
default: 1
},
- sourceType: {
- type: String,
- default: ''
+ isCustom: {
+ type: Boolean,
+ default: false
}
});
// 用于页面判断显示
@@ -49,7 +49,7 @@ const icon_class = computed(() => {
// 不输入商品, 文章和品牌时,从外层处理数据
let icon = props.sourceList[form.value.data_source_id];
// 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
- if (['goods', 'article', 'brand'].includes(props.sourceType) && !isEmpty(props.sourceList.data)) {
+ if (!isEmpty(props.sourceList.data) && props.isCustom) {
icon = props.sourceList.data[form.value.data_source_id];
}
return icon;
diff --git a/src/components/common/custom-module/model-image/index.vue b/src/components/common/custom-module/model-image/index.vue
index 397e221f..5035cc76 100644
--- a/src/components/common/custom-module/model-image/index.vue
+++ b/src/components/common/custom-module/model-image/index.vue
@@ -28,18 +28,15 @@ const props = defineProps({
type: Number,
default: 1
},
- sourceType: {
+ isCustom: {
+ type: Boolean,
+ default: false
+ },
+ imgParams: {
type: String,
- default: '',
+ default: ''
}
});
-
-const keyMap: { [key: string]: string } = {
- goods: 'images',
- article: 'cover',
- brand: 'logo'
-};
-
// 用于页面判断显示
const form = computed(() => props.value);
@@ -51,9 +48,9 @@ const img = computed(() => {
// 不输入商品, 文章和品牌时,从外层处理数据
let image_url = props.sourceList[form.value.data_source_id];
// 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
- if (['goods', 'article', 'brand'].includes(props.sourceType) && !isEmpty(props.sourceList.data)) {
- if (form.value.data_source_id == keyMap[props.sourceType]) {
- image_url = !isEmpty(props.sourceList.new_cover)? props.sourceList.new_cover[0]?.url || '' : props.sourceList.data[keyMap[props.sourceType]];
+ if (!isEmpty(props.sourceList.data) && props.isCustom) {
+ if (form.value.data_source_id == props.imgParams) {
+ image_url = !isEmpty(props.sourceList.new_cover)? props.sourceList.new_cover[0]?.url || '' : props.sourceList.data[props.imgParams];
} else {
image_url = props.sourceList.data[form.value.data_source_id];
}
diff --git a/src/components/common/custom-module/model-text/index.vue b/src/components/common/custom-module/model-text/index.vue
index be897eaf..4136a4c5 100644
--- a/src/components/common/custom-module/model-text/index.vue
+++ b/src/components/common/custom-module/model-text/index.vue
@@ -35,16 +35,15 @@ const props = defineProps({
type: Number,
default: 1
},
- sourceType: {
+ isCustom: {
+ type: Boolean,
+ default: false
+ },
+ titleParams: {
type: String,
default: ''
}
});
-const keyMap: { [key: string]: string } = {
- goods: 'title',
- article: 'title',
- brand: 'name'
-};
// 用于页面判断显示
const form = computed(() => props.value);
@@ -52,10 +51,10 @@ const text_title = computed(() => {
let text = '';
let text_title = props.sourceList[form.value.data_source_id];
// 如果是商品的标题或者是品牌的名称,需要判断是否有新的标题,没有的话就取原来的标题
- if (['goods', 'article', 'brand'].includes(props.sourceType) && !isEmpty(props.sourceList.data)) {
+ if (!isEmpty(props.sourceList.data) && props.isCustom) {
// 其他的切换为从data中取数据
- if (form.value.data_source_id == keyMap[props.sourceType]) {
- text_title = !isEmpty(props.sourceList.new_title) ? props.sourceList.new_title : props.sourceList.data[keyMap[props.sourceType]];
+ if (form.value.data_source_id == props.titleParams) {
+ text_title = !isEmpty(props.sourceList.new_title) ? props.sourceList.new_title : props.sourceList.data[props.titleParams];
} else {
text_title = props.sourceList.data[form.value.data_source_id];
}
diff --git a/src/components/model-custom/components/index.vue b/src/components/model-custom/components/index.vue
index 824b5f63..49a7bcc3 100644
--- a/src/components/model-custom/components/index.vue
+++ b/src/components/model-custom/components/index.vue
@@ -70,19 +70,19 @@
-
+
-
+
-
+
-
+
-
+
@@ -107,7 +107,7 @@