修改图片显示逻辑

v1.0.0
于肖磊 2024-10-16 16:40:44 +08:00
parent e6eb2411bf
commit 0ec6d1e632
9 changed files with 36 additions and 10 deletions

View File

@ -14,7 +14,7 @@
<el-form-item label="图片设置"> <el-form-item label="图片设置">
<el-radio-group v-model="form.img_fit"> <el-radio-group v-model="form.img_fit">
<el-radio value="contain">等比缩放</el-radio> <el-radio value="contain">等比缩放</el-radio>
<el-radio value="none">铺满</el-radio> <el-radio value="fill">铺满</el-radio>
<el-radio value="cover">等比剪切</el-radio> <el-radio value="cover">等比剪切</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>

View File

@ -18,7 +18,7 @@
<el-form-item label="图片设置"> <el-form-item label="图片设置">
<el-radio-group v-model="form.img_fit"> <el-radio-group v-model="form.img_fit">
<el-radio value="contain">等比缩放</el-radio> <el-radio value="contain">等比缩放</el-radio>
<el-radio value="none">铺满</el-radio> <el-radio value="fill">铺满</el-radio>
<el-radio value="cover">等比剪切</el-radio> <el-radio value="cover">等比剪切</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>

View File

@ -19,10 +19,17 @@
</div> </div>
</template> </template>
<template v-else-if="form.style_actived == 10"> <template v-else-if="form.style_actived == 10">
<template v-if="form.limit_size == '0'">
<div v-for="(item, index) in form.img_magic_list" :key="index" :class="['img-spacing-border', { 'h': item.img.length > 0, 'style_actived_10': item.img.length == 0 }]" :style="selected_style(item)"> <div v-for="(item, index) in form.img_magic_list" :key="index" :class="['img-spacing-border', { 'h': item.img.length > 0, 'style_actived_10': item.img.length == 0 }]" :style="selected_style(item)">
<image-empty v-model="item.img[0]" :style="content_img_radius"></image-empty> <image-empty v-model="item.img[0]" :style="content_img_radius" fit="contain"></image-empty>
</div> </div>
</template> </template>
<template v-else>
<div v-for="(item, index) in form.img_magic_list" :key="index" class="img-spacing-border" :style="`${ selected_style(item) };height: ${ new_style.image_height }px;`">
<image-empty v-model="item.img[0]" :style="content_img_radius" fit="contain"></image-empty>
</div>
</template>
</template>
<template v-else> <template v-else>
<div v-for="(item, index) in form.img_magic_list" :key="index" class="cube-selected img-spacing-border" :style="selected_style(item)"> <div v-for="(item, index) in form.img_magic_list" :key="index" class="cube-selected img-spacing-border" :style="selected_style(item)">
<image-empty v-model="item.img[0]" :style="content_img_radius" :fit="form.img_fit"></image-empty> <image-empty v-model="item.img[0]" :style="content_img_radius" :fit="form.img_fit"></image-empty>

View File

@ -13,7 +13,7 @@
<el-form-item v-if="form.style_actived !== 10" label="图片设置"> <el-form-item v-if="form.style_actived !== 10" label="图片设置">
<el-radio-group v-model="form.img_fit"> <el-radio-group v-model="form.img_fit">
<el-radio value="contain">等比缩放</el-radio> <el-radio value="contain">等比缩放</el-radio>
<el-radio value="none">铺满</el-radio> <el-radio value="fill">铺满</el-radio>
<el-radio value="cover">等比剪切</el-radio> <el-radio value="cover">等比剪切</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>

View File

@ -9,6 +9,14 @@
<el-form-item label="图片圆角"> <el-form-item label="图片圆角">
<radius :value="form" @update:value="radius_change"></radius> <radius :value="form" @update:value="radius_change"></radius>
</el-form-item> </el-form-item>
<template v-if="new_content.style_actived === 10">
<el-form-item label="限制尺寸">
<el-switch v-model="form.limit_size" active-value="1" inactive-value="0" />
</el-form-item>
<el-form-item v-if="form.limit_size == '1'" label="图片高度">
<slider v-model="form.image_height" :max="500"></slider>
</el-form-item>
</template>
</card-container> </card-container>
</el-form> </el-form>
<div class="bg-f5 divider-line" /> <div class="bg-f5 divider-line" />

