mirror of
https://gitee.com/zongzhige/shopxo-diy.git
synced 2026-07-08 14:40:00 +08:00
新增边框和阴影
This commit is contained in:
@ -37,32 +37,34 @@
|
||||
</div>
|
||||
<div v-else class="oh" :class="article_theme_class">
|
||||
<swiper :key="carousel_key" class="w flex" direction="horizontal" :loop="true" :autoplay="autoplay" :slides-per-view="Number(carousel_col) + 1" :slides-per-group="slides_per_group" :allow-touch-move="false" :space-between="new_style.article_spacing" :pause-on-mouse-enter="true" :modules="modules">
|
||||
<swiper-slide v-for="(item, index) in data_list" :key="index" class="item oh" :style="article_style">
|
||||
<div class="h oh flex-col" :style="article_img_style">
|
||||
<div class="oh re h">
|
||||
<template v-if="item.new_cover.length > 0">
|
||||
<image-empty v-model="item.new_cover[0].url" class="img" :style="img_radius" :error-img-style="error_img"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.data.cover" class="img" :style="img_radius" :error-img-style="error_img"></image-empty>
|
||||
</template>
|
||||
<template v-if="field_show.includes('3') && new_content.name_float == '1'">
|
||||
<div class="text-line-1" :style="article_name + float_name_style">{{ !isEmpty(item.new_title) ? item.new_title : item.data.title }}</div>
|
||||
</template>
|
||||
<!-- 角标设置 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
<div v-if="field_show.includes('0') || field_show.includes('1') || field_show.includes('2') || (field_show.includes('3') && new_content.name_float == '0')" class="jc-sb flex-1 flex-col" :style="article_theme != '0' ? content_padding : ''">
|
||||
<div class="flex-col" :style="'gap:' + new_style.name_desc_space + 'px;'">
|
||||
<div v-if="field_show.includes('3') && new_content.name_float == '0'" class="title text-line-2" :style="article_name">{{ !isEmpty(item.new_title) ? item.new_title : item.data.title }}</div>
|
||||
<div v-if="field_show.includes('2')" :class="'desc ' + field_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="article_desc">{{ item.data.describe || '' }}</div>
|
||||
<swiper-slide v-for="(item, index) in data_list" :key="index">
|
||||
<div class="item oh" :style="article_style">
|
||||
<div class="h oh flex-col" :style="article_img_style">
|
||||
<div class="oh re h">
|
||||
<template v-if="item.new_cover.length > 0">
|
||||
<image-empty v-model="item.new_cover[0].url" class="img" :style="img_radius" :error-img-style="error_img"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.data.cover" class="img" :style="img_radius" :error-img-style="error_img"></image-empty>
|
||||
</template>
|
||||
<template v-if="field_show.includes('3') && new_content.name_float == '1'">
|
||||
<div class="text-line-1" :style="article_name + float_name_style">{{ !isEmpty(item.new_title) ? item.new_title : item.data.title }}</div>
|
||||
</template>
|
||||
<!-- 角标设置 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
<div :class="[ 'flex-row jc-sb gap-8 align-e', { 'mt-10': (field_show.includes('3') && new_content.name_float == '0') || field_show.includes('2') }] ">
|
||||
<div :style="article_date">{{ field_show.includes('0') ? (!is_obj_empty(item.data) ? item.data.add_time : '2020-06-05 15:20') : '' }}</div>
|
||||
<div v-show="field_show.includes('1')" class="flex-row align-c gap-3" :style="article_page_view">
|
||||
<icon name="eye"></icon>
|
||||
<div>
|
||||
{{ item.data.access_count ? item.data.access_count : '16' }}
|
||||
<div v-if="field_show.includes('0') || field_show.includes('1') || field_show.includes('2') || (field_show.includes('3') && new_content.name_float == '0')" class="jc-sb flex-1 flex-col" :style="article_theme != '0' ? content_padding : ''">
|
||||
<div class="flex-col" :style="'gap:' + new_style.name_desc_space + 'px;'">
|
||||
<div v-if="field_show.includes('3') && new_content.name_float == '0'" class="title text-line-2" :style="article_name">{{ !isEmpty(item.new_title) ? item.new_title : item.data.title }}</div>
|
||||
<div v-if="field_show.includes('2')" :class="'desc ' + field_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="article_desc">{{ item.data.describe || '' }}</div>
|
||||
</div>
|
||||
<div :class="[ 'flex-row jc-sb gap-8 align-e', { 'mt-10': (field_show.includes('3') && new_content.name_float == '0') || field_show.includes('2') }] ">
|
||||
<div :style="article_date">{{ field_show.includes('0') ? (!is_obj_empty(item.data) ? item.data.add_time : '2020-06-05 15:20') : '' }}</div>
|
||||
<div v-show="field_show.includes('1')" class="flex-row align-c gap-3" :style="article_page_view">
|
||||
<icon name="eye"></icon>
|
||||
<div>
|
||||
{{ item.data.access_count ? item.data.access_count : '16' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -76,7 +78,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { common_styles_computer, padding_computer, radius_computer, get_math, is_obj_empty, common_img_computer, background_computer, gradient_handle, gradient_computer, margin_computer, box_shadow_computer, border_computer } from '@/utils';
|
||||
import { common_styles_computer, padding_computer, radius_computer, get_math, is_obj_empty, common_img_computer, background_computer, gradient_handle, gradient_computer, margin_computer, box_shadow_computer, border_computer, old_radius, old_padding, old_margin } from '@/utils';
|
||||
import { isEmpty, cloneDeep } from 'lodash';
|
||||
import ArticleAPI from '@/api/article';
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
@ -226,13 +228,15 @@ watch(
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// 轮播宽度
|
||||
const multicolumn_columns_width = computed(() => {
|
||||
const { carousel_col } = toRefs(new_content.value);
|
||||
// 计算间隔的空间。(gap * gap数量) / 模块数量
|
||||
let gap = carousel_col.value != '0' ? (new_style.value.article_spacing * carousel_col.value) / (Number(carousel_col.value) + 1) : '0';
|
||||
return `calc(${100 / (Number(carousel_col.value) + 1)}% - ${gap}px)`;
|
||||
});
|
||||
|
||||
// // 轮播宽度
|
||||
// const multicolumn_columns_width = computed(() => {
|
||||
// const { carousel_col } = toRefs(new_content.value);
|
||||
// const new_num = Number(carousel_col.value);
|
||||
// // 计算间隔的空间。(gap * gap数量) / 模块数量
|
||||
// let gap = (new_style.value.article_spacing * (new_num - 1)) + (article_left_right_width_margin.value * new_num) / new_num;
|
||||
// return `calc(${100 / new_num}% - ${gap}px)`;
|
||||
// });
|
||||
// 文章内容高度
|
||||
const article_name_height_computer = computed(() => {
|
||||
return new_style.value.name_size * 2.4 + 'px';
|
||||
@ -285,10 +289,7 @@ const carousel_col = ref('2');
|
||||
const carousel_key = ref('0');
|
||||
const autoplay = ref<boolean | object>(false);
|
||||
const slides_per_group = ref(1);
|
||||
// 数据的默认值,避免没有值的时候报错
|
||||
const old_radius = { radius: 0, radius_top_left: 0, radius_top_right: 0, radius_bottom_left: 0, radius_bottom_right: 0 };
|
||||
const old_padding = { padding: 0, padding_top: 0, padding_bottom: 0, padding_left: 0, padding_right: 0 };
|
||||
const old_margin = { margin: 0, margin_top: 0, margin_bottom: 0, margin_left: 0, margin_right: 0 };
|
||||
|
||||
// 文章名称浮动样式
|
||||
const float_name_style = computed(() => {
|
||||
const { name_bg_color_list = [], name_bg_direction = '180deg', name_bg_radius = old_radius, name_bg_padding = old_padding, name_bg_margin = old_margin } = new_style.value;
|
||||
@ -300,6 +301,10 @@ const float_name_style = computed(() => {
|
||||
return gradient_computer(data) + radius_computer(name_bg_radius) + padding_computer(name_bg_padding) + margin_computer(name_bg_margin) + location;
|
||||
});
|
||||
const field_desc_row = ref('1');
|
||||
const article_left_right_width_margin = computed(() => {
|
||||
const { margin = old_margin } = new_style.value;
|
||||
return margin.margin_left + margin.margin_right;
|
||||
});
|
||||
// 监听value数据变化
|
||||
watch(
|
||||
() => props.value,
|
||||
@ -343,7 +348,7 @@ watch(
|
||||
article_style.value += content_radius.value + all_style;
|
||||
article_img_style.value = content_spacing.value + content_padding.value + background_computer(article_data);
|
||||
} else if (article_theme.value == '1') {
|
||||
article_style.value += `width: calc(50% - ${new_style.article_spacing / 2}px);` + content_radius.value + all_style;
|
||||
article_style.value += `width: calc(50% - ${(new_style.article_spacing + article_left_right_width_margin.value * 2) / 2}px);` + content_radius.value + all_style;
|
||||
article_img_style.value = background_computer(article_data);
|
||||
} else if (article_theme.value == '2') {
|
||||
article_style.value += content_radius.value + all_style;
|
||||
@ -408,7 +413,6 @@ const article_theme_class = computed(() => {
|
||||
}
|
||||
.style2 {
|
||||
.item {
|
||||
width: calc(50% - 0.5rem);
|
||||
.img {
|
||||
height: v-bind(article_img_height);
|
||||
}
|
||||
@ -416,7 +420,6 @@ const article_theme_class = computed(() => {
|
||||
}
|
||||
.style3 {
|
||||
.item {
|
||||
width: 100%;
|
||||
.img {
|
||||
width: 100%;
|
||||
height: v-bind(article_img_height);
|
||||
@ -433,8 +436,6 @@ const article_theme_class = computed(() => {
|
||||
}
|
||||
.style5 {
|
||||
.item {
|
||||
width: v-bind(multicolumn_columns_width);
|
||||
min-width: v-bind(multicolumn_columns_width);
|
||||
height: v-bind(carousel_height_computer);
|
||||
.img {
|
||||
width: 100%;
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { isEmpty, cloneDeep } from 'lodash';
|
||||
import { common_img_computer, common_styles_computer, get_math, radius_computer } from '@/utils';
|
||||
import { border_width, common_img_computer, common_styles_computer, get_math, radius_computer } from '@/utils';
|
||||
import { source_list } from '@/config/const/custom';
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
import { Autoplay } from 'swiper/modules';
|
||||
@ -97,11 +97,11 @@ const scale = ref(1);
|
||||
watchEffect(() => {
|
||||
const { common_style, data_style, data_content_style } = new_style.value;
|
||||
// 外层左右间距
|
||||
const outer_spacing = common_style.margin_left + common_style.margin_right + common_style.padding_left + common_style.padding_right;
|
||||
const outer_spacing = common_style.margin_left + common_style.margin_right + common_style.padding_left + common_style.padding_right + border_width(common_style);
|
||||
// 内容左右间距
|
||||
const content_spacing = data_content_style.margin_left + data_content_style.margin_right + data_content_style.padding_left + data_content_style.padding_right;
|
||||
const content_spacing = data_content_style.margin_left + data_content_style.margin_right + data_content_style.padding_left + data_content_style.padding_right + border_width(data_content_style);
|
||||
// 数据左右间距
|
||||
const internal_spacing = data_style.margin_left + data_style.margin_right + data_style.padding_left + data_style.padding_right;
|
||||
const internal_spacing = data_style.margin_left + data_style.margin_right + data_style.padding_left + data_style.padding_right + border_width(data_style);
|
||||
// 根据容器宽度来计算内部大小
|
||||
const width = 390 - outer_spacing - internal_spacing - content_spacing - props.outerContainerPadding;
|
||||
// 获得对应宽度的比例
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<div class="w">
|
||||
<template v-if="type == '1'">
|
||||
<model-custom-content :value="value.content" :all-value="allValue" @data_source_change="data_source_change"></model-custom-content>
|
||||
<model-custom-content :value="form.content" :all-value="allValue" @data_source_change="data_source_change"></model-custom-content>
|
||||
</template>
|
||||
<template v-if="type == '2'">
|
||||
<model-custom-styles :value="value.style" :content="value.content" ></model-custom-styles>
|
||||
<model-custom-styles :value="form.style" :content="form.content" ></model-custom-styles>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
import defaultCommon from '@/config/const/custom';
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
@ -25,6 +25,13 @@ const props = defineProps({
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
// 历史数据处理, 兼容老数据
|
||||
const form = ref(props.value);
|
||||
onBeforeMount(() => {
|
||||
form.value.style.data_style = Object.assign({}, defaultCommon.style.data_style, props.value.style.data_style);
|
||||
form.value.style.data_content_style = Object.assign({}, defaultCommon.style.data_content_style, props.value.style.data_content_style);
|
||||
});
|
||||
|
||||
const all_content = ref(props.allValue);
|
||||
const data_source_change = (name: string) => {
|
||||
// 改变所有内容的名称
|
||||
|
||||
@ -49,6 +49,10 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.data_style.border_is_show" v-model:color="form.data_style.border_color" v-model:style="form.data_style.border_style" v-model:size="form.data_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.data_style"></shadow-config>
|
||||
</card-container>
|
||||
<div class="bg-f5 divider-line" />
|
||||
<card-container>
|
||||
@ -65,6 +69,10 @@
|
||||
<el-form-item label="圆角">
|
||||
<radius :value="form.data_content_style"></radius>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.data_content_style.border_is_show" v-model:color="form.data_content_style.border_color" v-model:style="form.data_content_style.border_style" v-model:size="form.data_content_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.data_content_style"></shadow-config>
|
||||
</card-container>
|
||||
</el-form>
|
||||
<div class="bg-f5 divider-line" />
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div ref="card_container" class="w h oh" :style="props.type === 'img' ? '' : style_container">
|
||||
<div class="w h re oh" :style="props.type === 'img' ? `height: ${ outer_height }px;` : `height: ${ outer_height }px;${ style_img_container }`">
|
||||
<div ref="card_container" class="flex-1 oh" :style="props.type === 'img' ? '' : style_container">
|
||||
<div class="re oh" :style="props.type === 'img' ? `height: ${ outer_height }px;` : `height: ${ outer_height }px;${ style_img_container }`">
|
||||
<swiper :key="form.data_style.carouselKey" class="w flex" :direction="form.data_style.rotation_direction" :loop="true" :autoplay="autoplay" :slides-per-view="slides_per_view" :slides-per-group="1" :space-between="props.type === 'img' ? 0 : form.data_style.data_goods_gap" :allow-touch-move="false" :pause-on-mouse-enter="true" :modules="modules" @slide-change="slideChange">
|
||||
<swiper-slide v-for="(item1, index1) in form.data_content.list" :key="index1">
|
||||
<template v-if="props.type === 'img'">
|
||||
@ -16,7 +16,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { gradient_computer, radius_computer, padding_computer, background_computer } from "@/utils";
|
||||
import { gradient_computer, radius_computer, padding_computer, background_computer, margin_computer, box_shadow_computer, border_computer, old_radius, old_margin, old_padding } from "@/utils";
|
||||
import { isEmpty } from "lodash";
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
import { Autoplay } from 'swiper/modules';
|
||||
@ -32,24 +32,23 @@ interface Props {
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
goodStyle: {},
|
||||
});
|
||||
|
||||
const form = computed(() => props.value);
|
||||
// 用于样式显示
|
||||
const style_container = computed(() => {
|
||||
if (!isEmpty(form.value.data_style)) {
|
||||
const { data_color_list = [], data_direction = '180deg', data_radius = { radius: 0, radius_top_left: 0, radius_top_right: 0, radius_bottom_left: 0, radius_bottom_right: 0 }} = form.value.data_style;
|
||||
const { data_color_list = [], data_direction = '180deg', data_chunk_margin = old_margin, data_radius = old_radius, data_pattern = { border_is_show: '0', border_color: '#FF3F3F', border_style: 'solid', border_size: { padding: 1, padding_top: 1, padding_right: 1, padding_bottom: 1, padding_left: 1 }, box_shadow_color: '', box_shadow_x: 0, box_shadow_y: 0, box_shadow_blur: 0, box_shadow_spread: 0 } } = form.value.data_style;
|
||||
const data = {
|
||||
color_list: data_color_list,
|
||||
direction: data_direction,
|
||||
}
|
||||
return gradient_computer(data) + radius_computer(data_radius);
|
||||
return gradient_computer(data) + radius_computer(data_radius) + margin_computer(data_chunk_margin) + box_shadow_computer(data_pattern) + border_computer(data_pattern);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
const style_img_container = computed(() => {
|
||||
if (!isEmpty(form.value.data_style)) {
|
||||
const { data_background_img = [], data_background_img_style = '2', data_chunk_padding = { padding: 0, padding_top: 0, padding_bottom: 0, padding_left: 0, padding_right: 0 }} = form.value.data_style;
|
||||
const { data_background_img = [], data_background_img_style = '2', data_chunk_padding = old_padding } = form.value.data_style;
|
||||
const data = {
|
||||
background_img: data_background_img,
|
||||
background_img_style: data_background_img_style,
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { isEmpty } from 'lodash';
|
||||
import { gradient_computer, radius_computer, padding_computer, background_computer, margin_computer } from "@/utils";
|
||||
import { gradient_computer, radius_computer, padding_computer, background_computer, margin_computer, border_computer, box_shadow_computer, old_radius, old_margin, old_padding } from "@/utils";
|
||||
|
||||
interface Props {
|
||||
value: Array<any>;
|
||||
@ -100,6 +100,7 @@ interface new_style {
|
||||
goods_color_list: color_list[];
|
||||
goods_direction: string;
|
||||
goods_radius: radiusStyle;
|
||||
goods_chunk_margin: marginStyle;
|
||||
goods_chunk_padding: paddingStyle;
|
||||
goods_background_img: uploadList[];
|
||||
goods_background_img_style: string;
|
||||
@ -109,15 +110,32 @@ interface new_style {
|
||||
goods_price_padding: paddingStyle;
|
||||
goods_price_margin: marginStyle;
|
||||
goods_price_location: string;
|
||||
border_is_show: string;
|
||||
border_color: string;
|
||||
border_style: string;
|
||||
border_size: paddingStyle;
|
||||
// 阴影
|
||||
box_shadow_color: string;
|
||||
box_shadow_x: number;
|
||||
box_shadow_y: number;
|
||||
box_shadow_blur: number;
|
||||
box_shadow_spread: number;
|
||||
}
|
||||
// 数据的默认值,避免没有值的时候报错
|
||||
const old_radius = { radius: 0, radius_top_left: 0, radius_top_right: 0, radius_bottom_left: 0, radius_bottom_right: 0 };
|
||||
const old_padding = { padding: 0, padding_top: 0, padding_bottom: 0, padding_left: 0, padding_right: 0 };
|
||||
const old_margin = { margin: 0, margin_top: 0, margin_bottom: 0, margin_left: 0, margin_right: 0 };
|
||||
|
||||
const shop_left_right_width_margin = computed(() => {
|
||||
const { goods_chunk_margin = old_margin } = props.goodStyle;
|
||||
return goods_chunk_margin.margin_left + goods_chunk_margin.margin_right;
|
||||
});
|
||||
const shop_top_bottom_width_margin = computed(() => {
|
||||
const { goods_chunk_margin = old_margin } = props.goodStyle;
|
||||
return goods_chunk_margin.margin_top + goods_chunk_margin.margin_bottom;
|
||||
});
|
||||
const block_size = computed(() => {
|
||||
const total_gap: number = props.goodStyle.data_goods_gap * (split_list.value.length - 1);
|
||||
return props.outerflex == 'row' ? 'height:100%;width:calc((100% - ' + total_gap + 'px) / ' + props.num + ');' : 'width: 100%;height:calc((100% - ' + total_gap + 'px) / ' + props.num + ');';
|
||||
// 总的宽度
|
||||
const all_width: number = total_gap + (shop_left_right_width_margin.value * props.num);
|
||||
// 总的高度
|
||||
const all_height: number = total_gap + (shop_top_bottom_width_margin.value * props.num);
|
||||
return props.outerflex == 'row' ? 'height:calc(100% - ' + shop_top_bottom_width_margin.value + 'px);width:calc((100% - ' + all_width + 'px) / ' + props.num + ');' : 'width:calc(100% - ' + shop_left_right_width_margin.value + 'px);height:calc((100% - ' + all_height + 'px) / ' + props.num + ');';
|
||||
});
|
||||
// 图片显示比例
|
||||
const image_scale = computed(() => {
|
||||
@ -136,7 +154,7 @@ const float_pirce_style = computed(() => {
|
||||
color_list: goods_price_color_list,
|
||||
direction: goods_price_direction,
|
||||
}
|
||||
let location = 'left:50%;transform:translateX(-50%);'
|
||||
let location = 'left:50%;transform:translateX(-50%);';
|
||||
if (goods_price_location == 'left') {
|
||||
location = 'left:0;';
|
||||
} else if (goods_price_location == 'right') {
|
||||
@ -150,12 +168,18 @@ const float_pirce_style = computed(() => {
|
||||
const style_container = computed(() => {
|
||||
return (val: new_style) => {
|
||||
if (!isEmpty(val)) {
|
||||
const { goods_color_list = [], goods_direction = '180deg', goods_radius = old_radius } = val;
|
||||
const { goods_color_list = [], goods_direction = '180deg', goods_radius = old_radius, goods_chunk_margin = old_margin } = val;
|
||||
const data = {
|
||||
color_list: goods_color_list,
|
||||
direction: goods_direction,
|
||||
}
|
||||
return gradient_computer(data) + radius_computer(goods_radius);
|
||||
const borderData = {
|
||||
border_is_show: val.border_is_show,
|
||||
border_color: val.border_color,
|
||||
border_style: val.border_style,
|
||||
border_size: val.border_size,
|
||||
};
|
||||
return gradient_computer(data) + radius_computer(goods_radius) + margin_computer(goods_chunk_margin) + border_computer(borderData) + box_shadow_computer(val);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { background_computer, common_img_computer, common_styles_computer, get_math, gradient_computer, margin_computer, padding_computer, radius_computer } from '@/utils';
|
||||
import { background_computer, border_computer, border_width, box_shadow_computer, common_img_computer, common_styles_computer, get_math, gradient_computer, margin_computer, old_margin, old_padding, old_radius, padding_computer, radius_computer } from '@/utils';
|
||||
import { isEmpty } from "lodash";
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
import { Autoplay } from 'swiper/modules';
|
||||
@ -128,23 +128,22 @@ const style_content_img_container = computed(() => {
|
||||
return common_img_computer(defalt_style);
|
||||
}
|
||||
});
|
||||
|
||||
// 用于样式显示
|
||||
const style_container = computed(() => {
|
||||
if (!isEmpty(new_style.value)) {
|
||||
const { data_color_list = [], data_direction = '180deg', data_radius = { radius: 0, radius_top_left: 0, radius_top_right: 0, radius_bottom_left: 0, radius_bottom_right: 0 }, data_chunk_margin = { margin: 0, margin_top: 0, margin_bottom: 0, margin_left: 0, margin_right: 0 }} = new_style.value;
|
||||
const { data_color_list = [], data_direction = '180deg', data_radius = old_radius, data_chunk_margin = old_margin, data_pattern = { border_is_show: '0', border_color: '#FF3F3F', border_style: 'solid', border_size: { padding: 1, padding_top: 1, padding_right: 1, padding_bottom: 1, padding_left: 1 }, box_shadow_color: '', box_shadow_x: 0, box_shadow_y: 0, box_shadow_blur: 0, box_shadow_spread: 0 }} = new_style.value;
|
||||
const data = {
|
||||
color_list: data_color_list,
|
||||
direction: data_direction,
|
||||
}
|
||||
return gradient_computer(data) + radius_computer(data_radius) + margin_computer(data_chunk_margin);
|
||||
return gradient_computer(data) + radius_computer(data_radius) + margin_computer(data_chunk_margin) + box_shadow_computer(data_pattern) + border_computer(data_pattern);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
const style_img_container = computed(() => {
|
||||
if (!isEmpty(new_style.value)) {
|
||||
const { data_background_img = [], data_background_img_style = '2', data_chunk_padding = { padding: 0, padding_top: 0, padding_bottom: 0, padding_left: 0, padding_right: 0 }} = new_style.value;
|
||||
const { data_background_img = [], data_background_img_style = '2', data_chunk_padding = old_padding } = new_style.value;
|
||||
const data = {
|
||||
background_img: data_background_img,
|
||||
background_img_style: data_background_img_style,
|
||||
@ -160,16 +159,24 @@ watchEffect(() => {
|
||||
form.value = props.value.data_content;
|
||||
new_style.value = props.value.data_style;
|
||||
const old_width = form.value.width * props.magicScale;
|
||||
// 数据样式
|
||||
const { padding_left, padding_right } = new_style.value.data_chunk_padding;
|
||||
const { margin_left, margin_right } = new_style.value.data_chunk_margin;
|
||||
const data_content_style = new_style.value?.data_content_style || {};
|
||||
const data_style = padding_left - padding_right - margin_left - margin_right- border_width(new_style.value.data_pattern);
|
||||
// 通用样式
|
||||
const common_border = new_style.value?.data_common_style || {};
|
||||
const chunk_padding = new_style.value?.chunk_padding || old_padding;
|
||||
const chunk_margin = new_style.value?.chunk_margin || old_margin;
|
||||
const common_styles = (chunk_margin?.margin_left || 0) + (chunk_margin?.margin_right || 0) + (chunk_padding?.padding_left || 0) + (chunk_padding?.padding_right || 0) + border_width(common_border);
|
||||
// 内容左右间距
|
||||
const content_spacing = (data_content_style?.margin_left || 0) + (data_content_style?.margin_right || 0) + (data_content_style?.padding_left || 0) + (data_content_style?.padding_right || 0);
|
||||
const data_content_style = new_style.value?.data_content_style || {};
|
||||
const content_spacing = (data_content_style?.margin_left || 0) + (data_content_style?.margin_right || 0) + (data_content_style?.padding_left || 0) + (data_content_style?.padding_right || 0) + border_width(data_content_style);
|
||||
// 当前容器的宽度 减去 左右两边的padding值 再减去 数据间距的一半 再除以 容器的宽度 得到比例 再乘以数据魔方的比例
|
||||
const width = old_width - padding_left - padding_right - margin_left - margin_right - content_spacing - (props.dataSpacing / 2);
|
||||
const width = old_width - data_style - content_spacing - common_styles - (props.dataSpacing / 2);
|
||||
|
||||
scale.value = width / old_width;
|
||||
})
|
||||
|
||||
// 计算纵向显示的宽度
|
||||
const gap_width = computed(() => {
|
||||
const model_number = Number(form.value.data_source_carousel_col);
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
<el-form-item label="背景">
|
||||
<background-common :key="form.carouselKey" v-model:color_list="form.data_color_list" v-model:direction="form.data_direction" v-model:img_style="form.data_background_img_style" v-model:img="form.data_background_img" @mult_color_picker_event="data_mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="tabs_content.data_type == 'custom'" label="外间距">
|
||||
<el-form-item label="外间距">
|
||||
<margin :key="form.carouselKey" :value="form.data_chunk_margin" @update:value="data_chunk_margin_change"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
@ -92,6 +92,10 @@
|
||||
<el-form-item v-if="tabs_content.data_type == 'goods'" label="数据间距">
|
||||
<slider v-model="form.data_goods_gap" :min="0" :max="50"></slider>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.data_pattern.border_is_show" v-model:color="form.data_pattern.border_color" v-model:style="form.data_pattern.border_style" v-model:size="form.data_pattern.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.data_pattern"></shadow-config>
|
||||
</card-container>
|
||||
<div class="bg-f5 divider-line" />
|
||||
<template v-if="tabs_content.data_type == 'custom'">
|
||||
@ -100,7 +104,7 @@
|
||||
<el-form-item label="背景">
|
||||
<background-common :key="form.carouselKey" v-model:color_list="form.data_content_style.color_list" v-model:direction="form.data_content_style.direction" v-model:img_style="form.data_content_style.background_img_style" v-model:img="form.data_content_style.background_img" @mult_color_picker_event="data_content_mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="tabs_content.data_type == 'custom'" label="外间距">
|
||||
<el-form-item label="外间距">
|
||||
<margin :key="form.carouselKey" :value="form.data_content_style"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
@ -109,6 +113,10 @@
|
||||
<el-form-item label="圆角">
|
||||
<radius :key="form.carouselKey" :value="form.data_content_style"></radius>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.data_content_style.border_is_show" v-model:color="form.data_content_style.border_color" v-model:style="form.data_content_style.border_style" v-model:size="form.data_content_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.data_content_style"></shadow-config>
|
||||
</card-container>
|
||||
<div class="bg-f5 divider-line" />
|
||||
</template>
|
||||
@ -165,12 +173,19 @@
|
||||
<el-form-item label="背景">
|
||||
<background-common :key="form.carouselKey" v-model:color_list="form.goods_color_list" v-model:direction="form.goods_direction" v-model:img_style="form.goods_background_img_style" v-model:img="form.goods_background_img" @mult_color_picker_event="goods_mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外间距">
|
||||
<margin :key="form.carouselKey" :value="form.goods_chunk_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :key="form.carouselKey" :value="form.goods_chunk_padding" @update:value="goods_chunk_padding_change"></padding>
|
||||
<padding :key="form.carouselKey" :value="form.goods_chunk_padding"></padding>
|
||||
</el-form-item>
|
||||
<el-form-item label="圆角">
|
||||
<radius :key="form.carouselKey" :value="form.goods_radius" @update:value="goods_radius_change"></radius>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.border_is_show" v-model:color="form.border_color" v-model:style="form.border_style" v-model:size="form.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form"></shadow-config>
|
||||
</card-container>
|
||||
<div class="bg-f5 divider-line" />
|
||||
</template>
|
||||
@ -179,9 +194,16 @@
|
||||
<el-form-item label="底部背景">
|
||||
<background-common :key="form.carouselKey" v-model:color_list="form.color_list" v-model:direction="form.direction" v-model:img_style="form.background_img_style" v-model:img="form.background_img" @mult_color_picker_event="mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="tabs_content.data_type != 'custom'" label="内间距">
|
||||
<padding :key="form.carouselKey" :value="form.chunk_padding" @update:value="chunk_padding_change"></padding>
|
||||
<el-form-item label="外间距">
|
||||
<margin :key="form.carouselKey" :value="form.chunk_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :key="form.carouselKey" :value="form.chunk_padding"></padding>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.data_common_style.border_is_show" v-model:color="form.data_common_style.border_color" v-model:style="form.data_common_style.border_style" v-model:size="form.data_common_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.data_common_style"></shadow-config>
|
||||
</card-container>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
<template>
|
||||
<div class="w h" :style="style_container">
|
||||
<div class="re w h oh">
|
||||
<template v-if="video && !video_img">
|
||||
<video :src="video" class="w h" :style="video_style"></video>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="video_img" :style="video_style" error-img-style="width:60px;height:60px;"></image-empty>
|
||||
</template>
|
||||
<img :src="video_src" class="middle box-shadow-sm round" width="50" height="50" />
|
||||
</div>
|
||||
<div class="re w h oh">
|
||||
<template v-if="video && !video_img">
|
||||
<video :src="video" class="w h" :style="video_style"></video>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="video_img" :style="video_style" error-img-style="width:60px;height:60px;"></image-empty>
|
||||
</template>
|
||||
<img :src="video_src" class="middle box-shadow-sm round" width="50" height="50" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@ -46,7 +44,6 @@ const video = computed(() => {
|
||||
}
|
||||
});
|
||||
// 公共样式
|
||||
const style_container = computed(() => padding_computer(props.dataStyle.chunk_padding));
|
||||
const video_style = computed(() => radius_computer(props.dataStyle.img_radius));
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -5,11 +5,60 @@
|
||||
<!-- 风格9 -->
|
||||
<template v-if="form.style_actived == 7">
|
||||
<div class="flex-row align-c jc-c style-size flex-wrap">
|
||||
<div v-for="(item, index) in data_magic_list" :key="index" :style="`${ item.data_style.background_style } ${ content_radius }`" :class="['img-spacing-border', { 'style9-top': [0, 1].includes(index), 'style9-bottom': ![0, 1].includes(index) }]">
|
||||
<div class="w h re" :style="`${ item.data_style.background_img_style }`">
|
||||
<div v-for="(item, index) in data_magic_list" :key="index" :class="['img-spacing-border', { 'style9-top': [0, 1].includes(index), 'style9-bottom': ![0, 1].includes(index) }]">
|
||||
<div class="w h flex-row" :style="`${ item.data_style.background_style } ${ content_radius }`">
|
||||
<div class="re flex-1 oh" :style="`${ item.data_style.background_img_style }`">
|
||||
<template v-if="item.data_content.data_type == 'goods'">
|
||||
<div class="w h flex-col" :style="`gap: ${ item.data_style.title_data_gap }px;`">
|
||||
<div v-if="(!isEmpty(item.data_content.heading_title) || !isEmpty(item.data_content.subtitle))" :class="'tl' + (item.data_style.title_line == '1' ? ' flex-row align-c' : ' flex-col')" :style="'gap:' + item.data_style.title_gap + 'px;'">
|
||||
<template v-if="item.data_content.heading_title_type && item.data_content.heading_title_type == 'image'">
|
||||
<div v-if="item.data_content.heading_title_img.length > 0" class="re" :style="`height: ${ item.data_style?.heading_img_height || 0 }px`">
|
||||
<img :style="`height: ${ item.data_style?.heading_img_height || 0 }px`" :src="item.data_content.heading_title_img[0].url" fit="contain" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="ma-0 w text-word-break text-line-1 flex-basis-shrink" :style="trends_config(item.data_style, 'heading')">{{ item.data_content.heading_title || '' }}</p>
|
||||
</template>
|
||||
<p class="ma-0 w text-word-break text-line-1 flex-basis-shrink" :style="trends_config(item.data_style, 'subtitle')">{{ item.data_content.subtitle || '' }}</p>
|
||||
</div>
|
||||
<div class="w h flex-1 oh flex-row">
|
||||
<magic-carousel :key="form.style_actived" :value="item" :good-style="item.data_style" :actived="form.style_actived" type="product" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.data_content.data_type == 'images'">
|
||||
<div class="w h oh flex-row">
|
||||
<magic-carousel :key="form.style_actived" :value="item" type="img" :actived="form.style_actived" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.data_content.data_type == 'custom'">
|
||||
<customIndex :value="item" :magic-scale="magic_scale" :data-spacing="new_style.image_spacing" @carousel_change="carousel_change(index, $event)"></customIndex>
|
||||
</template>
|
||||
<template v-else>
|
||||
<videoIndex :value="item.data_content" :data-style="item.data_style"></videoIndex>
|
||||
</template>
|
||||
<div v-if="item.data_style.is_show == '1' && item.data_content.list.length > 1" :class="['left', 'right'].includes(item.data_style.indicator_new_location) ? 'indicator_up_down_location' : 'indicator_about_location'" :style="item.data_style.indicator_location_style">
|
||||
<template v-if="item.data_style.indicator_style == 'num'">
|
||||
<div :style="item.data_style.indicator_styles" class="dot-item">
|
||||
<span class="num-active" :style="`color: ${ item.data_style.actived_color }`">{{ item.actived_index + 1 }}</span><span>/{{ item.data_content.list.length }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item3, index3) in item.data_content.list" :key="index3" :style="`${ item.data_style.indicator_styles }; ${ style_actived_color(item, index3)}`" class="dot-item" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item, index) in data_magic_list" :key="index" class="img-spacing-border cube-selected" :style="`${ selected_style(item) }`">
|
||||
<div class="w h flex-row" :style="`${ item.data_style.background_style } ${ content_radius }`">
|
||||
<div class="re flex-1 oh" :style="`${ item.data_style.background_img_style }`">
|
||||
<template v-if="item.data_content.data_type == 'goods'">
|
||||
<div class="w h flex-col" :style="`${ padding_computer(item.data_style.chunk_padding) };gap: ${ item.data_style.title_data_gap }px;`">
|
||||
<div v-if="(!isEmpty(item.data_content.heading_title) || !isEmpty(item.data_content.subtitle))" :class="'tl' + (item.data_style.title_line == '1' ? ' flex-row align-c' : ' flex-col')" :style="'gap:' + item.data_style.title_gap + 'px;'">
|
||||
<div class="w h flex-col" :style="`gap: ${ item.data_style.title_data_gap }px;`">
|
||||
<div v-if="!isEmpty(item.data_content.heading_title) || !isEmpty(item.data_content.subtitle)" :class="'tl' + (item.data_style.title_line == '1' ? ' flex-row align-c' : ' flex-col')" :style="'gap:' + item.data_style.title_gap + 'px;'">
|
||||
<template v-if="item.data_content.heading_title_type && item.data_content.heading_title_type == 'image'">
|
||||
<div v-if="item.data_content.heading_title_img.length > 0" class="re" :style="`height: ${ item.data_style?.heading_img_height || 0 }px`">
|
||||
<img :style="`height: ${ item.data_style?.heading_img_height || 0 }px`" :src="item.data_content.heading_title_img[0].url" fit="contain" />
|
||||
@ -20,13 +69,13 @@
|
||||
</template>
|
||||
<p class="ma-0 w text-word-break text-line-1 flex-basis-shrink" :style="trends_config(item.data_style, 'subtitle')">{{ item.data_content.subtitle || '' }}</p>
|
||||
</div>
|
||||
<div class="w h flex-1 oh">
|
||||
<magic-carousel :key="form.style_actived" :value="item" :good-style="item.data_style" :actived="form.style_actived" type="product" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
<div class="w h flex-1 oh flex-row">
|
||||
<magic-carousel :key="form.style_actived" :value="item" :good-style="item.data_style" type="product" :actived="form.style_actived" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.data_content.data_type == 'images'">
|
||||
<div class="w h" :style="`${ padding_computer(item.data_style.chunk_padding) }`">
|
||||
<div class="w h oh flex-row">
|
||||
<magic-carousel :key="form.style_actived" :value="item" type="img" :actived="form.style_actived" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</template>
|
||||
@ -36,7 +85,7 @@
|
||||
<template v-else>
|
||||
<videoIndex :value="item.data_content" :data-style="item.data_style"></videoIndex>
|
||||
</template>
|
||||
<div v-if="item.data_style.is_show == '1' && item.data_content.list.length > 1" :class="['left', 'right'].includes(item.data_style.indicator_new_location) ? 'indicator_up_down_location' : 'indicator_about_location'" :style="item.data_style.indicator_location_style">
|
||||
<div v-if="item.data_style.is_show == '1' && item.data_content.list.length > 1" :class="['left', 'right'].includes(item.data_style.indicator_new_location) ? 'indicator_up_down_location' : 'indicator_about_location'" :style="item.data_style.indicator_location_styles">
|
||||
<template v-if="item.data_style.indicator_style == 'num'">
|
||||
<div :style="item.data_style.indicator_styles" class="dot-item">
|
||||
<span class="num-active" :style="`color: ${ item.data_style.actived_color }`">{{ item.actived_index + 1 }}</span><span>/{{ item.data_content.list.length }}</span>
|
||||
@ -50,51 +99,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item, index) in data_magic_list" :key="index" class="img-spacing-border cube-selected" :style="`${ selected_style(item) } ${ item.data_style.background_style } ${ content_radius }`">
|
||||
<div class="w h re" :style="`${ item.data_style.background_img_style }`">
|
||||
<template v-if="item.data_content.data_type == 'goods'">
|
||||
<div class="w h flex-col" :style="`${ padding_computer(item.data_style.chunk_padding) };gap: ${ item.data_style.title_data_gap }px;`">
|
||||
<div v-if="!isEmpty(item.data_content.heading_title) || !isEmpty(item.data_content.subtitle)" :class="'tl' + (item.data_style.title_line == '1' ? ' flex-row align-c' : ' flex-col')" :style="'gap:' + item.data_style.title_gap + 'px;'">
|
||||
<template v-if="item.data_content.heading_title_type && item.data_content.heading_title_type == 'image'">
|
||||
<div v-if="item.data_content.heading_title_img.length > 0" class="re" :style="`height: ${ item.data_style?.heading_img_height || 0 }px`">
|
||||
<img :style="`height: ${ item.data_style?.heading_img_height || 0 }px`" :src="item.data_content.heading_title_img[0].url" fit="contain" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="ma-0 w text-word-break text-line-1 flex-basis-shrink" :style="trends_config(item.data_style, 'heading')">{{ item.data_content.heading_title || '' }}</p>
|
||||
</template>
|
||||
<p class="ma-0 w text-word-break text-line-1 flex-basis-shrink" :style="trends_config(item.data_style, 'subtitle')">{{ item.data_content.subtitle || '' }}</p>
|
||||
</div>
|
||||
<div class="w h flex-1 oh">
|
||||
<magic-carousel :key="form.style_actived" :value="item" :good-style="item.data_style" type="product" :actived="form.style_actived" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.data_content.data_type == 'images'">
|
||||
<div class="w h" :style="`${ padding_computer(item.data_style.chunk_padding) }`">
|
||||
<magic-carousel :key="form.style_actived" :value="item" type="img" :actived="form.style_actived" @carousel_change="carousel_change(index, $event)"></magic-carousel>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.data_content.data_type == 'custom'">
|
||||
<customIndex :value="item" :magic-scale="magic_scale" :data-spacing="new_style.image_spacing" @carousel_change="carousel_change(index, $event)"></customIndex>
|
||||
</template>
|
||||
<template v-else>
|
||||
<videoIndex :value="item.data_content" :data-style="item.data_style"></videoIndex>
|
||||
</template>
|
||||
<div v-if="item.data_style.is_show == '1' && item.data_content.list.length > 1" :class="['left', 'right'].includes(item.data_style.indicator_new_location) ? 'indicator_up_down_location' : 'indicator_about_location'" :style="item.data_style.indicator_location_styles">
|
||||
<template v-if="item.data_style.indicator_style == 'num'">
|
||||
<div :style="item.data_style.indicator_styles" class="dot-item">
|
||||
<span class="num-active" :style="`color: ${ item.data_style.actived_color }`">{{ item.actived_index + 1 }}</span><span>/{{ item.data_content.list.length }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item3, index3) in item.data_content.list" :key="index3" :style="`${ item.data_style.indicator_styles }; ${ style_actived_color(item, index3)}`" class="dot-item" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -102,7 +106,7 @@
|
||||
<script setup lang="ts">
|
||||
import customIndex from './components/custom/index.vue';
|
||||
import videoIndex from './components/video/index.vue';
|
||||
import { background_computer, common_styles_computer, get_math, gradient_computer, radius_computer, padding_computer, common_img_computer, is_number, percentage_count } from '@/utils';
|
||||
import { background_computer, common_styles_computer, get_math, gradient_computer, radius_computer, padding_computer, common_img_computer, is_number, percentage_count, margin_computer, box_shadow_computer, border_computer, old_margin, old_border_and_box_shadow, border_width } from '@/utils';
|
||||
import { isEmpty, cloneDeep } from 'lodash';
|
||||
const props = defineProps({
|
||||
value: {
|
||||
@ -379,8 +383,14 @@ watch(props.value.content, (val) => {
|
||||
// 指示器样式
|
||||
data_style.indicator_styles = indicator_style(data_style);
|
||||
data_style.indicator_location_styles = indicator_location_style(data_style);
|
||||
data_style.background_style = gradient_computer(data_style);
|
||||
data_style.background_img_style = background_computer(data_style);
|
||||
// 获取当前的margin
|
||||
const chunk_margin = data_style?.chunk_margin || old_margin;
|
||||
// 计算左右间距
|
||||
const left_right_width_margin = (chunk_margin?.margin_left || 0) + (chunk_margin?.margin_right || 0);
|
||||
// 计算上下间距
|
||||
const top_bottom_height_margin = (chunk_margin?.margin_top || 0) + (chunk_margin?.margin_bottom || 0);
|
||||
data_style.background_style = gradient_computer(data_style) + margin_computer(data_style?.chunk_margin || old_margin) + `width: calc(100% - ${ left_right_width_margin }px);height:calc(100% - ${ top_bottom_height_margin }px);` + box_shadow_computer(data_style?.data_common_style || old_border_and_box_shadow) + border_computer(data_style?.data_common_style || old_border_and_box_shadow);
|
||||
data_style.background_img_style = background_computer(data_style) + padding_computer(data_style.chunk_padding);
|
||||
const radius = !isEmpty(data_style.img_radius) ? data_style.img_radius : { radius: 4, radius_top_left: 4, radius_top_right: 4, radius_bottom_left: 4, radius_bottom_right: 4 };
|
||||
data_style.get_img_radius = radius_computer(radius);
|
||||
|
||||
@ -449,7 +459,7 @@ const typewidth = ref(0);
|
||||
watchEffect(() => {
|
||||
const { margin_left, margin_right, padding_left, padding_right } = new_style.value.common_style;
|
||||
// 根据容器宽度来计算内部大小
|
||||
typewidth.value = 390 - margin_left - margin_right - padding_left - padding_right - props.outerContainerPadding;
|
||||
typewidth.value = 390 - margin_left - margin_right - padding_left - padding_right - border_width(new_style.value.common_style) - props.outerContainerPadding;
|
||||
// 获得对应宽度的比例
|
||||
magic_scale.value = typewidth.value / 390;
|
||||
});
|
||||
|
||||
@ -72,10 +72,43 @@ const props = defineProps({
|
||||
const style_list = ['heng2', 'shu2', 'shang2xia1', 'shang1xia2', 'zuo1you2', 'zuo2you1', 'tianzige', 'shang2xia3', 'zuo1youshang1youxia2', 'a-4x4'];
|
||||
// 每个小模块独立的样式
|
||||
const data_style = {
|
||||
chunk_padding: {
|
||||
padding: 0,
|
||||
padding_top: 20,
|
||||
padding_bottom: 20,
|
||||
padding_left: 15,
|
||||
padding_right: 15,
|
||||
},
|
||||
chunk_margin: {
|
||||
margin: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
margin_top: 0
|
||||
},
|
||||
color_list: [{ color: '#FFD9C3', color_percentage: 0 }, { color: '#FFECE2', color_percentage: 12 }, { color: '#FFFFFF', color_percentage: 30 }],
|
||||
direction: '180deg',
|
||||
background_img_style: '2',
|
||||
background_img: [],
|
||||
data_common_style: {
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
carouselKey: get_math(),
|
||||
is_roll: '0',
|
||||
rolling_fashion: 'cut-screen',
|
||||
@ -100,6 +133,13 @@ const data_style = {
|
||||
goods_direction: '180deg',
|
||||
goods_background_img_style: '2',
|
||||
goods_background_img: [],
|
||||
goods_chunk_margin: {
|
||||
margin: 0,
|
||||
margin_top: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
},
|
||||
goods_chunk_padding: {
|
||||
padding: 0,
|
||||
padding_top: 0,
|
||||
@ -114,13 +154,6 @@ const data_style = {
|
||||
radius_bottom_left: 4,
|
||||
radius_bottom_right: 4,
|
||||
},
|
||||
chunk_padding: {
|
||||
padding: 0,
|
||||
padding_top: 20,
|
||||
padding_bottom: 20,
|
||||
padding_left: 15,
|
||||
padding_right: 15,
|
||||
},
|
||||
goods_price_symbol_size: 9,
|
||||
goods_price_symbol_color: "#EA3323;",
|
||||
goods_price_unit_size: 9,
|
||||
@ -151,6 +184,23 @@ const data_style = {
|
||||
radius_bottom_left: 4,
|
||||
radius_bottom_right: 4,
|
||||
},
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
// 图片圆角
|
||||
img_radius: {
|
||||
radius: 4,
|
||||
@ -206,6 +256,42 @@ const data_style = {
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
data_pattern: {
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
column_gap: 0,
|
||||
row_gap: 0,
|
||||
@ -315,6 +401,7 @@ onBeforeMount(() => {
|
||||
// 历史数据处理一下,避免有新增字段导致报错
|
||||
form.value.data_magic_list.forEach((item: any) => {
|
||||
item.data_style = Object.assign({}, cloneDeep(data_style), item.data_style);
|
||||
item.data_style.data_content_style = Object.assign({}, cloneDeep(data_style.data_content_style), item.data_style.data_content_style);
|
||||
item.data_content = Object.assign({}, cloneDeep(data_content), item.data_content);
|
||||
});
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<slider v-model="form.image_spacing" :max="100"></slider>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据圆角">
|
||||
<radius :value="form.data_radius" @update:value="data_radius_change"></radius>
|
||||
<radius :value="form.data_radius"></radius>
|
||||
</el-form-item>
|
||||
</card-container>
|
||||
</el-form>
|
||||
|
||||
@ -104,53 +104,55 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<swiper :key="carouselKey" class="w flex" direction="horizontal" :loop="true" :autoplay="autoplay" :slides-per-view="form.carousel_col" :slides-per-group="slides_per_group" :allow-touch-move="false" :space-between="content_outer_spacing" :pause-on-mouse-enter="true" :modules="modules">
|
||||
<swiper-slide v-for="(item, index) in list" :key="index" :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['0', '4'].includes(theme) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${theme}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('plugins_view_icon') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col flex-1 jc-sb content gap-10" :style="content_style">
|
||||
<div class="flex-col gap-10 top-title">
|
||||
<div v-if="is_show('title') || (['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc'))" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :class="text_line" :style="trends_config('title', 'title')">{{ item.title }}</div>
|
||||
<div v-if="['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc')" :class="form.simple_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('plugins_view_icon') && !isEmpty(item.plugins_view_icon_data)" class="flex-row gap-5 align-c">
|
||||
<div v-for="(icon_data, icon_index) in item.plugins_view_icon_data" :key="icon_index" class="radius-sm size-9 pl-3 pr-3" :style="icon_style(icon_data)">{{ icon_data.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row align-c jc-sb">
|
||||
<div class="flex-row align-c nowrap">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-10 flex">
|
||||
<!-- <img class="original-price-left" :src="form.static_img[0].url" /> -->
|
||||
<span :class="['original-price text-line-1', { 'flex-1': form.is_price_solo == '1' }]" :style="trends_config('original_price')">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
<swiper-slide v-for="(item, index) in list" :key="index">
|
||||
<div :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['0', '4'].includes(theme) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${theme}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
<image-empty v-model="item.images" :class="`flex-img${theme}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('plugins_view_icon') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col flex-1 jc-sb content gap-10" :style="content_style">
|
||||
<div class="flex-col gap-10 top-title">
|
||||
<div v-if="is_show('title') || (['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc'))" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :class="text_line" :style="trends_config('title', 'title')">{{ item.title }}</div>
|
||||
<div v-if="['0', '1', '2', '3', '5'].includes(theme) && is_show('simple_desc')" :class="form.simple_desc_row == '2' ? 'text-line-2' : 'text-line-1'" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('plugins_view_icon') && !isEmpty(item.plugins_view_icon_data)" class="flex-row gap-5 align-c">
|
||||
<div v-for="(icon_data, icon_index) in item.plugins_view_icon_data" :key="icon_index" class="radius-sm size-9 pl-3 pr-3" :style="icon_style(icon_data)">{{ icon_data.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row align-c jc-sb">
|
||||
<div class="flex-row align-c nowrap">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="show_content && is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-10 flex">
|
||||
<!-- <img class="original-price-left" :src="form.static_img[0].url" /> -->
|
||||
<span :class="['original-price text-line-1', { 'flex-1': form.is_price_solo == '1' }]" :style="trends_config('original_price')">{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -163,7 +165,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { common_img_computer, common_styles_computer, get_math, gradient_handle, padding_computer, radius_computer, background_computer, border_computer, box_shadow_computer, margin_computer } from '@/utils';
|
||||
import { common_img_computer, common_styles_computer, get_math, gradient_handle, padding_computer, radius_computer, background_computer, border_computer, box_shadow_computer, margin_computer, old_margin } from '@/utils';
|
||||
import { isEmpty, cloneDeep, throttle } from 'lodash';
|
||||
import ShopAPI from '@/api/shop';
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
@ -317,10 +319,14 @@ const content_padding = computed(() => padding_computer(new_style.value.shop_pad
|
||||
const theme = computed(() => form.value.theme);
|
||||
// 商品间距
|
||||
const content_outer_spacing = computed(() => new_style.value.content_outer_spacing);
|
||||
const shop_left_right_width_margin = computed(() => {
|
||||
const { shop_margin = old_margin } = new_style.value;
|
||||
return shop_margin.margin_left + shop_margin.margin_right;
|
||||
});
|
||||
// 两列风格
|
||||
const two_columns = computed(() => content_outer_spacing.value + 'px');
|
||||
const two_columns = computed(() => content_outer_spacing.value + shop_left_right_width_margin.value * 2 + 'px' );
|
||||
// 三列风格
|
||||
const three_columns = computed(() => content_outer_spacing.value * 2 + 'px');
|
||||
const three_columns = computed(() => (content_outer_spacing.value * 2) + (shop_left_right_width_margin.value * 3) + 'px');
|
||||
|
||||
// 最外层不同风格下的显示
|
||||
const outer_class = computed(() => {
|
||||
@ -468,7 +474,7 @@ const style_img_container = computed(() => {
|
||||
const multicolumn_columns_width = computed(() => {
|
||||
const { carousel_col } = toRefs(form.value);
|
||||
// 计算间隔的空间。(gap * gap数量) / 模块数量
|
||||
let gap = (new_style.value.content_outer_spacing * (carousel_col.value - 1)) / carousel_col.value;
|
||||
let gap = ((content_outer_spacing.value * (carousel_col.value - 1)) + (shop_left_right_width_margin.value * carousel_col.value) / carousel_col.value);
|
||||
return `calc(${100 / carousel_col.value}% - ${gap}px)`;
|
||||
});
|
||||
const content_outer_height = computed(() => new_style.value.content_outer_height + 'px');
|
||||
@ -557,8 +563,6 @@ watchEffect(() => {
|
||||
width: calc((100% - v-bind(three_columns)) / 3);
|
||||
}
|
||||
.multicolumn-columns {
|
||||
width: v-bind(multicolumn_columns_width);
|
||||
min-width: v-bind(multicolumn_columns_width);
|
||||
height: v-bind(content_outer_height);
|
||||
}
|
||||
.flex-img0 {
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { pick } from 'lodash';
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
|
||||
@ -36,142 +36,148 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="form.shop_style_type != '3'">
|
||||
<div class="flex flex-wrap" :style="`gap: ${content_outer_spacing}px;`">
|
||||
<div v-for="(item, index) in list" :key="index" :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['1'].includes(shop_style_type) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${shop_style_type}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
<div class="oh" :style="shop_container">
|
||||
<div class="oh" :style="shop_img_container">
|
||||
<template v-if="form.shop_style_type != '3'">
|
||||
<div class="flex flex-wrap" :style="`gap: ${content_outer_spacing}px;`">
|
||||
<div v-for="(item, index) in list" :key="index" :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['1'].includes(shop_style_type) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re" :class="`flex-img${shop_style_type}`">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col gap-10 w flex-1 jc-sb oh" :style="content_style">
|
||||
<div class="flex-col gap-10 w">
|
||||
<!-- 标题 -->
|
||||
<div v-if="is_show('title') || is_show('simple_desc')" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :style="trends_config('title', 'title')" class="text-line-2">{{ item.title }}</div>
|
||||
<div v-if="is_show('simple_desc')" class="text-line-1" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<!-- 进度条 -->
|
||||
<!-- <div v-if="form.shop_style_type == '1'" class="flex-row align-c gap-6">
|
||||
<div class="re flex-1">
|
||||
<div class="slide-bottom" :style="`background: ${new_style.progress_bg_color}`"></div>
|
||||
<div class="slide-top" :style="` width: 51%; ${slide_active_color}`">
|
||||
<div class="slide-top-icon round" :style="`background: ${new_style.progress_button_color}`"><icon name="a-miaosha" :color="new_style.progress_button_icon_color" size="9"></icon></div>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col gap-10 w flex-1 jc-sb oh" :style="content_style">
|
||||
<div class="flex-col gap-10 w">
|
||||
<!-- 标题 -->
|
||||
<div v-if="is_show('title') || is_show('simple_desc')" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :style="trends_config('title', 'title')" class="text-line-2">{{ item.title }}</div>
|
||||
<div v-if="is_show('simple_desc')" class="text-line-1" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<!-- 进度条 -->
|
||||
<!-- <div v-if="form.shop_style_type == '1'" class="flex-row align-c gap-6">
|
||||
<div class="re flex-1">
|
||||
<div class="slide-bottom" :style="`background: ${new_style.progress_bg_color}`"></div>
|
||||
<div class="slide-top" :style="` width: 51%; ${slide_active_color}`">
|
||||
<div class="slide-top-icon round" :style="`background: ${new_style.progress_button_color}`"><icon name="a-miaosha" :color="new_style.progress_button_icon_color" size="9"></icon></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="size-10" :style="`color: ${new_style.progress_text_color}`">已抢51%</span>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="flex-row align-e gap-10 jc-sb">
|
||||
<div class="flex-col gap-5">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span v-if="form.shop_style_type == '1'" class="size-10 pr-4">{{ form.seckill_pirce_title }}</span>
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-11 flex" :style="trends_config('original_price')">
|
||||
<span class="original-price text-line-1 flex-1"
|
||||
>{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<span class="size-10" :style="`color: ${new_style.progress_text_color}`">已抢51%</span>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="flex-row align-e gap-10 jc-sb">
|
||||
<div class="flex-col gap-5">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="`color: ${new_style.shop_price_color}`">
|
||||
<span v-if="form.shop_style_type == '1'" class="size-10 pr-4">{{ form.seckill_pirce_title }}</span>
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-11 flex" :style="trends_config('original_price')">
|
||||
<span class="original-price text-line-1 flex-1"
|
||||
>{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<swiper :key="carouselKey" class="w flex" direction="horizontal" :loop="true" :autoplay="autoplay" :slides-per-view="form.carousel_col" :slides-per-group="slides_per_group" :allow-touch-move="false" :space-between="content_outer_spacing" :pause-on-mouse-enter="true" :modules="modules">
|
||||
<swiper-slide v-for="(item, index) in list" :key="index">
|
||||
<div :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['1'].includes(shop_style_type) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re w h">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col gap-10 w flex-1 jc-sb" :style="content_style">
|
||||
<div class="flex-col gap-10 w">
|
||||
<!-- 标题 -->
|
||||
<div v-if="is_show('title') || is_show('simple_desc')" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :style="trends_config('title', 'title')" class="text-line-2">{{ item.title }}</div>
|
||||
<div v-if="is_show('simple_desc')" class="text-line-1" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<!-- 进度条 -->
|
||||
<div v-if="form.shop_style_type == '1'" class="flex-row align-c gap-6">
|
||||
<div class="re flex-1">
|
||||
<div class="slide-bottom" :style="`background: ${new_style.progress_bg_color}`"></div>
|
||||
<div class="slide-top" :style="` width: 51%; ${slide_active_color}`">
|
||||
<div class="slide-top-icon round" :style="`background: ${new_style.progress_button_color}`"><icon name="a-miaosha" :color="new_style.progress_button_icon_color" size="9"></icon></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="size-10" :style="`color: ${new_style.progress_text_color}`">已抢51%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row align-e gap-10 jc-sb">
|
||||
<div class="flex-col gap-5">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="trends_config('original_price')">
|
||||
<span v-if="form.shop_style_type == '1'" class="size-10 pr-4">{{ form.seckill_pirce_title }}</span>
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-11 flex" :style="`color: ${new_style.original_price_color}`">
|
||||
<span class="original-price text-line-1 flex-1"
|
||||
>{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
</swiper>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<swiper :key="carouselKey" class="w flex" direction="horizontal" :loop="true" :autoplay="autoplay" :slides-per-view="form.carousel_col" :slides-per-group="slides_per_group" :allow-touch-move="false" :space-between="content_outer_spacing" :pause-on-mouse-enter="true" :modules="modules">
|
||||
<swiper-slide v-for="(item, index) in list" :key="index" :class="layout_type" :style="layout_style">
|
||||
<div :class="['oh w h', ['1'].includes(shop_style_type) ? 'flex-row' : 'flex-col' ]" :style="layout_img_style">
|
||||
<template v-if="!isEmpty(item)">
|
||||
<div class="oh re w h">
|
||||
<template v-if="!isEmpty(item.new_cover)">
|
||||
<image-empty v-model="item.new_cover[0]" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image-empty v-model="item.images" :class="`flex-img${shop_style_type}`" :style="content_img_radius"></image-empty>
|
||||
</template>
|
||||
<!-- 角标 -->
|
||||
<subscript-index :value="props.value"></subscript-index>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="is_show('title') || is_show('simple_desc') || is_show('price') || is_show('original_price') || form.is_shop_show == '1'" class="flex-col gap-10 w flex-1 jc-sb" :style="content_style">
|
||||
<div class="flex-col gap-10 w">
|
||||
<!-- 标题 -->
|
||||
<div v-if="is_show('title') || is_show('simple_desc')" class="flex-col" :style="`gap: ${ new_style.title_simple_desc_spacing }px;`">
|
||||
<div v-if="is_show('title')" :style="trends_config('title', 'title')" class="text-line-2">{{ item.title }}</div>
|
||||
<div v-if="is_show('simple_desc')" class="text-line-1" :style="trends_config('simple_desc', 'desc')">{{ item.simple_desc }}</div>
|
||||
</div>
|
||||
<!-- 进度条 -->
|
||||
<div v-if="form.shop_style_type == '1'" class="flex-row align-c gap-6">
|
||||
<div class="re flex-1">
|
||||
<div class="slide-bottom" :style="`background: ${new_style.progress_bg_color}`"></div>
|
||||
<div class="slide-top" :style="` width: 51%; ${slide_active_color}`">
|
||||
<div class="slide-top-icon round" :style="`background: ${new_style.progress_button_color}`"><icon name="a-miaosha" :color="new_style.progress_button_icon_color" size="9"></icon></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="size-10" :style="`color: ${new_style.progress_text_color}`">已抢51%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-row align-e gap-10 jc-sb">
|
||||
<div class="flex-col gap-5">
|
||||
<div v-if="is_show('price') && (!isEmpty(item.min_price) || typeof item.min_price == 'number')" class="num" :style="trends_config('original_price')">
|
||||
<span v-if="form.shop_style_type == '1'" class="size-10 pr-4">{{ form.seckill_pirce_title }}</span>
|
||||
<span :style="trends_config('price_symbol')">{{ item.show_price_symbol }}</span
|
||||
><span :style="trends_config('price')">{{ item.min_price }}</span>
|
||||
<span v-if="is_show('price_unit')" :style="trends_config('price_unit')">{{ item.show_price_unit }}</span>
|
||||
</div>
|
||||
<div v-if="is_show('original_price') && (!isEmpty(item.min_original_price) || typeof item.min_original_price == 'number')" class="size-11 flex" :style="`color: ${new_style.original_price_color}`">
|
||||
<span class="original-price text-line-1 flex-1"
|
||||
>{{ item.show_original_price_symbol }}{{ item.min_original_price }}
|
||||
<template v-if="is_show('original_price_unit')">
|
||||
{{ item.show_original_price_unit }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.is_shop_show == '1'">
|
||||
<template v-if="form.shop_type == 'text'">
|
||||
<div class="plr-11 ptb-3 round cr-f" :style="trends_config('button', 'gradient') + `color: ${new_style.shop_button_text_color};`">{{ form.shop_button_text }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<icon class="round plr-6 ptb-5" :name="!isEmpty(form.shop_button_icon_class) ? form.shop_button_icon_class : 'cart'" :color="new_style.shop_icon_color" :size="new_style.shop_icon_size + ''" :styles="button_gradient()"></icon>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
</swiper>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { background_computer, common_styles_computer, get_math, gradient_computer, gradient_handle, padding_computer, radius_computer, common_img_computer } from '@/utils';
|
||||
import { background_computer, common_styles_computer, get_math, gradient_computer, gradient_handle, padding_computer, radius_computer, common_img_computer, margin_computer, old_margin, box_shadow_computer, border_computer, old_border_and_box_shadow, old_radius, old_padding } from '@/utils';
|
||||
import { isEmpty, throttle } from 'lodash';
|
||||
import SeckillAPI from '@/api/seckill';
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
@ -210,10 +216,10 @@ const slide_active_color = computed(() => {
|
||||
|
||||
const seckill_head_style = computed(() => {
|
||||
let style = ``;
|
||||
const { header_background_color_list, header_background_direction, seckill_head_radius } = new_style.value;
|
||||
const { header_background_color_list, header_background_direction, seckill_head_radius, seckill_head_margin = old_margin, seckill_head_style = old_border_and_box_shadow } = new_style.value;
|
||||
// 渐变
|
||||
const gradient = { color_list: header_background_color_list, direction: header_background_direction };
|
||||
style += gradient_computer(gradient) + radius_computer(seckill_head_radius);
|
||||
style += gradient_computer(gradient) + radius_computer(seckill_head_radius) + margin_computer(seckill_head_margin) + box_shadow_computer(seckill_head_style) + border_computer(seckill_head_style);
|
||||
return style;
|
||||
});
|
||||
|
||||
@ -227,6 +233,20 @@ const seckill_head_img_style = computed(() => {
|
||||
style += background_computer(back) + padding_computer(padding);
|
||||
return style;
|
||||
});
|
||||
// 商品内容区域显示
|
||||
const shop_container = computed(() => {
|
||||
const { shop_content_color_list = [], shop_content_direction = '', shop_content_radius = old_radius, shop_content_margin = old_margin, shop_content = old_border_and_box_shadow } = new_style.value;
|
||||
// 渐变
|
||||
const gradient = { color_list: shop_content_color_list, direction: shop_content_direction };
|
||||
return gradient_computer(gradient) + radius_computer(shop_content_radius) + margin_computer(shop_content_margin) + border_computer(shop_content) + box_shadow_computer(shop_content);
|
||||
});
|
||||
|
||||
const shop_img_container = computed(() => {
|
||||
const { shop_content_background_img_style = '2', shop_content_background_img = [], shop_content_padding = old_padding } = new_style.value;
|
||||
// 背景图
|
||||
const back = { background_img: shop_content_background_img, background_img_style: shop_content_background_img_style };
|
||||
return padding_computer(shop_content_padding) + background_computer(back);
|
||||
});
|
||||
//#endregion
|
||||
const style = computed(() => common_styles_computer(props.value.style.common_style));
|
||||
const style_img_container = computed(() => common_img_computer(props.value.style.common_style));
|
||||
@ -415,8 +435,9 @@ const layout_type = computed(() => {
|
||||
// 容器样式
|
||||
const layout_style = computed(() => {
|
||||
const radius = content_radius.value;
|
||||
const gradient = gradient_handle(new_style.value.shop_color_list, new_style.value.shop_direction);
|
||||
return `${radius} ${ gradient }`;
|
||||
const { shop_style = old_border_and_box_shadow, shop_color_list = [], shop_direction = '', shop_margin = old_margin } = new_style.value;
|
||||
const style = gradient_handle(shop_color_list, shop_direction) + margin_computer(shop_margin) + border_computer(shop_style) + box_shadow_computer(shop_style);
|
||||
return `${radius} ${ style }`;
|
||||
});
|
||||
// 容器图片样式
|
||||
const layout_img_style = computed(() => {
|
||||
@ -485,6 +506,10 @@ const button_gradient = () => {
|
||||
return gradient_handle(new_style.value.shop_button_color, '180deg');
|
||||
};
|
||||
//#endregion
|
||||
const shop_left_right_width_margin = computed(() => {
|
||||
const { shop_margin = old_margin } = new_style.value;
|
||||
return shop_margin.margin_left + shop_margin.margin_right;
|
||||
});
|
||||
// 不换行显示
|
||||
const multicolumn_columns_width = computed(() => {
|
||||
const { carousel_col } = toRefs(form.value);
|
||||
@ -495,7 +520,7 @@ const multicolumn_columns_width = computed(() => {
|
||||
model_number = 2;
|
||||
}
|
||||
// 计算间隔的空间。(gap * gap数量) / 模块数量
|
||||
let gap = (new_style.value.content_outer_spacing * (model_number - 1)) / model_number;
|
||||
let gap = ((new_style.value.content_outer_spacing * (model_number - 1)) + (shop_left_right_width_margin.value * model_number) / model_number);
|
||||
return `calc(${100 / model_number}% - ${gap}px)`;
|
||||
});
|
||||
// 判断是否显示对应的内容
|
||||
|
||||
@ -25,12 +25,39 @@
|
||||
<el-form-item label="圆角">
|
||||
<radius :value="form.seckill_head_radius"></radius>
|
||||
</el-form-item>
|
||||
<el-form-item label="外间距">
|
||||
<margin :value="form.seckill_head_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :value="form.seckill_head_padding"></padding>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.seckill_head_style.border_is_show" v-model:color="form.seckill_head_style.border_color" v-model:style="form.seckill_head_style.border_style" v-model:size="form.seckill_head_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.seckill_head_style"></shadow-config>
|
||||
</card-container>
|
||||
<div class="divider-line"></div>
|
||||
</template>
|
||||
<card-container>
|
||||
<div class="mb-12">内容样式</div>
|
||||
<el-form-item label="内容背景">
|
||||
<background-common v-model:color_list="form.shop_content_color_list" v-model:direction="form.shop_content_direction" v-model:img_style="form.shop_content_background_img_style" v-model:img="form.shop_content_background_img" @mult_color_picker_event="shop_content_mult_color_picker_event" />
|
||||
</el-form-item>
|
||||
<el-form-item label="圆角">
|
||||
<radius :value="form.shop_content_radius"></radius>
|
||||
</el-form-item>
|
||||
<el-form-item label="外间距">
|
||||
<margin :value="form.shop_content_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :value="form.shop_content_padding"></padding>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.shop_content.border_is_show" v-model:color="form.shop_content.border_color" v-model:style="form.shop_content.border_style" v-model:size="form.shop_content.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.shop_content"></shadow-config>
|
||||
</card-container>
|
||||
<div class="divider-line"></div>
|
||||
<card-container>
|
||||
<div class="mb-12">商品样式</div>
|
||||
<el-form-item label="商品背景">
|
||||
@ -76,6 +103,9 @@
|
||||
<slider v-model="form.content_outer_height" :max="1000"></slider>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="外间距">
|
||||
<margin :value="form.shop_margin"></margin>
|
||||
</el-form-item>
|
||||
<el-form-item label="内间距">
|
||||
<padding :value="form.shop_padding"></padding>
|
||||
</el-form-item>
|
||||
@ -88,6 +118,10 @@
|
||||
<el-form-item label="图片圆角">
|
||||
<radius :value="form.shop_img_radius"></radius>
|
||||
</el-form-item>
|
||||
<!-- 边框处理 -->
|
||||
<border-config v-model:show="form.shop_style.border_is_show" v-model:color="form.shop_style.border_color" v-model:style="form.shop_style.border_style" v-model:size="form.shop_style.border_size"></border-config>
|
||||
<!-- 阴影配置 -->
|
||||
<shadow-config v-model="form.shop_style"></shadow-config>
|
||||
<template v-if="data.shop_style_type !== '3'">
|
||||
<el-form-item v-if="data.shop_style_type == '1'" label="图片宽度">
|
||||
<slider v-model="form.content_img_width" :max="1000"></slider>
|
||||
@ -215,15 +249,15 @@ const countdown_color_picker_event = (arry: color_list[], type: number) => {
|
||||
form.value.countdown_bg_color_list = arry;
|
||||
form.value.countdown_direction = type.toString();
|
||||
};
|
||||
const shop_content_mult_color_picker_event = (arry: color_list[], type: number) => {
|
||||
form.value.shop_content_color_list = arry;
|
||||
form.value.shop_content_direction = type.toString();
|
||||
};
|
||||
// 商品背景渐变设置
|
||||
const shop_mult_color_picker_event = (arry: color_list[], type: number) => {
|
||||
form.value.shop_color_list = arry;
|
||||
form.value.shop_direction = type.toString();
|
||||
};
|
||||
// 商品背景图片设置
|
||||
const shop_background_img_change = (arry: uploadList[]) => {
|
||||
form.value.shop_background_img = arry;
|
||||
};
|
||||
// 进度条选中的设置
|
||||
// const progress_color_picker_event = (arry: color_list[], type: number) => {
|
||||
// form.value.progress_actived_color_list = arry;
|
||||
|
||||
@ -176,6 +176,23 @@ const defaultSearch: defaultSearch = {
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
data_content_style: {
|
||||
color_list: [{ color: '', color_percentage: undefined }],
|
||||
@ -197,6 +214,23 @@ const defaultSearch: defaultSearch = {
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
row_gap: 0,
|
||||
column_gap: 0,
|
||||
|
||||
@ -17,6 +17,23 @@ interface defaultSearch {
|
||||
style: {
|
||||
image_spacing: number;
|
||||
data_radius: object;
|
||||
direction: string,
|
||||
color_list: color_list[],
|
||||
background_img_style: string,
|
||||
background_img: uploadList[],
|
||||
margin: marginStyle,
|
||||
padding: paddingStyle,
|
||||
// 边框样式
|
||||
border_is_show: string,
|
||||
border_color: string,
|
||||
border_style: string,
|
||||
border_size: paddingStyle,
|
||||
// 阴影
|
||||
box_shadow_color: string,
|
||||
box_shadow_x: number,
|
||||
box_shadow_y: number,
|
||||
box_shadow_blur: number,
|
||||
box_shadow_spread: number,
|
||||
common_style: object;
|
||||
};
|
||||
}
|
||||
@ -45,6 +62,41 @@ const defaultSearch: defaultSearch = {
|
||||
},
|
||||
// 图片间距
|
||||
image_spacing: 2,
|
||||
direction: '90deg',
|
||||
color_list: [{ color: '', color_percentage: undefined }],
|
||||
background_img_style: '0',
|
||||
background_img: [],
|
||||
margin: {
|
||||
margin_top: 0,
|
||||
margin_right: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin: 0
|
||||
},
|
||||
padding: {
|
||||
padding: 0,
|
||||
padding_top: 0,
|
||||
padding_right: 0,
|
||||
padding_bottom: 0,
|
||||
padding_left: 0,
|
||||
},
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
// 公共样式
|
||||
common_style: defaultCommon,
|
||||
},
|
||||
|
||||
@ -41,19 +41,32 @@ interface DefaultSeckill {
|
||||
header_background_img_style: string;
|
||||
header_background_img: uploadList[];
|
||||
seckill_head_radius: radiusStyle;
|
||||
seckill_head_margin: marginStyle;
|
||||
seckill_head_padding: paddingStyle;
|
||||
seckill_head_style: object;
|
||||
shop_direction: string,
|
||||
shop_color_list: color_list[],
|
||||
shop_background_img_style: string,
|
||||
shop_background_img: uploadList[],
|
||||
shop_radius: radiusStyle;
|
||||
shop_img_radius: radiusStyle;
|
||||
shop_margin: marginStyle;
|
||||
shop_padding: paddingStyle;
|
||||
shop_style: object;
|
||||
content_outer_spacing: number;
|
||||
content_spacing: number;
|
||||
content_outer_height: number;
|
||||
content_img_width: number | undefined;
|
||||
content_img_height: number | undefined;
|
||||
shop_content_direction: string;
|
||||
shop_content_color_list: color_list[];
|
||||
shop_content_background_img_style: string;
|
||||
shop_content_background_img: string[];
|
||||
shop_content_radius: radiusStyle;
|
||||
shop_content_margin: marginStyle;
|
||||
shop_content_padding: paddingStyle;
|
||||
shop_content_spacing: number;
|
||||
shop_content: object;
|
||||
shop_title_color: string;
|
||||
shop_title_typeface: string;
|
||||
shop_title_size: number;
|
||||
@ -145,6 +158,13 @@ const defaultSeckill: DefaultSeckill = {
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
},
|
||||
seckill_head_margin: {
|
||||
margin: 0,
|
||||
margin_top: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
},
|
||||
// 头部内边距
|
||||
seckill_head_padding: {
|
||||
padding: 0,
|
||||
@ -153,6 +173,25 @@ const defaultSeckill: DefaultSeckill = {
|
||||
padding_left: 13,
|
||||
padding_right: 13,
|
||||
},
|
||||
seckill_head_style: {
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
shop_direction: '90deg',
|
||||
shop_color_list: [{ color: '#fff', color_percentage: undefined }],
|
||||
shop_background_img_style: '0',
|
||||
@ -173,6 +212,13 @@ const defaultSeckill: DefaultSeckill = {
|
||||
radius_bottom_left: 4,
|
||||
radius_bottom_right: 4,
|
||||
},
|
||||
shop_margin: {
|
||||
margin: 0,
|
||||
margin_top: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
},
|
||||
// 商品间距
|
||||
shop_padding: {
|
||||
padding: 10,
|
||||
@ -181,6 +227,25 @@ const defaultSeckill: DefaultSeckill = {
|
||||
padding_left: 10,
|
||||
padding_right: 10,
|
||||
},
|
||||
shop_style: {
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
content_outer_spacing: 10, // 商品外间距
|
||||
// 商品内间距
|
||||
content_spacing: 10,
|
||||
@ -188,6 +253,52 @@ const defaultSeckill: DefaultSeckill = {
|
||||
content_outer_height: 232,
|
||||
content_img_width: undefined,
|
||||
content_img_height: undefined,
|
||||
// 商品内容设置
|
||||
shop_content_direction: '90deg',
|
||||
shop_content_color_list: [{ color: '', color_percentage: undefined }],
|
||||
shop_content_background_img_style: '2',
|
||||
shop_content_background_img: [],
|
||||
shop_content_radius: {
|
||||
radius: 0,
|
||||
radius_top_left: 0,
|
||||
radius_top_right: 0,
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
},
|
||||
shop_content_margin: {
|
||||
margin: 0,
|
||||
margin_top: 0,
|
||||
margin_bottom: 0,
|
||||
margin_left: 0,
|
||||
margin_right: 0,
|
||||
},
|
||||
shop_content_padding: {
|
||||
padding: 0,
|
||||
padding_top: 0,
|
||||
padding_bottom: 10,
|
||||
padding_left: 10,
|
||||
padding_right: 10,
|
||||
},
|
||||
shop_content_spacing: 0,
|
||||
shop_content: {
|
||||
// 边框样式
|
||||
border_is_show: '0',
|
||||
border_color: '#FF3F3F',
|
||||
border_style: 'solid',
|
||||
border_size: {
|
||||
padding: 1,
|
||||
padding_top: 1,
|
||||
padding_right: 1,
|
||||
padding_bottom: 1,
|
||||
padding_left: 1,
|
||||
},
|
||||
// 阴影
|
||||
box_shadow_color: '',
|
||||
box_shadow_x: 0,
|
||||
box_shadow_y: 0,
|
||||
box_shadow_blur: 0,
|
||||
box_shadow_spread: 0,
|
||||
},
|
||||
shop_title_typeface: '500',
|
||||
shop_title_size: 14,
|
||||
shop_title_color: '#333333',
|
||||
|
||||
1
src/types/global.d.ts
vendored
1
src/types/global.d.ts
vendored
@ -80,6 +80,7 @@ declare global {
|
||||
background_img_style: string;
|
||||
};
|
||||
|
||||
type border_style = { border_is_show: string, border_color: string, border_style: string, border_size: paddingStyle };
|
||||
/**
|
||||
* 通用样式参数
|
||||
*/
|
||||
|
||||
@ -2,6 +2,11 @@ import CommonAPI from '@/api/common';
|
||||
// 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色
|
||||
// 这些颜色包括从白色到黑色的不同灰度,以及一些鲜艳的颜色,格式有十六进制、RGB、RGBA、HSV、HSL等
|
||||
export const predefine_colors = ['#fff', '#ddd', '#ccc', '#999', '#666', '#333', '#000', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#00ced1', '#c71585', 'rgba(255, 69, 0, 0.68)', 'rgb(255, 120, 0)', 'hsv(51, 100, 98)', 'hsva(120, 40, 94, 0.5)', 'hsl(181, 100%, 37%)', '#1F93FF', '#c7158577'];
|
||||
// 数据的默认值,避免没有值的时候报错
|
||||
export const old_radius = { radius: 0, radius_top_left: 0, radius_top_right: 0, radius_bottom_left: 0, radius_bottom_right: 0 };
|
||||
export const old_padding = { padding: 0, padding_top: 0, padding_bottom: 0, padding_left: 0, padding_right: 0 };
|
||||
export const old_margin = { margin: 0, margin_top: 0, margin_bottom: 0, margin_left: 0, margin_right: 0 };
|
||||
export const old_border_and_box_shadow = { border_is_show: '0', border_color: '#FF3F3F', border_style: 'solid',border_size: { padding: 1, padding_top: 1, padding_right: 1, padding_bottom: 1, padding_left: 1, }, box_shadow_color: '', box_shadow_x: 0, box_shadow_y: 0, box_shadow_blur: 0, box_shadow_spread: 0 };
|
||||
/**
|
||||
* 判断一个对象是否为空。
|
||||
*
|
||||
@ -130,6 +135,17 @@ export function convert_strings_to_numbers(obj: any, maxDepth: number = 100, cur
|
||||
}
|
||||
}
|
||||
|
||||
type PaddingStyle = { padding_left: number; padding_right: number;};
|
||||
|
||||
type BorderStyle = { border_is_show: boolean; border_size?: PaddingStyle; };
|
||||
|
||||
export const border_width = (style: BorderStyle): number => {
|
||||
if (!style) { return 0; }
|
||||
if (!style.border_is_show) { return 0; }
|
||||
const { padding_left = 0, padding_right = 0 } = style.border_size || {};
|
||||
return padding_left + padding_right;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查给定的参数是否为对象
|
||||
*
|
||||
@ -294,7 +310,7 @@ export function background_computer(new_style: backgroundImgUrlStyle) {
|
||||
}
|
||||
}
|
||||
|
||||
export const border_computer = (new_style: componentsCommonCommonStyle) => {
|
||||
export const border_computer = (new_style: border_style) => {
|
||||
const { border_is_show = '0', border_color = '', border_style = 'solid', border_size = { padding: 0, padding_bottom: 0, padding_left: 0, padding_right: 0, padding_top: 0 } } = new_style;
|
||||
if (border_is_show == '1') {
|
||||
return `border-width: ${border_size.padding_top}px ${border_size.padding_right}px ${border_size.padding_bottom}px ${border_size.padding_left}px;border-style: ${ border_style };border-color: ${border_color};`
|
||||
|
||||
Reference in New Issue
Block a user