From 42d7c62b941d716e77abddb3447053c5c796f732 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Tue, 10 Dec 2024 16:34:15 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8B=BC=E6=8E=A5=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/custom-module/model-icon/index.vue | 40 ++++++++-----
.../model-icon/model-icon-style.vue | 12 ++--
.../custom-module/model-image/index.vue | 50 +++++++++-------
.../model-image/model-image-style.vue | 12 ++--
.../model-panel/model-panel-style.vue | 7 ++-
.../common/custom-module/model-text/index.vue | 59 +++++++++++--------
.../model-text/model-text-style.vue | 17 ++++--
.../model-custom/components/index-default.ts | 32 +++++++++-
.../model-custom/components/index.vue | 8 +++
src/utils/index.ts | 40 +++++++++++++
10 files changed, 194 insertions(+), 83 deletions(-)
diff --git a/src/components/common/custom-module/model-icon/index.vue b/src/components/common/custom-module/model-icon/index.vue
index 57f4f8eb..82645434 100644
--- a/src/components/common/custom-module/model-icon/index.vue
+++ b/src/components/common/custom-module/model-icon/index.vue
@@ -47,29 +47,39 @@ const icon_class = computed(() => {
} else {
if (!isEmpty(props.sourceList)) {
let icon = '';
- // 获取数据源ID
- const data_source_id = form.value.data_source_id;
- if (!data_source_id.includes('.')) {
- // 不输入商品, 文章和品牌时,从外层处理数据
- icon = props.sourceList[data_source_id];
- // 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
- if (!isEmpty(props.sourceList.data) && props.isCustom) {
- icon = props.sourceList.data[data_source_id];
- }
+ // 取出数据源ID
+ const data_source_id = !isEmpty(form.value?.data_source_field?.id || '') ? form.value?.data_source_field?.id : form.value.data_source_id;
+ // 数据源内容
+ const option = form.value?.data_source_field?.option || {};
+ if (data_source_id.includes(';')) {
+ // 取出所有的字段,使用;分割
+ const ids = data_source_id.split(';');
+ let text = '';
+ ids.forEach((item: string, index: number) => {
+ text += data_handling(item) + (index != ids.length - 1 ? (option?.join || '') : '');
+ });
+ icon = text;
} else {
// 不输入商品, 文章和品牌时,从外层处理数据
- icon = get_nested_property(props.sourceList, data_source_id);
- // 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
- if (!isEmpty(props.sourceList.data) && props.isCustom) {
- icon = get_nested_property(props.sourceList.data, data_source_id);
- }
+ icon = data_handling(data_source_id);
}
- return icon;
+ return (option?.first || '') + icon + (option?.last || '');
} else {
return '';
}
}
});
+
+const data_handling = (data_source_id: string) => {
+ // 不输入商品, 文章和品牌时,从外层处理数据
+ let icon = get_nested_property(props.sourceList, data_source_id);
+ // 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
+ if (!isEmpty(props.sourceList.data) && props.isCustom) {
+ icon = get_nested_property(props.sourceList.data, data_source_id);
+ }
+ return icon;
+}
+
const com_style = computed(() => {
let style = `${ set_count() } ${ gradient_handle(form.value.color_list, form.value.direction) } ${ radius_computer(form.value.bg_radius, props.scale) };transform: rotate(${form.value.icon_rotate}deg);${ padding_computer(form.value.icon_padding, props.scale) };`;
if (form.value.border_show == '1') {
diff --git a/src/components/common/custom-module/model-icon/model-icon-style.vue b/src/components/common/custom-module/model-icon/model-icon-style.vue
index ea7d71bf..5da69ba8 100644
--- a/src/components/common/custom-module/model-icon/model-icon-style.vue
+++ b/src/components/common/custom-module/model-icon/model-icon-style.vue
@@ -17,7 +17,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -100,7 +100,7 @@