View File

@ -10,7 +10,7 @@
<template v-else-if="!isEmpty(form.icon_class)"> <template v-else-if="!isEmpty(form.icon_class)">
<icon :name="form.icon_class" :size="new_style.icon_size + ''" :color="new_style.icon_color"></icon> <icon :name="form.icon_class" :size="new_style.icon_size + ''" :color="new_style.icon_color"></icon>
</template> </template>
<div class="pr-15 nowrap" :style="title_style">{{ form.title || '标题' }}</div> <div class="pr-15 nowrap" :style="title_style">{{ form.title }}</div>
</div> </div>
<div class="flex-row gap-10 align-c right-0 abs"> <div class="flex-row gap-10 align-c right-0 abs">
<template v-if="form.keyword_show == '1'"> <template v-if="form.keyword_show == '1'">
@ -84,6 +84,7 @@ const keyword_style = computed(() => {
const right_style = computed(() => { const right_style = computed(() => {
return `color:${new_style.value.right_color}; font-size: ${new_style.value.right_size}px;`; return `color:${new_style.value.right_color}; font-size: ${new_style.value.right_size}px;`;
}); });
const title_img_height = computed(() => new_style.value.img_height + 'px');
// //
const style_container = computed(() => common_styles_computer(new_style.value.common_style)); const style_container = computed(() => common_styles_computer(new_style.value.common_style));
const style_img_container = computed(() => common_img_computer(new_style.value.common_style)); const style_img_container = computed(() => common_img_computer(new_style.value.common_style));
@ -99,7 +100,8 @@ const style_img_container = computed(() => common_img_computer(new_style.value.c
word-wrap: break-word; word-wrap: break-word;
} }
.title-img { .title-img {
max-width: 6rem; // max-width: 6rem;
max-height: 3rem; // max-height: 3rem;
height: v-bind(title_img_height);
} }
</style> </style>

View File

@ -28,6 +28,9 @@
<slider v-model="form.title_size" :max="100"></slider> <slider v-model="form.title_size" :max="100"></slider>
</el-form-item> </el-form-item>
</el-form-item> </el-form-item>
<el-form-item label="图片高度">
<slider v-model="form.img_height" :max="500"></slider>
</el-form-item>
</card-container> </card-container>
<template v-if="!isEmpty(content.subtitle)"> <template v-if="!isEmpty(content.subtitle)">
<div class="bg-f5 divider-line" /> <div class="bg-f5 divider-line" />

View File

@ -19,6 +19,8 @@ interface defaultSearch {
radius_bottom_left: number; radius_bottom_left: number;
radius_bottom_right: number; radius_bottom_right: number;
image_spacing: number; image_spacing: number;
limit_size: boolean,
image_height: number;
common_style: object; common_style: object;
}; };
} }
@ -49,6 +51,8 @@ const defaultSearch: defaultSearch = {
radius_bottom_left: 0, radius_bottom_left: 0,
radius_bottom_right: 0, radius_bottom_right: 0,
image_spacing: 2, image_spacing: 2,
limit_size: false,
image_height: 100,
common_style: defaultCommon, common_style: defaultCommon,
}, },
}; };

View File

@ -25,6 +25,7 @@ interface defaultSearch {
title_color: string; title_color: string;
title_size: number; title_size: number;
title_weight: string; title_weight: string;
img_height: number;
icon_size: number; icon_size: number;
icon_color: string; icon_color: string;
subtitle_color: string; subtitle_color: string;
@ -39,7 +40,7 @@ interface defaultSearch {
} }
const defaultSearch: defaultSearch = { const defaultSearch: defaultSearch = {
content: { content: {
title: '', title: '标题',
title_link: {}, title_link: {},
img_src: [], img_src: [],
icon_class: '', icon_class: '',
@ -62,6 +63,7 @@ const defaultSearch: defaultSearch = {
title_color: '#000', title_color: '#000',
title_size: 12, title_size: 12,
title_weight: 'normal', title_weight: 'normal',
img_height: 30,
icon_size: 12, icon_size: 12,
icon_color: '#999', icon_color: '#999',
subtitle_color: '#999', subtitle_color: '#999',