修改:优化文章卡片样式

This commit is contained in:
小莫唐尼 2023-08-03 01:55:57 +08:00
parent ee28753094
commit 70dc7cd0a7
2 changed files with 467 additions and 400 deletions

View File

@ -1,13 +1,7 @@
<template> <template>
<view class="article-card " :class="cardType" @click="fnClickEvent('card')"> <view class="article-card " :class="cardType" @click="fnClickEvent('card')">
<view class="left"> <view class="left">
<cache-image <cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.thumbnail)" :fileMd5="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></cache-image>
class="thumbnail"
radius="12rpx"
:url="$utils.checkThumbnailUrl(article.thumbnail)"
:fileMd5="$utils.checkThumbnailUrl(article.thumbnail)"
mode="aspectFill"
></cache-image>
<!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></image> --> <!-- <image class="thumbnail" lazy-load :src="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></image> -->
</view> </view>
<view class="right"> <view class="right">
@ -33,8 +27,8 @@
</template> </template>
<script> <script>
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'; import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
export default { export default {
name: 'article-card', name: 'article-card',
components: { tmTags }, components: { tmTags },
props: { props: {
@ -65,38 +59,49 @@ export default {
this.$emit('on-click', this.article); this.$emit('on-click', this.article);
} }
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.article-card { .article-card {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
margin: 0 24rpx; margin: 0 24rpx;
padding: 32rpx; padding: 24rpx;
border-radius: 12rpx; border-radius: 12rpx;
background-color: #ffff; background-color: #ffff;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03); box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
overflow: hidden; overflow: hidden;
margin-bottom: 24rpx; margin-bottom: 24rpx;
&.h_row_col1 {
display: flex;
align-items: center;
}
&.home { &.home {
&.h_row_col2 { &.h_row_col2 {
margin: 12rpx; margin: 12rpx;
.left { .left {
width: 100%; width: 100%;
height: 200rpx; height: 200rpx;
.thumbnail { .thumbnail {
::v-deep uni-image { ::v-deep uni-image {
border-radius: 6rpx 6rpx 0 0 !important; border-radius: 6rpx 6rpx 0 0 !important;
} }
} }
} }
.right { .right {
.title { .title {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 26rpx; font-size: 26rpx;
font-weight: bold; font-weight: bold;
.is-top { .is-top {
height: 36rpx; height: 36rpx;
margin-right: 10rpx; margin-right: 10rpx;
@ -105,22 +110,28 @@ export default {
transform: scale(0.9); transform: scale(0.9);
} }
} }
.foot { .foot {
justify-content: space-between; justify-content: space-between;
.create-time { .create-time {
font-size: 24rpx; font-size: 24rpx;
.time-label { .time-label {
display: none; display: none;
} }
} }
.visits { .visits {
font-size: 24rpx; font-size: 24rpx;
margin-left: 0; margin-left: 0;
} }
} }
} }
&.tb_text_image { &.tb_text_image {
padding: 12rpx; padding: 12rpx;
.left .thumbnail { .left .thumbnail {
::v-deep { ::v-deep {
uni-image { uni-image {
@ -129,14 +140,17 @@ export default {
} }
} }
} }
&.only_text { &.only_text {
padding: 24rpx; padding: 24rpx;
.right .foot { .right .foot {
.create-time { .create-time {
.time-label { .time-label {
display: none; display: none;
} }
} }
.visits { .visits {
font-size: 24rpx; font-size: 24rpx;
} }
@ -144,92 +158,113 @@ export default {
} }
} }
} }
&.lr_image_text {
} &.lr_image_text {}
&.lr_text_image { &.lr_text_image {
.left { .left {
order: 2; order: 2;
padding-left: 30rpx; padding-left: 30rpx;
} }
.right { .right {
order: 1; order: 1;
padding-left: 0; padding-left: 0;
} }
} }
&.tb_image_text { &.tb_image_text {
flex-direction: column; flex-direction: column;
padding: 24rpx; padding: 24rpx;
.left { .left {
width: 100%; width: 100%;
height: 340rpx; height: 340rpx;
.thumbnail { .thumbnail {
::v-deep uni-image { ::v-deep uni-image {
border-radius: 6rpx 6rpx 0 0 !important; border-radius: 6rpx 6rpx 0 0 !important;
} }
} }
} }
.right { .right {
padding-left: 0; padding-left: 0;
padding: 24rpx 0; padding: 24rpx 0;
padding-bottom: 0; padding-bottom: 0;
width: 100%; width: 100%;
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
} }
} }
} }
&.tb_text_image { &.tb_text_image {
flex-direction: column; flex-direction: column;
.left { .left {
width: 100%; width: 100%;
height: 340rpx; height: 340rpx;
order: 2; order: 2;
margin-top: 24rpx; margin-top: 24rpx;
} }
.right { .right {
padding-left: 0; padding-left: 0;
width: 100%; width: 100%;
order: 1; order: 1;
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
} }
} }
} }
&.only_text { &.only_text {
padding: 36rpx; padding: 36rpx;
.left { .left {
display: none; display: none;
} }
.right { .right {
padding-left: 0; padding-left: 0;
.content { .content {
margin-top: 24rpx; margin-top: 24rpx;
} }
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
margin-top: 24rpx; margin-top: 24rpx;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
@ -240,12 +275,14 @@ export default {
.left { .left {
width: 240rpx; width: 240rpx;
height: 180rpx; height: 180rpx;
.thumbnail { .thumbnail {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 12rpx; border-radius: 12rpx;
} }
} }
.right { .right {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
@ -253,11 +290,13 @@ export default {
flex-direction: column; flex-direction: column;
padding-left: 30rpx; padding-left: 30rpx;
box-sizing: border-box; box-sizing: border-box;
.title { .title {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 30rpx; font-size: 30rpx;
color: var(--main-text-color); color: var(--main-text-color);
.is-top { .is-top {
height: 40rpx; height: 40rpx;
padding: 0 12rpx; padding: 0 12rpx;
@ -271,10 +310,12 @@ export default {
border-radius: 6rpx 12rpx; border-radius: 6rpx 12rpx;
box-shadow: none !important; box-shadow: none !important;
} }
&-text { &-text {
color: #303133; color: #303133;
} }
} }
.content { .content {
display: -webkit-box; display: -webkit-box;
font-size: 26rpx; font-size: 26rpx;
@ -283,6 +324,7 @@ export default {
margin-top: 14rpx; margin-top: 14rpx;
line-height: 42rpx; line-height: 42rpx;
} }
.foot { .foot {
display: flex; display: flex;
font-size: 24rpx; font-size: 24rpx;
@ -293,10 +335,12 @@ export default {
.create-time { .create-time {
font-size: 26rpx; font-size: 26rpx;
.time-label { .time-label {
display: none; display: none;
} }
} }
.visits { .visits {
.number { .number {
padding: 0 6rpx; padding: 0 6rpx;
@ -305,5 +349,5 @@ export default {
} }
} }
} }
} }
</style> </style>

View File

@ -1,13 +1,7 @@
<template> <template>
<view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')"> <view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')">
<view class="left"> <view class="left">
<cache-image <cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.thumbnail)" :fileMd5="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></cache-image>
class="thumbnail"
radius="12rpx"
:url="$utils.checkThumbnailUrl(article.thumbnail)"
:fileMd5="$utils.checkThumbnailUrl(article.thumbnail)"
mode="aspectFill"
></cache-image>
</view> </view>
<view class="right"> <view class="right">
<view class="title text-overflow">{{ article.title }}</view> <view class="title text-overflow">{{ article.title }}</view>
@ -30,7 +24,7 @@
</template> </template>
<script> <script>
export default { export default {
name: 'article-min-card', name: 'article-min-card',
props: { props: {
article: { article: {
@ -43,11 +37,11 @@ export default {
this.$emit('on-click', this.article); this.$emit('on-click', this.article);
} }
} }
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.article-min-card { .article-min-card {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
border-radius: 12rpx; border-radius: 12rpx;
@ -57,82 +51,101 @@ export default {
margin-bottom: 24rpx; margin-bottom: 24rpx;
padding: 16rpx; padding: 16rpx;
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03); box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
&.lr_image_text {
} &.lr_image_text {}
&.lr_text_image { &.lr_text_image {
.left { .left {
order: 2; order: 2;
padding-left: 30rpx; padding-left: 30rpx;
} }
.right { .right {
order: 1; order: 1;
padding-left: 0; padding-left: 0;
} }
} }
&.tb_image_text { &.tb_image_text {
flex-direction: column; flex-direction: column;
.left { .left {
width: 100%; width: 100%;
height: 220rpx; height: 220rpx;
} }
.right { .right {
padding-left: 0; padding-left: 0;
width: 100%; width: 100%;
.title { .title {
margin-top: 24rpx; margin-top: 24rpx;
} }
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
} }
} }
} }
&.tb_text_image { &.tb_text_image {
flex-direction: column; flex-direction: column;
.left { .left {
width: 100%; width: 100%;
height: 220rpx; height: 220rpx;
order: 2; order: 2;
margin-top: 20rpx; margin-top: 20rpx;
} }
.right { .right {
padding-left: 0; padding-left: 0;
width: 100%; width: 100%;
order: 1; order: 1;
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
} }
} }
} }
&.only_text { &.only_text {
.left { .left {
display: none; display: none;
} }
.right { .right {
padding-left: 0; padding-left: 0;
.foot { .foot {
justify-content: flex-start; justify-content: flex-start;
.create-time { .create-time {
.time-label { .time-label {
display: inline-block; display: inline-block;
} }
} }
.visits { .visits {
margin-left: 24rpx; margin-left: 24rpx;
} }
@ -143,28 +156,33 @@ export default {
.left { .left {
width: 180rpx; width: 180rpx;
height: 130rpx; height: 130rpx;
.thumbnail { .thumbnail {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 12rpx; border-radius: 12rpx;
} }
} }
.right { .right {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-left: 24rpx; padding-left: 20rpx;
.title { .title {
font-size: 28rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
color: var(--main-text-color); color: var(--main-text-color);
} }
.content { .content {
font-size: 26rpx; font-size: 26rpx;
color: #909399; color: #909399;
margin-top: 14rpx; margin-top: 14rpx;
} }
.foot { .foot {
display: flex; display: flex;
font-size: 24rpx; font-size: 24rpx;
@ -172,20 +190,25 @@ export default {
align-items: center; align-items: center;
color: #909399; color: #909399;
margin-top: 14rpx; margin-top: 14rpx;
.create-time { .create-time {
font-size: 24rpx; font-size: 24rpx;
.time-label { .time-label {
display: none; display: none;
} }
.icon { .icon {
font-size: 24rpx; font-size: 24rpx;
padding-right: 4rpx; padding-right: 4rpx;
} }
} }
.visits { .visits {
.icon { .icon {
font-size: 28rpx; font-size: 28rpx;
} }
.number { .number {
padding: 0 6rpx; padding: 0 6rpx;
font-size: 24rpx; font-size: 24rpx;
@ -193,5 +216,5 @@ export default {
} }
} }
} }
} }
</style> </style>