<script lang="ts" setup>
|
import { CountTo } from '@vben/common-ui';
|
import { usePreferences } from '@vben/preferences';
|
|
import { Card } from 'ant-design-vue';
|
|
import { growCardList } from './data';
|
|
defineProps({
|
loading: { type: Boolean },
|
});
|
|
const { isDark } = usePreferences();
|
</script>
|
<template>
|
<div class="home-grow-card md:flex">
|
<template v-for="(item, index) in growCardList" :key="item.title">
|
<Card
|
size="small"
|
:loading="loading"
|
class="home-grow-card-item w-full md:!mt-0 md:w-1/4"
|
:class="{ 'md:!mr-[10px]': index + 1 < 4, '!mt-[10px]': index > 0 }"
|
:style="{ background: !isDark ? item.bg : '' }">
|
<div class="home-grow-card-item-main-img">
|
<img :src="item.mainImg" />
|
</div>
|
<img :src="item.icon" class="home-grow-card-item-icon" />
|
<div class="home-grow-card-item-content">
|
<div class="mb-[6px] flex items-center justify-start">
|
<span>总{{ item.title }}</span>
|
<span class="item-tag" :style="{ background: item.tagBg, color: item.color }">{{ item.action }}</span>
|
</div>
|
<CountTo :start-val="1" :end-val="item.value" class="text-[24px] font-bold leading-[30px]" />
|
<div class="mt-[53px] flex justify-between">
|
<span>总{{ item.title }}:</span>
|
<CountTo :start-val="1" :end-val="item.total" />
|
</div>
|
</div>
|
</Card>
|
</template>
|
</div>
|
</template>
|
<style lang="scss" scoped>
|
.home-grow-card {
|
.home-grow-card-item {
|
height: 180px;
|
overflow: hidden;
|
border-radius: 10px !important;
|
|
:deep(.ant-card-body) {
|
position: relative;
|
display: flex;
|
height: 100%;
|
padding: 20px 0 0 20px !important;
|
}
|
|
.home-grow-card-item-icon {
|
flex-shrink: 0;
|
width: 50px;
|
height: 50px;
|
margin-right: 13px;
|
}
|
|
.home-grow-card-item-main-img {
|
position: absolute;
|
right: 0;
|
bottom: 0;
|
z-index: 0;
|
width: 163px;
|
height: 153px;
|
}
|
|
.home-grow-card-item-content {
|
position: relative;
|
z-index: 1;
|
|
.item-tag {
|
display: inline-block;
|
width: 32px;
|
height: 20px;
|
margin-left: 8px;
|
font-size: 12px;
|
line-height: 20px;
|
text-align: center;
|
border-radius: 5px;
|
}
|
}
|
}
|
}
|
</style>
|