167 lines
3.8 KiB
Vue
167 lines
3.8 KiB
Vue
<template>
|
|
<div class="pool-card" @click="cardClickFun">
|
|
<img class="cover-img" :src="index % 2 !== 0 ? projectBlue : projectGreen" alt="" />
|
|
<div class="overlay-text">
|
|
<div class="pool-title" :title="pool.poolName">{{ pool.poolName }}</div>
|
|
</div>
|
|
<div class="bottom-box">
|
|
<span class="gl-text-ellipsis gl-pointer-class" :title="pool.poolName">
|
|
{{ pool.poolName }}
|
|
</span>
|
|
<span class="pool-meta">
|
|
{{ pool.currentVersion || pool.versions?.[0] || '--' }}
|
|
</span>
|
|
</div>
|
|
|
|
<el-dropdown
|
|
class="options-dropdown"
|
|
:class="{ 'is-visible': isDropdownVisible }"
|
|
@command="commandFun"
|
|
@visible-change="visibleChangeFun"
|
|
>
|
|
<div class="options-btn" @click.stop>
|
|
<el-icon :size="18"><MoreFilled /></el-icon>
|
|
</div>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<template v-for="(action, aIndex) in actionList" :key="aIndex">
|
|
<el-dropdown-item :command="action">
|
|
<el-link :type="action.type">{{ action.title }}</el-link>
|
|
</el-dropdown-item>
|
|
</template>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue';
|
|
import { MoreFilled } from '@element-plus/icons-vue';
|
|
import projectBlue from '@/assets/imgs/projectList/project-blue.png';
|
|
import projectGreen from '@/assets/imgs/projectList/project-green.png';
|
|
|
|
interface Props {
|
|
pool: any;
|
|
index: number;
|
|
actionList: any[];
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
pool: () => ({}),
|
|
index: 0,
|
|
actionList: () => [],
|
|
});
|
|
|
|
const emit = defineEmits(['cardClick', 'actionClick']);
|
|
|
|
const isDropdownVisible = ref(false);
|
|
|
|
const cardClickFun = () => {
|
|
emit('cardClick', props.pool);
|
|
};
|
|
|
|
const commandFun = (command: any) => {
|
|
emit('actionClick', props.pool, command);
|
|
};
|
|
|
|
const visibleChangeFun = (visible: boolean) => {
|
|
isDropdownVisible.value = visible;
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@use '@/views/task/projectList/components/projectCard.scss';
|
|
|
|
.pool-card {
|
|
@extend .project-card-base;
|
|
border-radius: 12px;
|
|
border: 1px solid #f0f0f0;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
|
|
&:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
|
|
.cover-img {
|
|
transform: scale(1.1);
|
|
}
|
|
}
|
|
|
|
&:hover .options-dropdown,
|
|
.options-dropdown.is-visible {
|
|
opacity: 1;
|
|
}
|
|
|
|
.cover-img {
|
|
transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
}
|
|
|
|
.overlay-text {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: calc(100% - 46px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 5;
|
|
pointer-events: none;
|
|
|
|
.pool-title {
|
|
font-size: 22px;
|
|
font-weight: 700;
|
|
color: #545454;
|
|
margin-bottom: 6px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 90%;
|
|
letter-spacing: 0.5px;
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.pool-version {
|
|
font-size: 13px;
|
|
color: #545454;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 90%;
|
|
font-weight: 500;
|
|
pointer-events: auto;
|
|
}
|
|
}
|
|
|
|
.bottom-box {
|
|
height: 46px;
|
|
padding: 0 16px;
|
|
background-color: #ffffff;
|
|
border-top: 1px solid #f5f5f5;
|
|
|
|
.gl-text-ellipsis {
|
|
font-size: 14px;
|
|
color: #333;
|
|
font-weight: 500;
|
|
transition: color 0.3s;
|
|
&:hover {
|
|
color: var(--el-color-primary);
|
|
}
|
|
}
|
|
|
|
.pool-meta {
|
|
font-size: 12px;
|
|
color: #8c8c8c;
|
|
background-color: #f5f5f5;
|
|
border-radius: 6px;
|
|
padding: 0 8px;
|
|
height: 24px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
}
|
|
}
|
|
}
|
|
</style>
|