1.diy---- 文章列表开发

master
sws 2024-09-11 09:39:02 +08:00
parent ed670fca51
commit 73214732bc
1 changed files with 19 additions and 41 deletions

View File

@ -6,10 +6,10 @@
<view v-for="(item, index) in data_list" class="item bg-white oh" :class="article_theme == '0' ? 'flex-row' : 'flex-col'" :key="index" :style="article_style">
<template v-if="article_theme !== '3'">
<template v-if="item.new_cover.length > 0">
<image :src="item.new_cover[0].url" class="img" :style="img_radius" mode="widthFix" />
<image :src="item.new_cover[0].url" class="img" :style="img_radius" mode="aspectFill" />
</template>
<template v-else>
<image :src="item.data.cover" class="img" :style="img_radius" mode="widthFix" />
<image :src="item.data.cover" class="img" :style="img_radius" mode="aspectFill" />
</template>
</template>
<view class="jc-sb flex-1" :class="article_theme == '3' ? 'flex-row align-c' : 'flex-col'" :style="article_theme !== '0' ? content_padding : ''">
@ -27,17 +27,17 @@
</view>
</view>
<view v-else class="oh" :class="article_theme_class">
<el-carousel :key="carousel_key" indicator-position="none" :interval="interval_time" arrow="never" :autoplay="is_roll ? true : false">
<el-carousel-item v-for="(item1, index1) in article_carousel_list" :key="index1" class="flex" :style="article_spacing">
<swiper class="swiper" circular :autoplay="is_roll ? true : false" :interval="interval_time" :style="'height:' + carousel_height_computer">
<swiper-item v-for="(item1, index1) in article_carousel_list" :key="index1" class="flex-row" :style="article_spacing">
<view v-for="(item, index) in item1.carousel_list" :key="index" class="item bg-white oh flex-col" :style="article_style">
<template v-if="item.new_cover.length > 0">
<image :src="item.new_cover[0].url" class="img" :style="img_radius" mode="widthFix" />
<image :src="item.new_cover[0].url" class="img" :style="img_radius + article_item_height" mode="aspectFill" />
</template>
<template v-else>
<image :src="item.data.cover" class="img" :style="img_radius" mode="widthFix" />
<image :src="item.data.cover" class="img" :style="img_radius + article_item_height" mode="aspectFill" />
</template>
<view class="jc-sb flex-1 flex-col" :style="article_theme !== '0' ? content_padding : ''">
<view class="title text-line-2" :style="article_name">{{ item.new_title ? item.new_title : item.data.title }}</view>
<view class="title text-line-2" :style="article_name + article_name_height_computer">{{ item.new_title ? item.new_title : item.data.title }}</view>
<view class="flex-row jc-sb gap-8 align-e margin-top">
<view :style="article_date">{{ field_show.includes('0') ? item.data.add_time : '' }}</view>
<view v-show="field_show.includes('1')" class="flex-row align-c gap-3" :style="article_page_view">
@ -49,8 +49,8 @@
</view>
</view>
</view>
</el-carousel-item>
</el-carousel>
</swiper-item>
</swiper>
</view>
</view>
</view>
@ -97,26 +97,21 @@
//
article_spacing: '',
article_spacing_children: '',
article_item_height: '155',
article_item_height: '',
article_style: {},
//
carousel_col: '2',
// key
carousel_key: '0',
//
interval_time: 2000,
//
is_roll: 1,
article_theme_class: '',
// (gap * gap) /
multicolumn_columns_width: '',
//
carousel_height_computer: '',
//
article_name_height_computer: '',
article_name_line_height_computer: '',
//
article_carousel_list: [],
};
@ -165,32 +160,29 @@
} else if (this.article_theme == '4') {
// key
this.carousel_col = new_content.carousel_col || '1';
this.carousel_key = new_style.interval_time + new_style.is_roll;
//
this.interval_time = (new_style.interval_time || 2) * 1000;
//
this.is_roll = new_style.is_roll;
this.article_item_height = `${new_style.article_height}px`;
this.article_style += this.content_radius;
} else {
//
const { carousel_col } = new_content;
let gap = carousel_col !== '0' ? (new_style.article_spacing * carousel_col) / (Number(carousel_col.value) + 1) : '0';
this.article_item_height = `max-height: ${new_style.article_height}px`;
// (gap * gap) /
this.multicolumn_columns_width = `width:calc(${100 / (Number(carousel_col.value) + 1)}% - ${gap}px);min-width:calc(${100 / (Number(carousel_col.value) + 1)}% - ${gap}px)`;
const multicolumn_columns_width = `width:calc(${100 / (Number(this.carousel_col) + 1)}% - ${gap}px);min-width:calc(${100 / (Number(this.carousel_col) + 1)}% - ${gap}px)`;
this.article_style += this.content_radius + multicolumn_columns_width;
//
let gap = this.carousel_col !== '0' ? (new_style.article_spacing * this.carousel_col) / (Number(this.carousel_col) + 1) : '0';
//
this.carousel_height_computer = new_style.name_size * 2 + new_style.article_height + 'px';
//
this.article_name_height_computer = new_style.name_size * 2.4 + 'px';
this.article_name_line_height_computer = new_style.name_size * 1.2 + 'px';
this.article_name_height_computer = `height:${new_style.name_size * 2.4 * 2}rpx;line-height:${new_style.name_size * 1.2 * 2}rpx;`;
//
const cloneList = JSON.parse(JSON.stringify(this.data_list));
//
if (cloneList.length > 0) {
//
const num = Number(carousel_col) + 1;
const num = Number(this.carousel_col) + 1;
//
let nav_list = [];
//
@ -264,24 +256,10 @@
}
.style5 {
.item {
width: v-bind(multicolumn_columns_width);
min-width: v-bind(multicolumn_columns_width);
width: 100%;
.img {
width: 100%;
max-height: v-bind(article_item_height);
}
.title {
height: v-bind(article_name_height_computer);
line-height: v-bind(article_name_line_height_computer);
}
}
}
:deep(.el-carousel) {
width: 100%;
.el-carousel__container {
// height: v-bind(article_item_height);
height: v-bind(carousel_height_computer);
}
}
</style>