自定义数据显示处理
parent
42177efccf
commit
d17c8e9962
|
|
@ -5,19 +5,19 @@
|
|||
<view class="wh-auto pr" :style="'height:' + form.height * scale + 'px;'">
|
||||
<view v-for="(item, index) in form.custom_list" :key="item.id" class="main-content" :style="{ left: get_percentage_count(item.location.x, div_width), top: get_percentage_count(item.location.y, div_height), width: get_percentage_count(item.com_data.com_width, div_width), height: get_percentage_count(item.com_data.com_height, div_height), 'z-index': custom_list_length > 0 ? custom_list_length - index : 0 }">
|
||||
<template v-if="item.key == 'text'">
|
||||
<model-text :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event"></model-text>
|
||||
<model-text :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event($event, index)"></model-text>
|
||||
</template>
|
||||
<template v-else-if="item.key == 'img'">
|
||||
<model-image :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event"></model-image>
|
||||
<model-image :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event($event, index)"></model-image>
|
||||
</template>
|
||||
<template v-else-if="item.key == 'auxiliary-line'">
|
||||
<model-lines :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source"></model-lines>
|
||||
</template>
|
||||
<template v-else-if="item.key == 'icon'">
|
||||
<model-icon :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event"></model-icon>
|
||||
<model-icon :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event($event, index)"></model-icon>
|
||||
</template>
|
||||
<template v-else-if="item.key == 'panel'">
|
||||
<model-panel :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event"></model-panel>
|
||||
<model-panel :propKey="propKey" :propValue="item.com_data" :propScale="scale" :propSourceList="item1" :propSourceType="data_source" @url_event="url_event($event, index)"></model-panel>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -239,7 +239,13 @@ import { isEmpty } from '../../common/js/common/common';
|
|||
data_source: !isEmpty(new_form.data_source)? new_form.data_source : '',
|
||||
});
|
||||
},
|
||||
url_event(e) {
|
||||
url_event(e, index = 0) {
|
||||
if (this.data_source == 'goods') {
|
||||
const list = this.data_source_content_list[index];
|
||||
if (!isEmpty(list)) {
|
||||
app.globalData.goods_data_cache_handle(list.data.id, list.data);
|
||||
}
|
||||
}
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="img-outer pr oh flex-row align-c wh-auto ht-auto" :style="com_style" :data-value="form.icon_link.page" @tap="url_event">
|
||||
<view class="img-outer pr oh flex-row align-c wh-auto ht-auto" :style="com_style" :data-value="icon_url" @tap="url_event">
|
||||
<iconfont :name="'icon-' + icon_class" :color="form.icon_color" :size="form.icon_size * scale + 'px'" propContainerDisplay="flex"></iconfont>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -41,6 +41,7 @@ import { isEmpty } from '../../../../common/js/common/common';
|
|||
com_style: '',
|
||||
scale: 1,
|
||||
icon_class: '',
|
||||
icon_url: '',
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -69,11 +70,20 @@ import { isEmpty } from '../../../../common/js/common/common';
|
|||
icon_class_value = '';
|
||||
}
|
||||
}
|
||||
let url = '';
|
||||
if (!isEmpty(this.propValue.icon_link)) {
|
||||
url = this.propValue.icon_link?.page || '';
|
||||
} else if (!isEmpty(this.propSourceList.data)) {
|
||||
url = this.propSourceList.data[this.propValue?.data_source_link] || '';
|
||||
} else {
|
||||
url = this.propSourceList[this.propValue?.data_source_link] || '';
|
||||
}
|
||||
this.setData({
|
||||
form: this.propValue,
|
||||
scale: this.propScale,
|
||||
com_style: this.get_com_style(this.propValue, this.propScale),
|
||||
icon_class: icon_class_value,
|
||||
icon_url: url,
|
||||
});
|
||||
},
|
||||
get_com_style(form, scale) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="img-outer pr wh-auto ht-auto" :style="border_style" :data-value="form.link.page" @tap="url_event">
|
||||
<view class="img-outer pr wh-auto ht-auto" :style="border_style" :data-value="img_url" @tap="url_event">
|
||||
<imageEmpty :propImageSrc="img" :propStyle="image_style" propErrorStyle="width: 60rpx;height: 60rpx;"></imageEmpty>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
return {
|
||||
form: {},
|
||||
img: '',
|
||||
img_url: '',
|
||||
image_style: '',
|
||||
border_style: '',
|
||||
keyMap: {
|
||||
|
|
@ -60,12 +61,20 @@
|
|||
},
|
||||
methods: {
|
||||
init() {
|
||||
|
||||
let url = '';
|
||||
if (!isEmpty(this.propValue.icon_link)) {
|
||||
url = this.propValue.icon_link?.page || '';
|
||||
} else if (!isEmpty(this.propSourceList.data)) {
|
||||
url = this.propSourceList.data[this.propValue?.data_source_link] || '';
|
||||
} else {
|
||||
url = this.propSourceList[this.propValue?.data_source_link] || '';
|
||||
}
|
||||
this.setData({
|
||||
form: this.propValue,
|
||||
img: this.get_img_url(this.propValue),
|
||||
image_style: this.get_image_style(this.propValue, this.propScale),
|
||||
border_style: this.get_border_style(this.propValue, this.propScale),
|
||||
img_url: url,
|
||||
});
|
||||
},
|
||||
get_img_url(form) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="img-outer wh-auto ht-auto re oh" :style="com_style" :data-value="form.text_link.page" @tap="url_event">
|
||||
<view class="img-outer wh-auto ht-auto re oh" :style="com_style" :data-value="text_url" @tap="url_event">
|
||||
<view :style="text_style" class="break">
|
||||
<template v-if="form.is_rich_text == '1'">
|
||||
<view class="rich-text-content" :innerHTML="text_title"></view>
|
||||
|
|
@ -47,6 +47,7 @@
|
|||
text_title: '',
|
||||
text_style: '',
|
||||
com_style: '',
|
||||
text_url: '',
|
||||
keyMap: {
|
||||
goods: 'title',
|
||||
article: 'title',
|
||||
|
|
@ -64,11 +65,20 @@
|
|||
},
|
||||
methods: {
|
||||
init() {
|
||||
let url = '';
|
||||
if (!isEmpty(this.propValue.icon_link)) {
|
||||
url = this.propValue.icon_link?.page || '';
|
||||
} else if (!isEmpty(this.propSourceList.data)) {
|
||||
url = this.propSourceList.data[this.propValue?.data_source_link] || '';
|
||||
} else {
|
||||
url = this.propSourceList[this.propValue?.data_source_link] || '';
|
||||
}
|
||||
this.setData({
|
||||
form: this.propValue,
|
||||
text_title: this.get_text_title(this.propValue),
|
||||
text_style: this.get_text_style(this.propValue, this.propScale),
|
||||
com_style: this.get_com_style(this.propValue, this.propScale),
|
||||
text_url: url,
|
||||
});
|
||||
},
|
||||
get_text_title(form) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue