114 lines
2.5 KiB
Vue
114 lines
2.5 KiB
Vue
<template>
|
|
<j-card
|
|
hoverable
|
|
:class="[
|
|
'card-render',
|
|
'container',
|
|
checked === data.id ? 'checked' : '',
|
|
]"
|
|
@click="checkedChange(data.id)"
|
|
>
|
|
<div class="title">
|
|
<Ellipsis style="width: calc(100% - 100px); margin-bottom: 24px">
|
|
{{ data.name }}
|
|
</Ellipsis>
|
|
</div>
|
|
|
|
<slot name="other"></slot>
|
|
<div class="desc">
|
|
<j-tooltip placement="topLeft" :title="data.description">{{
|
|
data.description
|
|
}}</j-tooltip>
|
|
</div>
|
|
<div class="checked-icon">
|
|
<div><CheckOutlined /></div>
|
|
</div>
|
|
</j-card>
|
|
</template>
|
|
|
|
<script lang="ts" setup name="AccessCard">
|
|
import { CheckOutlined } from '@ant-design/icons-vue';
|
|
|
|
const emit = defineEmits(['checkedChange']);
|
|
|
|
const props = defineProps({
|
|
checked: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
data: {
|
|
type: Object,
|
|
default: () => {},
|
|
},
|
|
});
|
|
|
|
const checkedChange = (id: string) => {
|
|
emit('checkedChange', id);
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.card-render {
|
|
width: 100%;
|
|
overflow: hidden;
|
|
// background: url('/public/images/access.png') no-repeat;
|
|
// background-size: 100% 100%;
|
|
height: 140px;
|
|
background: #fafafa;
|
|
border: 1px solid #e6e6e6;
|
|
.title {
|
|
font-style: normal;
|
|
font-weight: 800;
|
|
font-size: 16px;
|
|
line-height: 22px;
|
|
color: rgba(0, 0, 0, 0.85);
|
|
opacity: 0.85;
|
|
}
|
|
|
|
.desc {
|
|
width: 100%;
|
|
margin-top: 10px;
|
|
color: rgba(0, 0, 0, 0.55);
|
|
font-weight: 400;
|
|
font-size: 13px;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.checked-icon {
|
|
position: absolute;
|
|
right: -22px;
|
|
bottom: -22px;
|
|
z-index: 2;
|
|
display: none;
|
|
width: 44px;
|
|
height: 44px;
|
|
color: #fff;
|
|
background-color: @primary-color;
|
|
transform: rotate(-45deg);
|
|
|
|
> div {
|
|
position: relative;
|
|
height: 100%;
|
|
transform: rotate(45deg);
|
|
font-size: 12px;
|
|
padding: 4px 0 0 6px;
|
|
}
|
|
}
|
|
&.checked {
|
|
position: relative;
|
|
color: @primary-color;
|
|
border-color: @primary-color;
|
|
z-index: 0;
|
|
.checked-icon {
|
|
display: block;
|
|
}
|
|
}
|
|
}
|
|
.container {
|
|
background: url('/public/images/access-icon.png') no-repeat;
|
|
background-position: bottom right;
|
|
}
|
|
</style>
|